Create generation

Creates a generation from one photo.

POST/v1/generations

The 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" }  }'
Response 202 Accepted
{  "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

Idempotency-Key*string

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_ratio2K4K (default)
1:12048 × 20484096 × 4096
2:31696 × 25283392 × 5056
3:22528 × 16965056 × 3392
3:41792 × 24003584 × 4800
4:32400 × 17924800 × 3584
4:51856 × 23043712 × 4608
5:42304 × 18564608 × 3712
9:161536 × 27523072 × 5504
16:92752 × 15365504 × 3072
21:93168 × 13446336 × 2688

Responses

StatusMeaning
202Accepted: the new generation, queued.
400The request can't be accepted as sent.
402No live credits are left.
409This Idempotency-Key was used with a different body in the last 24 hours.
413The photo or the request body is too large.
415The 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.