Ketchup API (Google Nano Banana 2) Ontwikkelaarsgids
Bouw snel met handleidingen, voorbeeldpayloads en best practices voor Ketchup API beeldworkflows.
Ketchup API Overzicht
Ketchup API maakt productfoto's, UI-achtergronden en sociale graphics met voorspelbare renderingkwaliteit. Het REST-ontwerp houdt integraties eenvoudig, terwijl het platform schaalt van solo makers tot enterprise launches.
Ketchup API Mogelijkheden
- Tekst-naar-beeld generatie afgestemd op productiescènes met Ketchup API modellen.
- Referentie-geleide bewerking met maximaal vijf afbeeldingen in één Ketchup API verzoek.
- Asynchrone taakwachtrij zodat je app responsief blijft terwijl Ketchup API rendert.
- Webhook callbacks waarmee Ketchup API statuswijzigingen real-time kan doorsturen.
- Consistente JSON schema's die Ketchup API responses gemakkelijk te parsen houden.
- Bearer token beveiliging beheerd in het Ketchup API dashboard.
overview.base_url
https://api.defapi.orgoverview.api_version
v1.0.0Aan de Slag met Ketchup API
- Open een Ketchup API workspace en maak een toegangstoken aan.
- Voeg het Ketchup API Bearer token toe aan de Authorization header voor elke call.
- POST naar het Ketchup API beeldgeneratie endpoint met prompts, modus en referenties.
- Bewaar het geretourneerde taak-ID en poll het status endpoint of abonneer op webhooks.
- Download de eindbestanden zodra Ketchup API de taak als succesvol markeert.
Authenticatie
Elke Ketchup API-aanvraag heeft een geldige Bearer token nodig. Roteer sleutels per omgeving en controleer het gebruik regelmatig.
Bearer Token Methode
Voeg je Ketchup API-token toe aan de Authorization header zoals hieronder getoond:
Authorization: Bearer <your-api-key>Token Format Voorbeeld
Authorization: Bearer dk-1234567890abcdefVoorbeeldaanvraag
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"
}'Geldige Token Checklist
- ✅ Token is actief en niet verlopen.
- ✅ Workspace heeft Ketchup API-toegang ingeschakeld.
- ✅ Account heeft resterende quota of tegoed.
Veelvoorkomende Problemen
- ❌ Ontbrekende Authorization header.
- ❌ Verkeerd geformatteerde Bearer token waarde.
- ❌ Opgeschorte workspace of ingetrokken token.
Ketchup API Afbeelding Generatie
Maak nieuwe renders, pas bestaande assets aan, of mix mood boards met het Ketchup API generatie-eindpunt.
Eindpunt
POST /api/image/genAanvraag 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 Voorbeelden
Basis Ketchup API Prompt
{
"model": "google/gempix2",
"prompt": "A beautiful girl dancing in a garden"
}Ketchup API Remix met Referenties
{
"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"
}
}Foutafhandeling
400 - Bad Request
{"code": 1, "message": "failed", "detail": "prompt is required"}401 - Unauthorized
{"code": 1, "message": "Invalid API key"}Ketchup API Job Status
Bewaak rendervoortgang en haal bezorg-URLs op met het status-eindpunt.
Eindpunt
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 |
Voorbeeldaanvraag
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 heeft de aanvraag geaccepteerd en de job in de wachtrij gezet.submitted - Ketchup API heeft de job ingepland voor verwerking.in_progress - Ketchup API is nu assets aan het renderen.success - Ketchup API heeft het renderen voltooid en assets zijn klaar voor download.failed - Ketchup API kon de job niet renderen vanwege een fout.Foutcodes
404 - Task Not Found
{"code": 1, "message": "task not found"}401 - Unauthorized
{"code": 401, "message": "Invalid API key"}Ketchup API Datamodellen
Gedetailleerde schema's voor request payloads, job responses en webhook bodies die gebruikt worden in Ketchup API integraties.
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 |
Modelschema's
google/gempix2Nano Banana image generation modelgoogle/gemini-2.5-flash-imageGemini 2.5 Flash image modelProbleemoplossing
Begrijp Ketchup API foutformaten, retry regels en wanneer je contact moet opnemen met support.
HTTP Statuscodes
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
Beste Praktijken
- Controleer de HTTP statuscode voordat je de payload parseert.
- Gebruik exponential backoff bij het opnieuw proberen van Ketchup API jobs na 500 fouten.
- Log het request ID zodat het Ketchup API support team problemen kan traceren.
- Valideer prompts en afbeelding URLs lokaal om 400 responses te voorkomen.
- Roteer Ketchup API tokens als authenticatie begint te falen.
- Poll job status maximaal één keer per seconde om rate limits te respecteren.
- Verkies webhooks voor high-volume runs zodat Ketchup API updates kan pushen.
Voorbeeld Foutafhandeling (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;
}
}