All posts
guide quickstart

Getting Started with FoodBase

Create your account, generate an API key, and make your first request in under 5 minutes.

updated July 24, 2026 FoodBase Team 2 min read

Create your account

Head to the signup page and create a free account. No credit card required — the free plan gives you 100 API requests per day, which is plenty for testing and prototyping.

Generate an API key

Once logged in, navigate to Dashboard > API Keys and click Create key. Give it a descriptive name like “My App” or “Development”. The full key is shown only once, so copy it and store it somewhere safe (like a .env file or a password manager).

Your key will look something like: food_KV23NskbwXkKzi1yaPdPF1

Make your first request

Search for a food product by name:

curl "https://foodbase.dev/v1/foods/search?q=banana&limit=3" \
  -H "X-API-Key: food_your_key_here"

The response includes matching products with names, brands, categories, and basic nutrition data:

{
  "data": [
    {
      "id": "abc-123",
      "name_default": "Banana",
      "brand": null,
      "category": "Fresh fruits",
      "nutriscore": "a"
    }
  ],
  "total": 26080,
  "limit": 3,
  "offset": 0
}

Look up by barcode

If you’re building a barcode scanner app, use the barcode endpoint with an EAN-13 or UPC code:

curl "https://foodbase.dev/v1/foods/barcode/5449000000996" \
  -H "X-API-Key: food_your_key_here"

This returns the full product details including a nutrition summary with calories, protein, carbs, fat, sugars, and fiber — all per 100g.

Get detailed nutrients

For the complete nutrient breakdown (40+ values organized by category), use the nutrients endpoint:

curl "https://foodbase.dev/v1/foods/{id}/nutrients" \
  -H "X-API-Key: food_your_key_here"

The response groups nutrients into categories:

  • Macros — energy (kcal/kJ), protein, carbs, fat, fiber, sugars, alcohol, starch
  • Fats — saturated, trans, mono/polyunsaturated, omega-3/6, cholesterol
  • Minerals — sodium, calcium, iron, potassium, magnesium, zinc, and more
  • Vitamins — A, C, D, E, B-complex (B1, B2, B6, B9, B12), niacin

Batch lookups

Need to fetch multiple products at once? Use the bulk endpoint with up to 100 IDs:

curl -X POST "https://foodbase.dev/v1/foods/bulk" \
  -H "X-API-Key: food_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"ids": ["id-1", "id-2", "id-3"]}'

Results are returned in the same order as the input IDs — no need to re-sort on your end.

Try the AI endpoints

Every plan — including Free — comes with a monthly allowance of AI credits (100 on Free). They power the vision and analysis endpoints: identify a product from a photo, read a nutrition label, analyze a meal, or generate a plain-language AI summary of any product. Each call has a fixed credit price stated in the docs, and every AI response carries X-Credits-Remaining headers.

The fastest way to see them in action is the photo playground — upload a photo right in the browser with your own key. Or call one directly:

curl -X POST "https://foodbase.dev/v1/analyze/product" \
  -H "X-API-Key: food_your_key_here" \
  -H "Content-Type: application/json" \
  -d '{"barcode": "3017620422003"}'

Rate limit headers

Every response includes rate limit headers so your app can monitor usage:

X-RateLimit-Daily-Limit: 100
X-RateLimit-Daily-Remaining: 97
X-RateLimit-Daily-Reset: 2026-04-14T23:59:59Z

Next steps

Build it with FoodBase

6.1M products, 40+ nutrients and AI food analysis — free to start, no credit card.