Skip to content
FoodPhoto.ai
← Back to Developer Hub

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.

1

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 account
2

Authenticate

Include your API key in the Authorization header of every request.

Authorization: Bearer YOUR_API_KEY
3

Make your first request

Send a POST to /api/generate with your prompt and receive an AI-generated food photo.

Base URL

https://api.foodphoto.ai

All API requests must use HTTPS.

Authentication

Authorization: Bearer YOUR_API_KEY

Get your key from Dashboard → Settings

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.

POST/api/generateAuth required

Generate professional food photos from a text prompt using AI models.

Parameters

NameTypeRequiredDescription
promptstringYesText description of the food photo you want
stylestringNoLighting style: "natural", "moody", "bright", "overhead", "macro"
modelstringNoAI model: "flux-2-pro", "seeddream", "flux-2-max"
aspect_ratiostringNoAspect ratio: "1:1", "4:3", "16:9", "9:16"
countnumberNoNumber of images to generate (1-4, default: 1)

Response (200 OK)

JSON
{
  "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"
}
POST/api/enhanceAuth required

Enhance an uploaded food photo with AI - improve lighting, colors, and composition.

Parameters

NameTypeRequiredDescription
image_urlstringYesPublicly accessible URL to the image
presetstringNo"delivery-optimized", "social-media", "print-ready", "balanced"
optionsobjectNo{ "upscale": true, "remove_background": false }

Response (200 OK)

JSON
{
  "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"
}
POST/api/remove-backgroundAuth required

Remove the background from a food photo, returning a transparent PNG.

Parameters

NameTypeRequiredDescription
image_urlstringYesPublicly accessible URL to the image

Response (200 OK)

JSON
{
  "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"
}
POST/api/upscaleAuth required

Upscale a food photo to higher resolution (up to 4x).

Parameters

NameTypeRequiredDescription
image_urlstringYesPublicly accessible URL to the image
scalenumberNoUpscale factor: 2 or 4 (default: 2)

Response (200 OK)

JSON
{
  "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"
}
GET/api/models

List all available AI models with their capabilities and credit costs.

Response (200 OK)

JSON
{
  "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"]
    }
  ]
}
GET/api/account/creditsAuth required

Check your current credit balance, subscription plan, and usage.

Response (200 OK)

JSON
{
  "credits": 47,
  "subscription_plan": "growth",
  "subscription_status": "active",
  "credits_used_this_month": 53,
  "next_renewal": "2026-03-01T00:00:00Z"
}

Rate Limits

TierRequests / minuteRequests / day
Starter601,000
Growth601,000
Pro601,000
EnterpriseCustomCustom

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.

OperationCreditsApprox. Cost
FLUX 2 Pro1 credit$0.05
SeedDream Edit1 credit$0.05
FLUX 2 Max2 credits$0.10
Background Removal1 credit$0.05
Upscale (2x)1 credit$0.05
Upscale (4x)2 credits$0.10

Error Codes

400

Bad Request

Invalid request parameters or malformed image URL.

401

Unauthorized

Missing or invalid API key in Authorization header.

402

Payment Required

Insufficient credits. Purchase more credits or upgrade your plan.

429

Too Many Requests

Rate limit exceeded. Wait and retry after the Retry-After header value.

500

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]