API Reference
Complete REST API documentation for generating, enhancing, and processing food photos with AI. All endpoints accept JSON and require HTTPS.
Getting Started
Three steps to your first AI-generated food photo.
Sign up & get API key
Create an account, choose a plan (starting at $3), and generate your API key from the dashboard Settings tab.
Create accountAuthenticate
Include your API key in the Authorization header of every request.
Authorization: Bearer YOUR_API_KEYMake your first request
Send a POST to /api/generate with your prompt and receive an AI-generated food photo.
Base URL
https://api.foodphoto.aiAll API requests must use HTTPS.
Quick Example: Generate a Food Photo
Choose your language and copy the example to get started.
curl -X POST https://api.foodphoto.ai/api/generate \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"prompt": "Gourmet burger with melted cheese, sesame bun, fresh lettuce, on a rustic wooden board",
"style": "natural",
"model": "flux-2-pro",
"aspect_ratio": "1:1"
}'API Endpoints
All endpoints accept and return JSON.
/api/generateAuth requiredGenerate professional food photos from a text prompt using AI models.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| prompt | string | Yes | Text description of the food photo you want |
| style | string | No | Lighting style: "natural", "moody", "bright", "overhead", "macro" |
| model | string | No | AI model: "flux-2-pro", "seeddream", "flux-2-max" |
| aspect_ratio | string | No | Aspect ratio: "1:1", "4:3", "16:9", "9:16" |
| count | number | No | Number of images to generate (1-4, default: 1) |
Response (200 OK)
{
"id": "gen_abc123",
"status": "completed",
"credits_used": 1,
"images": [
{
"url": "https://cdn.foodphoto.ai/gen/abc123_0.jpg",
"width": 1024,
"height": 1024
}
],
"model": "flux-2-pro",
"created_at": "2026-02-09T12:00:00Z"
}/api/enhanceAuth requiredEnhance an uploaded food photo with AI - improve lighting, colors, and composition.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image_url | string | Yes | Publicly accessible URL to the image |
| preset | string | No | "delivery-optimized", "social-media", "print-ready", "balanced" |
| options | object | No | { "upscale": true, "remove_background": false } |
Response (200 OK)
{
"id": "enh_xyz789",
"status": "completed",
"credits_used": 1,
"original_url": "https://example.com/burger.jpg",
"enhanced_url": "https://cdn.foodphoto.ai/enhanced/xyz789.jpg",
"width": 2048,
"height": 2048,
"created_at": "2026-02-09T12:00:00Z"
}/api/remove-backgroundAuth requiredRemove the background from a food photo, returning a transparent PNG.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image_url | string | Yes | Publicly accessible URL to the image |
Response (200 OK)
{
"id": "bg_def456",
"status": "completed",
"credits_used": 1,
"result_url": "https://cdn.foodphoto.ai/nobg/def456.png",
"format": "png",
"created_at": "2026-02-09T12:00:00Z"
}/api/upscaleAuth requiredUpscale a food photo to higher resolution (up to 4x).
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| image_url | string | Yes | Publicly accessible URL to the image |
| scale | number | No | Upscale factor: 2 or 4 (default: 2) |
Response (200 OK)
{
"id": "up_ghi012",
"status": "completed",
"credits_used": 1,
"result_url": "https://cdn.foodphoto.ai/upscaled/ghi012.jpg",
"original_size": { "width": 512, "height": 512 },
"upscaled_size": { "width": 2048, "height": 2048 },
"created_at": "2026-02-09T12:00:00Z"
}/api/modelsList all available AI models with their capabilities and credit costs.
Response (200 OK)
{
"models": [
{
"id": "flux-2-pro",
"name": "FLUX 2 Pro",
"credits_per_image": 1,
"max_resolution": "1024x1024",
"supports": ["generation"]
},
{
"id": "seeddream",
"name": "SeedDream Edit",
"credits_per_image": 1,
"max_resolution": "2048x2048",
"supports": ["generation", "enhancement"]
},
{
"id": "flux-2-max",
"name": "FLUX 2 Max",
"credits_per_image": 2,
"max_resolution": "2048x2048",
"supports": ["generation"]
}
]
}/api/account/creditsAuth requiredCheck your current credit balance, subscription plan, and usage.
Response (200 OK)
{
"credits": 47,
"subscription_plan": "growth",
"subscription_status": "active",
"credits_used_this_month": 53,
"next_renewal": "2026-03-01T00:00:00Z"
}Rate Limits
| Tier | Requests / minute | Requests / day |
|---|---|---|
| Starter | 60 | 1,000 |
| Growth | 60 | 1,000 |
| Pro | 60 | 1,000 |
| Enterprise | Custom | Custom |
Rate limit headers
Every response includes X-RateLimit-Remaining and X-RateLimit-Reset headers.
API Pricing
Pay per image with credits. Plans start at $3 for 20 credits ($0.25/image). Higher plans offer lower per-image costs.
| Operation | Credits | Approx. Cost |
|---|---|---|
| FLUX 2 Pro | 1 credit | $0.05 |
| SeedDream Edit | 1 credit | $0.05 |
| FLUX 2 Max | 2 credits | $0.10 |
| Background Removal | 1 credit | $0.05 |
| Upscale (2x) | 1 credit | $0.05 |
| Upscale (4x) | 2 credits | $0.10 |
Error Codes
Bad Request
Invalid request parameters or malformed image URL.
Unauthorized
Missing or invalid API key in Authorization header.
Payment Required
Insufficient credits. Purchase more credits or upgrade your plan.
Too Many Requests
Rate limit exceeded. Wait and retry after the Retry-After header value.
Internal Server Error
Something went wrong on our end. Contact support if it persists.
Example Error Response
{
"error": {
"code": "insufficient_credits",
"message": "You don't have enough credits to complete this request.",
"required_credits": 1,
"available_credits": 0,
"upgrade_url": "https://foodphoto.ai/dashboard/billing"
}
}Startup Program
Building something cool with food photos? Apply for 1,000 free API credits to get started. Perfect for restaurant tech startups, menu builders, and food delivery platforms.
Ready to start building?
Get your API key and start generating food photos in minutes.
Questions? [email protected]