Skip to content

Nano Banana API ​

Server routes for AI image generation using the Nano Banana service.

POST /api/nano-banana/jobs ​

Create a new image generation job.

Request Body ​

typescript
{
  projectId: string
  prompt: string
  inputImageId?: string     // FK to pip_ai_document_images
  inputImagePath?: string   // Direct storage path fallback
  pageId?: string
  materialIds?: string[]
  materialPayload?: Array<{
    id?: string
    name?: string
    imageUrl?: string
  }>
  options?: {
    size?: string       // e.g., '1024x1024'
    seed?: number
    safety?: string
  }
}

Response ​

json
{
  "jobId": "uuid",
  "status": "queued"
}

GET /api/nano-banana/jobs ​

List jobs for a project.

Query Parameters ​

ParamTypeDescription
projectIdstringRequired. Project UUID
statusstringOptional. Filter by status
limitnumberOptional. Max results

POST /api/nano-banana/messages ​

Send a refinement message to an existing job.

Request Body ​

typescript
{
  jobId: string
  prompt: string
  variantId?: string   // Reference variant to refine from
}

GET /api/nano-banana/jobs/[jobId]/messages ​

Get chat history and variants for a job.


POST /api/nano-banana/callback ​

N8N callback with generation results (webhook secret protected).

Headers ​

x-webhook-secret: <N8N_NANO_BANANA_SECRET>

Request Body ​

typescript
{
  job_id: string
  status: 'succeeded' | 'failed'
  output_paths?: Array<{
    variant_id: string
    path: string
    thumb_path?: string
    meta?: Record<string, any>
  }>
  error?: string
}

Source ​

server/api/nano-banana/

Built with VitePress