Recipe
The 'recipe' endpoint allows you to generate recipes based on provided criteria, including recipe statement, dietary preferences, servings, preparation time, and difficulty level, with the choice of receiving the response as JSON or as a readable stream.
Introduction
This API allows you to generate meal recipes based on specific criteria.
Authentication
To access these endpoints, you must include an Authorization
header with a valid API key.
Common Request Parameters
Both routes accept the following request parameters:
recipe
(string, required): A statement describing the desired recipe.diet
(string, optional): Dietary preference ['vegetarian','pescatarian','vegan','diaryfree','glutenfree','keto','paleo']. Default: No diet restrictions.servings
(number, optional): The number of servings for the recipe. Default: 1 Serving.preparationTime
(number, optional): The maximum preparation time in minutes. Default: No time restrictions.difficulty
(string, optional): The difficulty level of the recipe ['novice', 'intermediate', 'expert']. Default: No difficulty restrictions.measurement
(string, required): The measurement system used in the output ['imperial', 'metric']. Default: Metric.language
(string, optional): The language in which the recipe should be generated. Supported languages ['english', 'spanish', 'portuguese', 'french', 'italian', 'german', 'chinese', 'japanese', 'korean', 'hebrew']. Default: "english".allergies
(string, optional): A comma separated list of ingredients to exclude from the recipe.
JSON Route Details
Endpoint
POST /api/generate/recipe
Request Example
POST /api/generate/recipe
Headers:
{
"Authorization": "YOUR_API_KEY"
}
Body:
{
"recipe": "Beef Wellington",
"diet": "vegetarian",
"servings": 4,
"preparationTime": 30,
"difficulty": "intermediate"
}
Response (JSON)
- Status Code: 200 (OK)
- Content-Type: application/json
{
"recipeName": "Delicious Tomato Basil Pasta",
"difficulty": "intermediate",
"kitchenToolsUsed": ["Saucepan", "Knife", "Colander"],
"instructions": ["1. Boil pasta.", "2. Make tomato sauce.", "3. Mix pasta and sauce."],
"preparationTime": 30,
"servings": 4,
"recipeCategory": ["dinner"],
"recipeCuisine": ["italian"],
"ingredients": [
{ "name": "Pasta", "unit": "grams", "amount": 250 },
{ "name": "Tomatoes", "unit": "grams", "amount": 300 },
{ "name": "Basil", "unit": "grams", "amount": 10 }
],
"macros": {
"carbs": { "amount": 45, "unit": "grams" },
"fats": { "amount": 10, "unit": "grams" },
"proteins": { "amount": 8, "unit": "grams" },
"calories": { "amount": 280, "unit": "kcal" }
}
}
Execution Time
As responses are generated on the fly through AI, response time will vary depending on the lenght of the response. Approximate time for response is 10s for the 'recipe' endpoint.
Error Responses
Both routes return specific error responses for various scenarios:
- Missing API Key (Status Code: 403):
- Response:
No API Key in request
- Response:
- Invalid API Key (Status Code: 403):
- Response:
Invalid API Key
- Response:
- Missing Required Inputs (Status Code: 400):
- Response:
Required inputs not provided
- Response:
- Inactive Subscription (Status Code: 403):
- Response:
You don't have an active subscription
- Response: