apyhub
Back

Food Ingredient Information API

What it does

The ingredient API gives food apps one place to search ingredients, pull their nutrition, and find alternatives. Search by name with query, or use the autocomplete endpoint for type-ahead fields, then fetch full details by id. Ingredient Information returns calories, macros, glycemic index and a caloric breakdown for any amount and unit, plus aisle, estimated cost and possible units.

Eight endpoints cover the rest of the flow. Get Ingredient Substitutes returns alternatives by name or id, such as margarine or ghee for butter. Compute Ingredient Amount works backward from a nutrient target, for example how much of an ingredient gives 10 g of protein. Map Ingredients to Grocery Products turns a recipe's ingredient list and servings into matching products with UPC codes. The ingredient widget endpoint renders a recipe's ingredient list as a PNG in US or metric units. Search can filter by intolerances and by fat, carb and protein percentage, in English or German.

Use the ingredient API in meal planners and diet trackers that need nutrition per portion, recipe apps that suggest ingredient substitution for allergies or missing items, and grocery and delivery apps that turn a recipe into a shopping cart.

Parse free-text recipes into structured ingredients first with the Ingredient Parser API. For recipe discovery, use the Food Search API, and suggest a bottle for the finished dish with the Wine Pairing API.

▣ ENDPOINT 02 / 08
GET
Get Ingredient Information
https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/:id/information

QUICKSTART

GUIDE

Quickstart

Fetch ingredient information for a specific ingredient ID, with optional unit and amount query parameters.

curl -X GET "https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/:id/information?unit=grams&amount=150" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with fields such as id, name, original, originalName, amount, unit, unitShort, unitLong, possibleUnits, estimatedCost, consistency, aisle, image, and meta. It may also include a nested nutrition object with nutrients, properties, caloricBreakdown, and weightPerServing.

{
  "id": 12135,
  "original": "nuts",
  "originalName": "nuts",
  "name": "nuts",
  "amount": 150,
  "unit": "grams",
  "unitShort": "g",
  "unitLong": "grams",
  "possibleUnits": ["handful", "g", "ounce", "oz", "cup", "serving", "tablespoon"],
  "estimatedCost": {
    "value": 182.14,
    "unit": "cents"
  },
  "consistency": "solid",
  "shoppingListUnits": ["ounces", "pounds"],
  "aisle": "Nuts",
  "image": "nuts-mixed.jpg",
  "meta": [],
  "nutrition": {
    "nutrients": [
      {"name": "Calories", "amount": 891, "unit": "kcal", "percentOfDailyNeeds": 44.55},
      {"name": "Protein", "amount": 25.95, "unit": "g", "percentOfDailyNeeds": 51.9},
      {"name": "Carbohydrates", "amount": 38.03, "unit": "g", "percentOfDailyNeeds": 12.68},
      {"name": "Fat", "amount": 77.18, "unit": "g", "percentOfDailyNeeds": 118.73},
      {"name": "Fiber", "amount": 13.5, "unit": "g", "percentOfDailyNeeds": 54}
    ],
    "properties": [
      {"name": "Glycemic Index", "amount": 29.67, "unit": ""},
      {"name": "Glycemic Load", "amount": 7.28, "unit": ""},
      {"name": "Nutrition Score", "amount": 27.72, "unit": "%"}
    ],
    "flavonoids": [],
    "caloricBreakdown": {
      "percentProtein": 10.92,
      "percentFat": 73.08,
      "percentCarbs": 16
    },
    "weightPerServing": {
      "amount": 150,
      "unit": "g"
    }
  },
  "categoryPath": ["snack"]
}
TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Retrieves information for a specific ingredient by its id. You can optionally supply unit and amount query parameters to request the ingredient information in a particular quantity and unit.

Path Parameter(s)

AttributeTypeDescription
idIntegerThe ingredient identifier in the path.

Query Parameter(s)

AttributeTypeDescription
unitStringThe unit to use for the ingredient quantity.
amountNumberThe amount to use with unit.

Response

Returns a JSON object with ingredient details, including top-level fields

ParameterTypeDescription
idIntegerIngredient identifier.
metaString ArrayMetadata values associated with the ingredient.
nameStringIngredient name.
unitStringUnit used in the response.
aisleStringAisle name for the ingredient.
imageStringImage filename for the ingredient.
amountNumberAmount represented by the response.
originalStringOriginal ingredient text.
unitLongStringLong-form unit name.
nutritionObjectNutrition details object. Contains nutrients, properties, caloricBreakdown, and weightPerServing; see schema for nested fields.
unitShortStringShort-form unit name.
consistencyStringIngredient consistency.
categoryPathString ArrayCategory path values for the ingredient.
originalNameStringOriginal ingredient name.
estimatedCostObjectEstimated cost object with value and unit.
possibleUnitsString ArrayUnits supported for this ingredient.
shoppingListUnitsString ArrayUnits suitable for shopping lists.
▣ ENDPOINT 03 / 08
GET
Get Ingredient Substitutes by ID
https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/:id/substitutes

QUICKSTART

GUIDE

Quickstart

Fetch the substitutes for a food ingredient by ID.

curl -X GET "https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/:id/substitutes" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with ingredient and message string fields, plus a substitutes array of strings.

{
  "ingredient": "sugar",
  "substitutes": ["honey", "maple syrup"],
  "message": "Substitutes found"
}
TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Retrieves substitute ingredients for a specific ingredient ID. The response returns a JSON object containing the ingredient name, a list of substitute ingredient names, and a message.

Path Parameter(s)

AttributeTypeDescription
idIntegerIngredient identifier.

Response

Returns a JSON object with message as a string, ingredient as a string, and substitutes as a string array.

