Create generation
Creates a generation from one photo.
/v1/generationsThe quality of your photo strongly affects the result. See the Photo guide.
The answer is 202 Accepted with the generation, usually within seconds, and the job runs in the background. Our objective is about 30–40 seconds once it starts.
Every request needs an Idempotency-Key: one UUID per photo, reused with the same body when you retry. A live job takes 1 credit, and a failed job is refunded.
curl -sS https://api.foodshot.ai/v1/generations \ --max-time 60 \ -H "Authorization: Bearer $FOODSHOT_API_KEY" \ -H 'Content-Type: application/json' \ -H 'Idempotency-Key: 5f0c2b7e-9a4d-4c1b-8e3f-6d2a1b9c7e40' \ -d '{ "image_url": "https://docs.foodshot.ai/samples/dish.jpg", "style_id": "pure-shot", "aspect_ratio": "1:1", "metadata": { "dish_id": "d_456" } }'{ "id": "gen_4Kq9xT2mVb7Zp1Ls8Hc3Rw", "object": "generation", "environment": "live", "status": "queued", "created_at": "2026-10-18T10:42:07.512Z", "started_at": null, "completed_at": null, "style_id": "pure-shot", "instruction": null, "aspect_ratio": "1:1", "resolution": "4k", "format": "jpeg", "metadata": { "dish_id": "d_456", "vendor_id": "v_1029" }, "credits_charged": 1, "output": null, "error": null, "delivery": { "status": "none", "attempts": 0, "last_status_code": null, "last_attempt_at": null }}Headers
One unique value per photo, such as a UUID. Reuse it with the same body when you retry. Remembered for 24 hours.
Request body
application/json
Send one of image_url or image_base64, and a style_id, an instruction or both.
Result sizes
Width × height in pixels, for each aspect_ratio and resolution.
aspect_ratio | 2K | 4K (default) |
|---|---|---|
1:1 | 2048 × 2048 | 4096 × 4096 |
2:3 | 1696 × 2528 | 3392 × 5056 |
3:2 | 2528 × 1696 | 5056 × 3392 |
3:4 | 1792 × 2400 | 3584 × 4800 |
4:3 | 2400 × 1792 | 4800 × 3584 |
4:5 | 1856 × 2304 | 3712 × 4608 |
5:4 | 2304 × 1856 | 4608 × 3712 |
9:16 | 1536 × 2752 | 3072 × 5504 |
16:9 | 2752 × 1536 | 5504 × 3072 |
21:9 | 3168 × 1344 | 6336 × 2688 |
Responses
| Status | Meaning |
|---|---|
202 | Accepted: the new generation, queued. |
400 | The request can't be accepted as sent. |
402 | No live credits are left. |
409 | This Idempotency-Key was used with a different body in the last 24 hours. |
413 | The photo or the request body is too large. |
415 | The body isn't JSON, or the photo isn't JPEG, PNG, WebP or HEIC. |
Like every endpoint, this one can also answer 401, 403, 429, 500 or 503. Every error has the same body. Errors says what each code means and what to do.