Developer Docs/Flux 2 API

Flux 2 API

Build Flux 2 integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

Overview

High-quality image generation using the Flux 2 Pro model. Delivers strong results for both creative and photorealistic use cases with fast inference.

Primary Endpoint

POST/api/v1/userFlux2/start

Start Flux 2 Pro image generation or editing

Request Parameters

NameTypeRequiredDescription
namestringYesName of the image generation task
promptstringYesText prompt for image generation or editing instruction.
input_imagesarray<string>NoArray of input image URLs for image-to-image editing or multi-image composition (up to 8 images). When provided, automatically switches to image-to-image mode for character consistency.
aspect_ratioenum: 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 2:3 | 3:2 | custom | match_input_imageNoAspect ratio of the generated image. Options: 1:1, 16:9, 9:16, 4:3, 3:4, 2:3, 3:2, custom, match_input_image
resolutionenum: 1K | 2KNoResolution of the generated image. - 1K: ~1 megapixel - 2K: ~2 megapixels
force_generatebooleanNoForce generation even if NSFW content is detected. Defaults to true for API users, false for web users
webhook_urlstringNoHTTPS URL to receive task.completed / task.failed notifications. Best-effort delivery, single attempt, no retries; clients should treat the detail API as the source of truth.
webhook_tokenstringNoOptional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.

Request Example

curl -X POST "https://www.a2e.com.cn/api/v1/userFlux2/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "Elon Musk and Mark Zuckerberg boxing",
  "prompt": "Elon Musk and Mark Zuckerberg boxing in a professional ring",
  "input_images": [
    "https://example.com/reference1.jpg",
    "https://example.com/reference2.jpg"
  ],
  "aspect_ratio": "9:16",
  "resolution": "1K",
  "force_generate": true,
  "webhook_url": "https://your-server.example.com/a2e/webhook",
  "webhook_token": "a-shared-secret"
}'

Related Endpoints

POST/api/v1/userFlux2/start

Start Flux 2 Pro image generation or editing

GET/api/v1/userFlux2/list

Get Flux 2 Pro task list

POST/api/v1/userFlux2/batchDetail

Batch query task details

GET/api/v1/userFlux2/detail/{id}

Get task details

DELETE/api/v1/userFlux2/{id}

Delete Flux 2 Pro task

Responses

200

Flux 2 Pro task started successfully or NSFW content detected

400

Invalid request parameters

401

Unauthorized - Invalid or missing token

402

Insufficient credits

500

Internal server error