AttributeTypeDescription
messageStringA non-empty message string.
ingredientStringThe ingredient name.
substitutesString ArraySubstitute ingredient names.
▣ ENDPOINT 04 / 08
GET
Ingredients by ID Image
https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/recipes/:id/ingredientWidget.png

QUICKSTART

GUIDE

Quickstart

Fetch the recipe ingredient widget image for a recipe ID.

curl -X GET "https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/recipes/:id/ingredientWidget.png" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a binary image response (string with format: binary)

TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Returns the ingredient widget image for a recipe identified by its numeric id. You can optionally choose the measurement system used in the image with the measure query parameter.

Path Parameter(s)

AttributeTypeDescription
idIntegerThe recipe identifier.

Query Parameter(s)

AttributeTypeDescription
measureENUMMeasurement system for the image. Allowed values: us, metric.

Response

Returns a binary string response containing the generated ingredient widget image for the requested recipe.

▣ ENDPOINT 05 / 08
POST
Map Ingredients to Grocery Products
https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/map

QUICKSTART

GUIDE

Quickstart

Map a list of ingredients to product matches by sending the required ingredients and servings fields.

curl -X POST "https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/map" \
  -H "apy-token: $APY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "ingredients": ["tomato", "mozzarella"],
    "servings": 2
  }'

What you'll get back

Returns a JSON array of objects. Each item includes original, originalName, ingredientImage, meta (an array of strings), and products (an array of product objects with id, title, and upc).

[
  {
    "original": "tomato",
    "originalName": "Tomato",
    "ingredientImage": "https://example.com/tomato.png",
    "meta": ["fresh"],
    "products": [
      {
        "id": 123,
        "title": "Fresh Tomato",
        "upc": "012345678905"
      }
    ]
  }
]
TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.
body*
ingredients*

About this endpoint

What it does

Maps a list of ingredient names to grocery products. You send the ingredients and servings in the request body, and the endpoint returns an array of matched ingredient records with product suggestions.

Request Body

ParameterTypeDescription
ingredientsString ArrayIngredient names to map to grocery products.
servingsNumberNumber of servings used by the mapping operation.

Response

Returns a JSON array of objects. Each object includes original and originalName strings, an ingredientImage string, a meta string array, and a products object array; each product contains id as an integer plus title and upc strings. Success response shape: 200.

ParameterTypeDescription
originalStringOriginal ingredient value.
originalNameStringOriginal ingredient name.
ingredientImageStringImage reference for the ingredient.
metaString ArrayAssociated metadata strings.
productsObject ArrayMatched grocery products for the ingredient. Each item includes id, title, and upc.
products[].idIntegerProduct identifier.
products[].titleStringProduct title.
products[].upcStringProduct UPC.

Notes

The response is a unique array at both levels: the top-level result array is uniqueItems: true, and each products array is also uniqueItems: true.

▣ ENDPOINT 06 / 08
GET
Get Ingredient Substitutes
https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/substitutes

QUICKSTART

GUIDE

Quickstart

Look up ingredient substitutes by passing the ingredient name as a query parameter.

curl -X GET "https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/substitutes?ingredientName=butter" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with ingredient and message string fields, plus a substitutes array of strings.

{
  "ingredient": "butter",
  "substitutes": ["margarine", "ghee"],
  "message": "Substitutes found successfully"
}
TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Returns ingredient substitute information for a given ingredient name. You provide the ingredient name as a query parameter, and the response comes back as a JSON object containing the original ingredient, a list of substitutes, and a message.

Query Parameter(s)

AttributeTypeDescription
ingredientNameStringThe ingredient name to look up.

Response

Returns a JSON object with three required fields: message as a string, ingredient as a string, and substitutes as an array of strings. The success response is a JSON object with these top-level fields.

AttributeTypeDescription
messageStringA non-empty message string.
ingredientStringA non-empty string identifying the ingredient that was looked up.
substitutesString ArrayAn array of substitute ingredient names.
▣ ENDPOINT 07 / 08
GET
Compute Ingredient Amount
https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/:id/amount

QUICKSTART

GUIDE

Quickstart

Get the amount for a food ingredient by ID, using the required nutrient and target query parameters.

curl -X GET "https://api.eu.apyhub.com/skycraft/food-ingredient-information-api/food/ingredients/:id/amount?target=2&nutrient=protein" \
  -H "apy-token: $APY_TOKEN"

What you'll get back

Returns a JSON object with amount as a number and unit as a string.

{
  "amount": 0.7,
  "unit": "oz"
}
TRY ITLIVE · 20 ATOMS
Loading your default key…
The full key is used to call the gateway and stays in this tab — never sent to orbit or saved.

About this endpoint

What it does

Computes the amount of the ingredient identified by id for a requested nutrient and target, with an optional unit query parameter. The response returns the calculated amount together with the unit used.

Path Parameter(s)

AttributeTypeDescription
idIntegerThe ingredient identifier.

Query Parameter(s)

AttributeTypeDescription
unitStringThe unit to use for the calculation.
targetIntegerThe target value for the nutrient calculation.
nutrientStringThe nutrient to compute against.

Response

Returns a JSON object with amount as a number and unit as a string. These are the top-level fields in the success response.

AttributeTypeDescription
amountNumberThe computed amount.
unitStringThe unit used in the response.
▣ COMMON ERRORS

Errors any endpoint can return

400bad_request

Required parameter missing or malformed body.

401unauthorized

API key missing, revoked, or not authorized for this service.

429rate_limited

Your plan's per-second rate exceeded. Retry with exponential backoff.

503upstream_busy

Backend temporarily unavailable. Try again in a few seconds.