Tasks
Create, fetch and list tasks. Statuses, the task object and input rules.
A task is one generation request. Creating it charges your balance and queues the work; the result arrives later.
Create a task
POST /api/v1/tasks
{
"model": "nano-banana-2.1",
"input": { "prompt": "a lighthouse at dusk", "resolution": "2K" },
"callback_url": "https://example.com/hook"
}| Field | Required | Notes |
|---|---|---|
model | yes | A model id from GET /models. |
input | yes | An object that matches the model's input_schema. |
callback_url | no | A public https URL we post the result to. See Webhooks. |
Send an Idempotency-Key header so a retry cannot create a second task. See Errors and idempotency.
The response is 201 with the task object, and status is waiting. 201 means accepted and charged, not finished.
We check your key, your unfinished-task limit and the input against the model's schema before anything is charged. A request that fails any check costs nothing.
The task object
{
"id": "task_...",
"model": "nano-banana-2.1",
"status": "success",
"input": { "prompt": "a lighthouse at dusk", "resolution": "2K" },
"output": { "urls": ["https://cdn.nsfwapi.io/results/..."], "expires_at": "2026-12-15T00:00:00Z" },
"error": null,
"cost": "0.038",
"refunded": false,
"created_at": "2026-12-01T09:14:04Z",
"completed_at": "2026-12-01T09:14:32Z"
}costis the price fixed when the task was created.outputhas a value only whenstatusissuccess.errorhas a value only when it isfail:{ "code", "message" }.- On
fail, the full price is refunded to your balance andrefundedistrue.coststill shows the original price. - Times are ISO 8601 in UTC. Clients must ignore fields they do not know; we may add fields without a version change.
Statuses
waiting → queuing → generating → success or fail.
| Status | Meaning |
|---|---|
waiting | Accepted and charged, not yet sent to a model. |
queuing | Sent to a model, waiting for it to start. |
generating | The model is working. |
success | Done. Files are in output.urls. Final. |
fail | It did not complete. Refunded. Final. |
success and fail are final: a task never changes after that. Poll every two seconds or so, or use a webhook.
Result files
Files are served from cdn.nsfwapi.io and kept for at least 14 days. output.expires_at tells you when they may disappear. Download anything you need to keep.
Get one task
GET /api/v1/tasks/{id} returns the task object. You can only read your own tasks; anyone else's id answers 404.
List tasks
GET /api/v1/tasks
| Query | Notes |
|---|---|
limit | 1 to 100. Default 20. |
cursor | The next_cursor from the previous page. |
status | Only tasks in this status. |
model | Only tasks for this model. |
{ "data": [ { "id": "task_...", "status": "success" } ], "next_cursor": "..." }next_cursor is null on the last page. Newest tasks come first. Treat the cursor as an opaque string.
Models
GET /api/v1/models returns { "data": [ ... ] } with the models you can use. GET /api/v1/models/{id} returns a single model object, shaped like this:
{
"id": "nano-banana-2.1",
"type": "image",
"name": "Nano Banana 2.1",
"description": "...",
"input_schema": { "type": "object", "required": ["prompt"], "properties": { } },
"pricing": { "type": "per_task", "price": "0.025", "by": { "field": "resolution", "prices": { "1K": "0.025", "2K": "0.038", "4K": "0.057" } } }
}input_schemais a standard JSON Schema. Validate your input against it before you send it.pricingis the price rule.per_taskcharges once,per_imagecharges per image,per_secondcharges per second of video. Whenbyis present, the price depends on that input field; a value not listed usesprice.
Input rules
- Images and videos you pass in must be public
httpsURLs. There is no upload endpoint. Plainhttp, URLs with a username or password, IP addresses, and private hostnames such aslocalhostor.internalare rejected. - The request body can be up to 128 KB, and
inputup to 64 KB. - Each account can have 20 unfinished tasks at once by default. Beyond that you get
429 rate_limitedwith aRetry-Afterheader. We do not queue silently.