Skip to main content
Query the status and results of a generation task.

Endpoint

Parameters

string
required
Model ID used when the task was submitted (e.g., nano-banana, flux-2).
string
required
Task ID returned from the Generate Task endpoint.

Headers

string
required
Bearer token for API authentication. Format: Bearer YOUR_API_KEY

Response

Task States

Response Fields

string
Unique task identifier.
string
Current task state: pending, processing, success, or failed.
string
JSON string containing resultUrls array. Only present when state is success. Parse with JSON.parse().
integer
Processing time in milliseconds. Only present on completion.
integer
Task creation timestamp (Unix milliseconds).
integer
Task completion timestamp (Unix milliseconds). Only present on completion.
string
Error code. Only present when state is failed.
string
Human-readable error message. Only present when state is failed.

State-Specific Responses

Pending / Processing

Success

Parsing resultJson:

Failed

HTTP 200 with state: "failed" means the API request succeeded but the task itself failed. Check failCode and failMsg for the reason. See Errors for all failure codes.

Result URLs

The resultUrls array contains direct links to generated content:
Result URLs expire after 24 hours. Download and store important outputs promptly.

Examples

Polling Example

Error Responses

See Errors for detailed error handling.