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
/api/v1/userFlux2/startGenerate high-quality images from text or edit existing images using Flux 2 Pro model. **Features:** - Text-to-Image generation with advanced prompt understanding - Image-to-Image editing (supports up to 8 reference images) - Character consistency across multiple images - Text rendering within images - High-quality output with professional-grade results **Processing Time:** - Usually 20-60 seconds **Output:** - Images are stored in R2 storage (3days-apac bucket) and expire 3 days after the task is created (createdAt + 3 days, same as `expirationDate`) - Download and persist the result to your own storage before it expires; `image_url` is a temporary CDN URL, not a permanent asset address - Expired tasks are omitted from the list endpoint; the detail endpoint still returns the record with `isExpired: true`, but its media URLs are no longer downloadable. ### Request - Send a valid bearer token. The server evaluates the operation in the authenticated caller's access context. - Send an `application/json` body. Required fields: `name`, `prompt`. - API-token callers may include `webhook_url` and `webhook_token` for best-effort terminal-state notifications; ordinary JWT/cookie calls ignore these fields. ### Behavior - This is an asynchronous operation: a successful submission creates a task and returns before processing finishes. - Persist the returned task identifier and use the corresponding detail or list operation to observe progress. - Treat the detail endpoint as the source of truth even when webhook delivery is enabled. ### Response - A `200` response confirms task acceptance; it does not by itself mean media generation has completed. - Retain the returned identifier and wait for a documented terminal status before using output URLs. - JSON object responses, including error responses, normally carry a top-level `trace_id` string for this request; include it when contacting support. It is not a task identifier. - Do not infer undocumented fields or statuses; clients should tolerate additional response properties. ### Errors - `400` — Invalid request parameters. - `401` — Unauthorized - Invalid or missing token. - `402` — Insufficient credits. - `500` — Internal server error. ### Related Operations - `GET /api/v1/userFlux2/list` — Get Flux 2 Pro task list. - `GET /api/v1/userFlux2/detail/{id}` — Get task details. - `DELETE /api/v1/userFlux2/{id}` — Delete Flux 2 Pro task. Authentication: set header Authorization: Bearer <token> (supports user JWT or sk_ API token).
Request Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| name | string | Yes | Name of the image generation task |
| prompt | string | Yes | Text prompt for image generation or editing instruction. |
| creation_mode | enum: text-to-image | image-edit | No | Optional compatibility field for history and mode reporting; callers may omit it. The server ignores any supplied value and records `image-edit` when `input_images` contains a valid HTTP(S) image URL, otherwise `text-to-image`. It is not forwarded to the model provider. |
| input_images | array<string> | No | Array 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_ratio | enum: 1:1 | 16:9 | 9:16 | 4:3 | 3:4 | 2:3 | 3:2 | custom | match_input_image | No | Aspect ratio of the generated image. Options: 1:1, 16:9, 9:16, 4:3, 3:4, 2:3, 3:2, custom, match_input_image; default: "9:16" |
| resolution | enum: 1K | 2K | No | Resolution of the generated image. - 1K: ~1 megapixel - 2K: ~2 megapixels ; default: "1K" |
| force_generate | boolean | No | Force generation even if NSFW content is detected. Defaults to true for API users, false for web users; default: true |
| minor_suspected_skip | boolean | No | Set to true when retrying after error code 1004 to confirm and bypass the suspected-minor soft block.; default: false |
| webhook_url | string | No | HTTPS 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.; maxLength: 2048 |
| webhook_token | string | No | Optional plaintext token returned in the X-A2e-Webhook-Token header so receivers can verify the request originated from a2e.; maxLength: 256 |
Request schema and conditional rules
{
"allOf": [
{
"type": "object",
"properties": {
"name": {
"type": "string",
"description": "Name of the image generation task",
"example": "Elon Musk and Mark Zuckerberg boxing"
},
"prompt": {
"type": "string",
"description": "Text prompt for image generation or editing instruction.\n",
"example": "Elon Musk and Mark Zuckerberg boxing in a professional ring"
},
"creation_mode": {
"type": "string",
"enum": [
"text-to-image",
"image-edit"
],
"description": "Optional compatibility field for history and mode reporting; callers may omit it. The server ignores any supplied value and records `image-edit` when `input_images` contains a valid HTTP(S) image URL, otherwise `text-to-image`. It is not forwarded to the model provider."
},
"input_images": {
"type": "array",
"items": {
"type": "string"
},
"description": "Array of input image URLs for image-to-image editing or multi-image composition (up to 8 images).\nWhen provided, automatically switches to image-to-image mode for character consistency.\n",
"example": [
"https://example.com/reference1.jpg",
"https://example.com/reference2.jpg"
]
},
"aspect_ratio": {
"type": "string",
"description": "Aspect ratio of the generated image. Options: 1:1, 16:9, 9:16, 4:3, 3:4, 2:3, 3:2, custom, match_input_image",
"enum": [
"1:1",
"16:9",
"9:16",
"4:3",
"3:4",
"2:3",
"3:2",
"custom",
"match_input_image"
],
"default": "9:16",
"example": "9:16"
},
"resolution": {
"type": "string",
"description": "Resolution of the generated image.\n- 1K: ~1 megapixel\n- 2K: ~2 megapixels\n",
"enum": [
"1K",
"2K"
],
"default": "1K",
"example": "1K"
},
"force_generate": {
"type": "boolean",
"description": "Force generation even if NSFW content is detected. Defaults to true for API users, false for web users",
"default": true
},
"minor_suspected_skip": {
"type": "boolean",
"default": false,
"description": "Set to true when retrying after error code 1004 to confirm and bypass the suspected-minor soft block."
}
},
"required": [
"name",
"prompt"
]
},
{
"$ref": "#/components/schemas/WebhookInput"
}
]
}Response Fields
- code: enum: 0
- data: object
- data._id: string
- Task ID
- data.name: string
- data.prompt: string
- data.input_images: array<string>
- data.aspect_ratio: string
- data.resolution: string
- data.current_status: enum: initialized | processing
- data.reference_id: string
- Unique reference ID for tracking
- data.coins: integer
- Credits deducted for this task
- data.createdAt: string
- data.expirationDate: string
- Date when the generated image expires (createdAt + 3 days)
- data.expirationDays: integer
- Retention period in days
- data.remainingDays: integer
- Days left before the result expires
- data.isExpired: boolean
- Whether the result has expired
- trace_id: string
- Trace ID of this HTTP request. Include it when contacting support about this request. It is generated per request and is not a task identifier; use the returned task `_id` to query results.
- data.nsfw_detected: enum: true
- data.message: string
- data.severity: enum: low | medium | high
- data.detected_categories: array<string>
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"
}'Related Endpoints
Responses
Flux 2 Pro task started successfully or NSFW content detected
Invalid request parameters
Unauthorized - Invalid or missing token
Insufficient credits
Internal server error