/APIXO Docs

Status Task

Query the status of a generation task

Status Task

Query the status and results of a generation task.

Endpoint

GET https://api.apixo.ai/api/v1/statusTask/{model}?taskId={taskId}

Parameters

ParameterLocationRequiredDescription
modelpathYesModel ID used for generation
taskIdqueryYesTask ID from submission response

Headers

HeaderRequiredDescription
AuthorizationYesBearer YOUR_API_KEY

Response

Response Structure

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_abc123xyz789",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://cdn.apixo.ai/output/abc123.jpg\"]}",
    "costTime": 12500,
    "createTime": 1704067200000,
    "completeTime": 1704067212500
  }
}

Task States

StateDescription
pendingTask received, waiting to be processed
processingTask is being processed by the AI model
successGeneration completed successfully
failedGeneration failed (see error details)

Response Fields

FieldTypeDescription
taskIdstringTask identifier
statestringCurrent task state
resultJsonstringJSON string containing result URLs (on success)
costTimeintegerProcessing time in milliseconds
createTimeintegerTask creation timestamp (Unix ms)
completeTimeintegerTask completion timestamp (Unix ms)
failCodestringError code (on failure)
failMsgstringError message (on failure)

State-Specific Responses

Pending / Processing

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_abc123xyz789",
    "state": "processing",
    "createTime": 1704067200000
  }
}

Success

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_abc123xyz789",
    "state": "success",
    "resultJson": "{\"resultUrls\":[\"https://cdn.apixo.ai/output/abc123.jpg\"]}",
    "costTime": 12500,
    "createTime": 1704067200000,
    "completeTime": 1704067212500
  }
}

Parsing resultJson:

const result = JSON.parse(data.resultJson);
const urls = result.resultUrls; // Array of generated content URLs

Failed

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_abc123xyz789",
    "state": "failed",
    "failCode": "CONTENT_VIOLATION",
    "failMsg": "Content violates usage policy",
    "createTime": 1704067200000,
    "completeTime": 1704067205000
  }
}

Result URLs

The resultUrls array contains direct links to generated content:

{
  "resultUrls": [
    "https://cdn.apixo.ai/output/abc123.jpg",
    "https://cdn.apixo.ai/output/abc124.jpg"
  ]
}

Important: Result URLs expire after 24 hours. Download and store important outputs.

Examples

curl "https://api.apixo.ai/api/v1/statusTask/nano-banana?taskId=task_abc123" \
  -H "Authorization: Bearer YOUR_API_KEY"

Polling Example

async function waitForResult(model, taskId, apiKey) {
  const maxAttempts = 60;
  const pollInterval = 3000; // 3 seconds
  
  for (let i = 0; i < maxAttempts; i++) {
    const response = await fetch(
      `https://api.apixo.ai/api/v1/statusTask/${model}?taskId=${taskId}`,
      { headers: { 'Authorization': `Bearer ${apiKey}` } }
    );
    
    const { data } = await response.json();
    
    switch (data.state) {
      case 'success':
        return JSON.parse(data.resultJson).resultUrls;
      case 'failed':
        throw new Error(`${data.failCode}: ${data.failMsg}`);
      default:
        await new Promise(r => setTimeout(r, pollInterval));
    }
  }
  
  throw new Error('Timeout waiting for result');
}

Error Responses

CodeDescription
401Invalid or missing API key
404Task not found
429Rate limit exceeded

See Errors for detailed error handling.

On this page