Nutritionix

Nutritionix

Health

Worlds largest verified nutrition database. It lets you pull data of restaurants, packaged foods and common foods at one call. Lets you build apps where you need to validate name of food items, find quick results to autocomplete text box interfaces and parse requests like 30 minutes yoga to calculate the calories burnt.

Visit APIπŸ” Alternatives

πŸ“š Documentation & Examples

Everything you need to integrate with Nutritionix

πŸš€ Quick Start Examples

Nutritionix Javascript Examplejavascript
// Nutritionix API Example
const response = await fetch('https://developer.nutritionix.com/', {
    method: 'GET',
    headers: {
        'Content-Type': 'application/json'
    }
});

const data = await response.json();
console.log(data);

Introduction to Using the Public API Docs from Nutritionix

If you are interested in developing an application that uses nutrition information, the Nutritionix public API is a great resource. The API provides access to a large database of nutritional information for foods, brands, and restaurants.

In this tutorial, we will show you how to use the Nutritionix public API docs and provide example code in JavaScript to help you get started.

How to Get a Nutritionix API Key

Nutritionix (the Track API, v2) authenticates with an App ID and App Key sent as headers.

  1. Sign up for a free developer account at https://developer.nutritionix.com (or via nutritionix.com β†’ API).
  2. Create an application in your dashboard to generate an App ID and App Key.
  3. Send both on every request as the x-app-id and x-app-key headers. The current base URL is https://trackapi.nutritionix.com/v2/ β€” the old api.nutritionix.com/v1_1 host is deprecated.
const res = await fetch('https://trackapi.nutritionix.com/v2/search/instant?query=apple', {
  headers: { 'x-app-id': 'YOUR_APP_ID', 'x-app-key': 'YOUR_APP_KEY' }
});
const data = await res.json();

For natural-language nutrition data, POST to https://trackapi.nutritionix.com/v2/natural/nutrients with a JSON body like { "query": "1 cup rice" } and the same two headers.

Free tier: A free developer plan is available to get started; higher-volume and commercial use require a paid plan. Check current rate limits and pricing after signing up. Keep your App Key server-side β€” don't expose it in client code.

Step 2: Authentication

Before we can make any requests to the Nutritionix API, we need to authenticate ourselves using our API Key and Secret Key. In our example code, we will be using the axios library to make our requests.

const axios = require('axios');

const APP_ID = 'YOUR_APP_ID';
const APP_KEY = 'YOUR_APP_KEY';

axios.defaults.headers.common['x-app-id'] = APP_ID;
axios.defaults.headers.common['x-app-key'] = APP_KEY;

Step 3: Search for a Food Item

Now that we have authenticated ourselves, we can start making requests to the Nutritionix API to search for food items. In this example, we will search for a food item called "apple".

axios.get(`https://api.nutritionix.com/v1_1/search/apple?results=0%3A20&fields=item_name%2Citem_id%2Cbrand_name%2Cnf_calories%2Cnf_total_fat`, {
    headers: {
        'x-app-id': APP_ID,
        'x-app-key': APP_KEY,
    }
})
.then(response => {
    console.log(response.data.hits);
})
.catch(error => {
    console.log(error);
});

Step 4: Retrieve Nutrition Information for a Food Item

Now that we have found a food item, we can retrieve the nutrition information for that item. In this example, we will retrieve the nutrition information for a food item with an item id of "513fc9cb673c4fbc26004461".

axios.get(`https://api.nutritionix.com/v1_1/item?id=513fc9cb673c4fbc26004461`, {
    headers: {
        'x-app-id': APP_ID,
        'x-app-key': APP_KEY,
    }
})
.then(response => {
    console.log(response.data);
})
.catch(error => {
    console.log(error);
});

Conclusion

Using the Nutritionix public API is a great way to access nutrition information for a wide range of foods, brands, and restaurants. With the example code we have provided, you can get started with using the API in your own application. Remember to always use your own API Key and Secret Key, and to be mindful of any rate limits or usage restrictions that may apply.

Explore More

Best Nutritionix alternatives (2026)Best Health APIs

Related APIs in Health