Ketchup API (Google Nano Banana 2) Developer Guide

Build fast with walkthroughs, sample payloads, and best practices built for Ketchup API image workflows.

See Ketchup API PricingCompare Ketchup API plans and usage tiers.

Ketchup API Overview

Ketchup API powers product shots, UI backgrounds, and social graphics with predictable rendering quality. The REST design keeps integrations simple, while the platform scales from solo makers to enterprise launches.

Ketchup API Capabilities

  • Text-to-image generation tuned for production scenes with Ketchup API models.
  • Reference guided editing with up to five images on a single Ketchup API request.
  • Asynchronous job queue so your app stays responsive while Ketchup API renders.
  • Webhook callbacks that let Ketchup API push status changes in real time.
  • Consistent JSON schemas that keep Ketchup API responses easy to parse.
  • Bearer token security managed in the Ketchup API dashboard.

overview.base_url

https://api.defapi.org

overview.api_version

v1.0.0

Getting Started with Ketchup API

  1. Open a Ketchup API workspace and create an access token.
  2. Add the Ketchup API Bearer token to the Authorization header for every call.
  3. POST to the Ketchup API image generation endpoint with prompts, mode, and references.
  4. Store the returned job ID and poll the status endpoint or subscribe to webhooks.
  5. Download the final files once Ketchup API marks the job as success.

Authentication

Every Ketchup API request needs a valid Bearer token. Rotate keys per environment and audit usage often.

Bearer Token Method

Attach your Ketchup API token to the Authorization header as shown below:

Authorization: Bearer <your-api-key>

Token Format Example

Authorization: Bearer dk-1234567890abcdef

Sample Request

curl -X POST "https://api.defapi.org/api/image/gen" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer your-api-key-here" \
  -d '{
    "model": "google/gempix2",
    "prompt": "A beautiful landscape"
  }'

Valid Token Checklist

  • Token is active and unexpired.
  • Workspace has Ketchup API access enabled.
  • Account has remaining quota or credit.

Common Issues

  • Missing Authorization header.
  • Malformed Bearer token value.
  • Suspended workspace or revoked token.

Ketchup API Image Generation

Create fresh renders, revise existing assets, or blend mood boards with the Ketchup API generation endpoint.

Endpoint

POST /api/image/gen

Request Parameters

ParameterTypeRequiredDescription
modelstringYesModel identifier (e.g., "google/gempix2")
promptstringYesText prompt describing the image
imagesarrayNoReference image URLs (max 4)
callback_urlstringNoWebhook URL for completion notifications

Code Examples

Basic Ketchup API Prompt

{
  "model": "google/gempix2",
  "prompt": "A beautiful girl dancing in a garden"
}

Ketchup API Remix with References

{
  "model": "google/gempix2",
  "prompt": "Put them in a basket",
  "images": [
    "https://cdn.openai.com/API/docs/images/body-lotion.png",
    "https://cdn.openai.com/API/docs/images/soap.png"
  ],
  "callback_url": "https://example.com/webhook/image-callback"
}

Response Schema

{
  "code": 0,
  "message": "ok",
  "data": {
    "task_id": "ta12345678-1234-1234-1234-123456789abc"
  }
}

Error Handling

400 - Bad Request

{"code": 1, "message": "failed", "detail": "prompt is required"}

401 - Unauthorized

{"code": 1, "message": "Invalid API key"}

Ketchup API Job Status

Monitor rendering progress and fetch delivery URLs using the status endpoint.

Endpoint

GET /api/task/query?task_id=<task_id>

Query Parameters

ParameterTypeRequiredDescription
task_idstringYesUnique task identifier returned from generation endpoint

Sample Request

curl -X GET "https://api.defapi.org/api/task/query?task_id=ta823dfb-eaac-44fd-aec2-3e2c7ba8e071" \
  -H "Authorization: Bearer your-api-key-here"

Status Codes

pending - Ketchup API accepted the request and queued the job.
submitted - Ketchup API scheduled the job for processing.
in_progress - Ketchup API is rendering assets now.
success - Ketchup API finished rendering and assets are ready to download.
failed - Ketchup API could not render the job due to an error.

Error Codes

404 - Task Not Found

{"code": 1, "message": "task not found"}

401 - Unauthorized

{"code": 401, "message": "Invalid API key"}

Ketchup API Data Models

Detailed schemas for request payloads, job responses, and webhook bodies used across Ketchup API integrations.

ImageGenResult

Represents a generated image result.

{
  "image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
}
FieldTypeDescription
imagestringImage URL or base64 data URI

CallbackPayload

Payload sent to the callback_url when task status changes to final states.

{
  "result": [
    {
      "image": "https://google.datas.systems/fileSystem/response_images/287/2025/08/29/1756432513771985292_2989.png"
    }
  ],
  "status": "success",
  "task_id": "ta5c9705-b8ae-4cb9-aa6f-97c4fee88c8d",
  "consumed": "0.500000",
  "status_reason": {
    "message": null
  }
}
FieldTypeDescription
resultarrayArray of ImageGenResult objects (null if failed)
statusstringFinal task status (success/failed)
task_idstringUnique task identifier
consumedstringCredits consumed by the task
status_reasonobjectStatus details including error message if failed

Model Schemas

google/gempix2Nano Banana image generation model
google/gemini-2.5-flash-imageGemini 2.5 Flash image model

Troubleshooting

Understand Ketchup API error formats, retry rules, and when to escalate to support.

HTTP Status Codes

200

OK

Request was successful

400

Bad Request

Invalid request parameters or malformed JSON

401

Unauthorized

Invalid, missing, or expired API key

404

Not Found

Task not found or endpoint doesn't exist

500

Internal Server Error

Server-side error occurred

Best Practices

  1. Check the HTTP status code before parsing the payload.
  2. Use exponential backoff when retrying Ketchup API jobs after 500 errors.
  3. Log the request ID so the Ketchup API support team can trace issues.
  4. Validate prompts and image URLs locally to avoid 400 responses.
  5. Rotate Ketchup API tokens if authentication starts failing.
  6. Poll job status no more than once per second to respect rate limits.
  7. Prefer webhooks for high-volume runs so Ketchup API can push updates.

Sample Error Handling (JavaScript)

async function generateImage(prompt, apiKey) {
  try {
    const response = await fetch('https://api.defapi.org/api/image/gen', {
      method: 'POST',
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${apiKey}`
      },
      body: JSON.stringify({
        model: 'google/gempix2',
        prompt: prompt
      })
    });

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(`API Error ${response.status}: ${errorData.message}`);
    }

    const data = await response.json();
    return data.data.task_id;

  } catch (error) {
    console.error('Image generation failed:', error.message);
    throw error;
  }
}