Image Series
Nano Banana Pro API
nano-banana-progenerates images withPOST /v1/images/generationsand edits reference images withPOST /v1/images/edits.- Send
"async": trueto get a task id right away, then pollGET /v1/tasks/{id}. Asynchronous calls are recommended. - Result links are APIKO-signed and kept for 24 hours; download anything you need to keep.
POST
Authorizations
All requests use Bearer authentication:
Authorization: Bearer <API_KEY>.Create a key in Console → API Keys.
Routes
string
POST /v1/images/generations— text to imagePOST /v1/images/edits— edit or combine reference images (JSON body withimages)GET /v1/tasks/{id}— query an asynchronous task
Body
application/json
model
stringdefault:nano-banana-prorequired
Use this exact public model id.
Available options:
nano-banana-proExample:
"nano-banana-pro"prompt
stringrequired
Image description.
Minimum length:
1Example:
"A cinematic product photo on a marble table"size
enum<string>
Aspect ratio; omitted = 1:1 for generations and the reference image's ratio for edits.
Only the listed values are accepted.
Available options:
1:1, 16:9, 9:16, 4:3, 3:4, 3:2, 2:3, 21:9Example:
"1:1"resolution
enum<string>default:1k
Output tier; omitted = 1k.
Values are lowercase. Omit the field for the default tier. Each tier has its own price; see the model page.
Output sizes measured through APIKO (portrait ratios swap width and height):
1k:1:11024×1024,16:91376×768,4:31200×896,3:21264×848,21:91584×6722k:1:12048×20484k:1:14096×4096,16:95504×3072
The file may be JPEG or PNG; check the
Content-Type of the result URL.Available options:
1k, 2k, 4kExample:
"1k"images
string<uri>[]
Reference image HTTPS URLs; required for /v1/images/edits.
- Accepted only by
POST /v1/images/edits, where at least one image is required. Send the edits request as JSON, not multipart form data. - Every entry must be a publicly reachable HTTPS URL; file uploads, base64 and data URLs are rejected. For a local image, upload it to
POST /v1/uploads/imagesfirst (multipart fieldfile) and pass the returnedurl; uploads are kept 72 hours. - Each URL must return the image file itself. A reference that cannot be downloaded as an image is accepted, then the task ends in
failedwithfail_reasona reference image could not be downloaded; use a public https:// image URL or upload the image, and the charge is refunded in full; files over 15 MB fail the same way.
Items:
1–9Example:
["https://example.com/reference.png"]n
enum<integer>default:1
Only
1 is accepted. Send separate requests for more images.Available options:
1Example:
1response_format
enum<string>default:url
Results are always returned as APIKO-signed URLs.
Available options:
url, b64_jsonExample:
"url"async
booleandefault:false
True returns a task id; poll GET /v1/tasks/{id}.
- Recommended. With
truethe response is a task object right away; pollGET /v1/tasks/{id}until it completes. - With
falsethe request stays open until the image is ready. A request with no response after 100 seconds is closed with HTTP 524 but is still charged, and no task id comes back to fetch the image.
Example:
falsecallback_url
string<uri>
Optional public HTTPS URL notified when the task finishes.
- When the task ends in
completedorfailed, APIKO POSTs the same JSON asGET /v1/tasks/{id}with headerX-Apiko-Task-Id. - Each delivery waits up to 10 seconds; any 2xx response counts as delivered. A failed delivery is retried 3 times, after 2, 10 and 30 seconds.
- Redirects are not followed: a 3xx response counts as a failed delivery. A
callback_urlthat is not a public HTTPS URL is rejected when you submit (invalid_callback_url). - Callbacks are not signed: re-fetch the task to confirm the result.
Example:
"https://your-domain.com/webhooks/apiko-task"Response
200 - application/json
Charged when the request is accepted; a task that ends in failed is refunded in full.
id
string
Task id returned by an
async request. Use it with GET /v1/tasks/{id}.Example:
"task_abc123"status
enum<string>
Task status. Poll every 5–10 seconds until it is
completed or failed.Available options:
queued, in_progress, completed, failedprogress
string
Progress reported by the task, e.g.
"100%".data
object[]
Present when the task is
completed. Each data[].url is an APIKO-signed image link kept for 24 hours; download anything you need to keep.A synchronous request (
async omitted or false) returns { "created": …, "data": [{ "url": … }] } directly.fail_reason
string
Why the task failed. Failed tasks are refunded in full.
Image models answer one of:
the prompt or a reference image was rejected by the content safety review; change them and try again (retrying the same input fails the same way), the image service is busy or temporarily unavailable; please retry later, the request or a reference image was not accepted; check the parameters and reference images, a reference image could not be downloaded; use a public https:// image URL or upload the image, or image generation failed.GET /v1/tasks/{id}
object
The 200 response example is what submitting returns. Polling returns the task in this shape (a callback POSTs the same JSON):
Example:
Errors
application/json
Errors use the shape { "error": { "message", "type", "param", "code" } }; most messages end with a request id to quote when you contact support.
400
error
Invalid request. Fix the request instead of retrying it; it is not charged.
- A field this page does not list, e.g.
seed is not supported. - A value outside the listed options or range, e.g.
size must be one of: …. - A missing or empty
prompt(prompt is required). nother than 1 (n must be 1).imagessent to/v1/images/generations(images requires the edits endpoint), or an image URL that is not HTTPS (images must contain HTTPS URLs).- More than 9
images(images must contain 1 to 9 HTTPS URLs). - An edit without
images(images is required for edits), or an edit sent as multipart form data (JSON body required). - A
callback_urlthat is not a public HTTPS URL:code: "invalid_callback_url",callback_url must be an HTTPS public URL(no request id).
401
error
Missing or invalid API key (
Invalid token).403
error
Insufficient balance (
code: "insufficient_user_quota"). Add credit in Console → Billing.404
error
GET /v1/tasks/{id} for a task that does not exist or belongs to another account (Task not found).503
error
The model exists but none of its routes can take the request right now:
No available channel for model … (code: "model_not_found"). Retry later with backoff, or pick another model. A missing or misspelled model returns 404 with the same message; check the id instead of retrying.524
error
A synchronous request (
async omitted or false) got no response within 100 seconds and the edge closed it. The request was still accepted and charged, but no task id was returned, so the image cannot be retrieved. Use "async": true for anything that may take over a minute.