Ketchup API (Google Nano Banana 2) Developer Guide
Build fast with walkthroughs, sample payloads, and best practices built for Ketchup API image workflows.
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.orgoverview.api_version
v1.0.0Getting Started with Ketchup API
- Open a Ketchup API workspace and create an access token.
- Add the Ketchup API Bearer token to the Authorization header for every call.
- POST to the Ketchup API image generation endpoint with prompts, mode, and references.
- Store the returned job ID and poll the status endpoint or subscribe to webhooks.
- 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-1234567890abcdefSample 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/genRequest Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| model | string | Yes | Model identifier (e.g., "google/gempix2") |
| prompt | string | Yes | Text prompt describing the image |
| images | array | No | Reference image URLs (max 4) |
| callback_url | string | No | Webhook 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
| Parameter | Type | Required | Description |
|---|---|---|---|
| task_id | string | Yes | Unique 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"
}| Field | Type | Description |
|---|---|---|
| image | string | Image 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
}
}| Field | Type | Description |
|---|---|---|
| result | array | Array of ImageGenResult objects (null if failed) |
| status | string | Final task status (success/failed) |
| task_id | string | Unique task identifier |
| consumed | string | Credits consumed by the task |
| status_reason | object | Status details including error message if failed |
Model Schemas
google/gempix2Nano Banana image generation modelgoogle/gemini-2.5-flash-imageGemini 2.5 Flash image modelTroubleshooting
Understand Ketchup API error formats, retry rules, and when to escalate to support.
HTTP Status Codes
OK
Request was successful
Bad Request
Invalid request parameters or malformed JSON
Unauthorized
Invalid, missing, or expired API key
Not Found
Task not found or endpoint doesn't exist
Internal Server Error
Server-side error occurred
Best Practices
- Check the HTTP status code before parsing the payload.
- Use exponential backoff when retrying Ketchup API jobs after 500 errors.
- Log the request ID so the Ketchup API support team can trace issues.
- Validate prompts and image URLs locally to avoid 400 responses.
- Rotate Ketchup API tokens if authentication starts failing.
- Poll job status no more than once per second to respect rate limits.
- 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;
}
}