Skip to main content
Create an asynchronous text-to-image generation with NanoBanana 2 (higher quality). Returns 202 Accepted with a job_id — poll GET /jobs/{job_id} until the job is done or failed.
POST /nb2/text-generations
NanoBanana 2 supports selectable resolution (1K, 2K, 4K) and the full aspect-ratio set.

Headers

Authorization
string
required
Bearer <YOUR_API_KEY>. See Authentication.
Idempotency-Key
string
Optional. Replaying the same key returns the original job_id without creating a duplicate job or charging again.

Body

prompt
string
required
Generation prompt. Minimum length 1. Null bytes are stripped.
aspect_ratio
string
required
Output aspect ratio. See Aspect ratios for the full set.
resolution
string
1K, 2K, or 4K. See Resolutions.
callback_url
string | null
Webhook URL called once the job reaches a terminal state. Overrides the account webhook for this request. See Webhooks.

Response

Returns 202 Accepted.
job_id
string
UUID of the created job.
status
string
Always queued on creation.
status_url
string
Relative path to poll for status and result.
curl -s -X POST https://bananahub.io/api/v1/nb2/text-generations \
  -H "Authorization: Bearer $API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "prompt": "a red panda astronaut floating in a nebula",
    "aspect_ratio": "16:9",
    "resolution": "2K"
  }'
{
  "job_id": "0193a7f2-1c4a-7e0b-9b3a-2f1d8c6e4a55",
  "status": "queued",
  "status_url": "/api/v1/jobs/0193a7f2-1c4a-7e0b-9b3a-2f1d8c6e4a55"
}
See Errors for 401, 402, 403, 422, and 503 responses.