Submit async image task
Submit an async image generation task. Returns a task_id in ~1s.
Poll GET /v1/images/async/{taskId} for status (up to 10 minutes).
Request body: multipart/form-data. Optional image[] field
carries reference images (repeat the same field name for
multiple, up to 10); omit for text-to-image.
Billed per image by quality tier. Amount is frozen on submit
and debited only when status=succeeded; failures / rejections /
errors refund automatically.
Authorization
BearerAuth API key authentication (OpenAI format). Pass in the Authorization header:
Authorization: Bearer tr-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
In: header
Request Body
multipart/form-data
TypeScript Definitions
Use the request body type in TypeScript.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X post "https://api.xrtoken.ai/v1/images/async" \ -F model="gpt-image-2" \ -F prompt="replace the background with cherry blossoms"{
"id": "4efa6a93-c0c8-4418-b11f-60152b3ce130",
"request_id": "tr-req-2ee8d1734e29472c9c7a15c7bd07bc76",
"status": "queued",
"model": "string",
"created_at": 0
}{
"error": "model field is required",
"type": "invalid_request_error"
}{
"error": "invalid or missing API key",
"type": "auth_error"
}{
"error": "insufficient balance -- please top up or upgrade your plan",
"type": "billing_error"
}{
"error": "rate limit exceeded",
"type": "rate_limit_error"
}