
Edamam
Food & DrinkGet free access to a database with over 700,000 foods and 520K unique UPC codes. Analyze any food text and use our powerful food named entity extraction. Copy/paste any food recipe and learn its nutrition details in under a second. License over 40,000 full recipes and nutrition for over 2 million web recipes. Search over 2 million recipes by diets, calories and nutrient ranges. Personalized meal recommendations using 28 nutrients and 40 diets/allergies.
π Documentation & Examples
Everything you need to integrate with Edamam
π Quick Start Examples
// Edamam API Example
const response = await fetch('https://developer.edamam.com/', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);Utilizing the Edamam API with JavaScript
Are you someone who loves to cook and experiment with different recipes? Or perhaps you're a developer who's working on a project that requires information about food and nutrition. Either way, the Edamam API is a great resource to have at your disposal.
The Edamam API provides access to a vast database of food and nutrition information. You can use this API to get nutritional data, search for recipes, and more. In this post, we'll discuss how to use the Edamam API with JavaScript.
How to Get an Edamam API Key
Edamam splits its data into three separate products β the Recipe Search API, Nutrition Analysis API, and Food Database API β and each one needs its own credentials.
- Create a free account at developer.edamam.com.
- Open the Dashboard and choose Applications β Create a new application.
- Pick the API you want (e.g. Recipe Search API). Edamam issues a separate Application ID (
app_id) and Application Key (app_key) for that application. - Repeat for any other Edamam API you plan to call β keys are not shared across products.
Each API has a free developer tier for prototyping; heavier usage requires a paid plan (see the plan page in your dashboard). Note the old v1 /search endpoint is retired β Recipe Search now lives at https://api.edamam.com/api/recipes/v2 and also requires an Edamam-Account-User header set to your account name.
curl -H "Edamam-Account-User: YOUR_ACCOUNT" \
"https://api.edamam.com/api/recipes/v2?type=public&q=chicken&app_id=APP_ID&app_key=APP_KEY"
Example Code
To use the Edamam API with JavaScript, we'll need to make API requests using the fetch() method. Below are examples of how to use some of the Edamam API endpoints.
Recipe Search
const app_id = 'YOUR_APP_ID';
const app_key = 'YOUR_APP_KEY';
const recipe_name = 'chicken';
fetch(`https://api.edamam.com/search?q=${recipe_name}&app_id=${app_id}&app_key=${app_key}`)
.then(response => response.json())
.then(data => console.log(data.hits))
.catch(error => console.error(error));
In the above example, we're searching for recipes that contain the word "chicken". We're using the fetch() method to make a GET request to the following endpoint: https://api.edamam.com/search?q=${recipe_name}&app_id=${app_id}&app_key=${app_key}. This endpoint includes the search query, recipe_name, and the API key and ID. Finally, we're logging the response data to the console.
Nutritional Data
const app_id = 'YOUR_APP_ID';
const app_key = 'YOUR_APP_KEY';
const food = 'apple';
fetch(`https://api.edamam.com/api/food-database/v2/parser?nutrition-type=logging&app_id=${app_id}&app_key=${app_key}&ingr=${food}`)
.then(response => response.json())
.then(data => console.log(data.parsed[0].food.nutrients))
.catch(error => console.error(error));
Here, we're requesting the nutritional data for an apple. We're using the fetch() method to make a GET request to the following endpoint: https://api.edamam.com/api/food-database/v2/parser?nutrition-type=logging&app_id=${app_id}&app_key=${app_key}&ingr=${food}. This endpoint includes the API key and ID, and the food item we're searching for. Finally, we're logging the nutrient data for the food item to the console.
Conclusion
The Edamam API is a powerful tool that can be used to obtain food and nutrition information. With JavaScript, we can easily make requests to the Edamam API and retrieve data. By using the examples outlined in this post, you'll be well on your way to integrating the Edamam API into your own projects. Happy cooking!









