Developer Docs/Text to Image API

Text to Image API

Build Text to Image integrations with A2E. Review authentication, request parameters, task creation, status, and result endpoints.

Overview

Generate images from natural language prompts using the platform's diffusion model pipeline. Describe what you want - style, composition, lighting - and receive high-resolution results.

Primary Endpoint

POST/api/v1/userText2Image/start

Start text to image generation

Request Parameters

NameTypeRequiredDescription
namestringNoName of the text to image task (optional, auto-generated if not provided)
promptstringYesText prompt for image generation
widthnumberNoImage width
heightnumberNoImage height
model_typeenum: a2e | seedreamNoModel type to use for generation
input_imagesarray<string>NoReference images for A2E/Seedream model. A2E max 2 images; Seedream 5.0 Pro max 10 images.
skip_face_enhancebooleanNoWhether to disable face similarity enhancement for A2E image edit. Defaults to false.
aspect_ratioenum: 1:1 | 4:3 | 3:4 | 16:9 | 9:16 | 2:3 | 3:2 | 21:9NoAspect ratio for Seedream model
max_imagesintegerNoMaximum number of images to generate (creates multiple tasks internally)
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/userText2Image/start" \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "My Generated Image",
  "prompt": "A beautiful sunset over mountains",
  "width": 1024,
  "height": 1024,
  "model_type": "a2e",
  "input_images": [
    "https://example.com/image1.jpg",
    "https://example.com/image2.jpg"
  ],
  "skip_face_enhance": false,
  "aspect_ratio": "1:1",
  "max_images": 1,
  "webhook_url": "https://your-server.example.com/a2e/webhook",
  "webhook_token": "a-shared-secret"
}'

Related Endpoints

POST/api/v1/userText2Image/start

Start text to image generation

GET/api/v1/userText2Image/allRecords

Get all text to image records

POST/api/v1/userText2Image/batchDetail

Batch query task details

GET/api/v1/userText2Image/{_id}

Get text to image record detail

DELETE/api/v1/userText2Image/{_id}

Delete task

POST/api/v1/userText2Image/quickAddAvatar

Quick add avatar from generated image

Responses

200

Text to image task started successfully

400

Bad Request - Invalid parameters

401

Unauthorized - Invalid or missing bearer token