Skip to main content
Submit a generation task to any supported AI model.

Endpoint

POST https://api.apixo.ai/api/v1/generateTask/{model}
Replace {model} with the model ID (e.g., nano-banana, flux-2, sora-2, midjourney).

Headers

Authorization
string
required
Bearer token for API authentication. Format: Bearer YOUR_API_KEY
Content-Type
string
required
Must be application/json.

Request Body

request_type
string
default:"async"
required
How to receive results. async for polling via the status endpoint, callback for webhook delivery.
callback_url
string
Webhook URL for receiving results. Required when request_type is callback. Must be a publicly accessible HTTPS URL that responds with HTTP 200 within 30 seconds. See Webhooks for details.
input
object
required
Model-specific generation parameters.
See individual model documentation for complete parameter lists, or the Parameter Specification for all common fields.

Response

{
  "code": 200,
  "message": "success",
  "data": {
    "taskId": "task_abc123xyz789"
  }
}
code
integer
HTTP status code.
message
string
Human-readable status message.
data
object
Save the taskId — you’ll need it to query status or debug issues later.

Examples

Async Mode (Polling)

curl -X POST https://api.apixo.ai/api/v1/generateTask/nano-banana \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "async",
    "input": {
      "mode": "text-to-image",
      "prompt": "A futuristic city at sunset",
      "aspect_ratio": "16:9"
    }
  }'

Callback Mode (Webhooks)

curl -X POST https://api.apixo.ai/api/v1/generateTask/nano-banana \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "request_type": "callback",
    "callback_url": "https://your-server.com/webhook/apixo",
    "input": {
      "mode": "text-to-image",
      "prompt": "A futuristic city at sunset",
      "aspect_ratio": "16:9"
    }
  }'

Error Responses

CodeDescription
400Invalid request parameters
401Invalid or missing API key
403Insufficient permissions
429Rate limit exceeded
500Server error
See Errors for detailed error handling.