API


ReciPal API Documentation

The ReciPal API is organized around REST. Our API is designed to have predictable, resource-oriented URLs and to use HTTP status codes to indicate responses. We use built-in HTTP features, like HTTP authentication and HTTP verbs, which can be understood by off-the-shelf HTTP clients. JSON will be returned in all responses from the API, including errors.

Interacting with the API should be straightforward with standard HTTP libraries, but let us know if you'd be interested in writing a language-specific client library. We'd be happy to facilitate that process.

If you ever have any questions, concerns, or run into errors please don't hesitate to contact us at info@recipal.com.

API Endpoint

https://recipal.com/api/

Summary of Resource URL Patterns

/v1/ingredients /v1/ingredients/{INGREDIENT_ID} /v1/ingredients/{INGREDIENT_ID}/ingredient_costs /v1/ingredient_costs /v1/ingredient_costs/{INGREDIENT_ID} /v1/recipes /v1/recipes/shortcut /v1/recipes/{RECIPE_ID} /v1/recipes/{RECIPE_ID}/label /v1/recipes/{RECIPE_ID}/scale /v1/recipes/{RECIPE_ID}/create_subrecipe /v1/recipes/{RECIPE_ID}/recipe_ingredients /v1/recipes/{RECIPE_ID}/recipe_ingredients/{RECIPE_INGREDIENT_ID}

Authentication

You authenticate to the ReciPal API by providing your API key in the request header. You can manage your API key from your settings page. You are currently required to have a monthly subscription in order to use the API, as it doesn't make much sense to access the API with limited recipes.

All API requests must authenticate and must be made over HTTPS. Your API key carries many privileges, so be sure to keep it secret.

EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredients \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

curl uses the -H flag to pass header tokens

An example API key has been passed as the header token. Please fill in your own to test out any examples or contact us to receive one.

Limits

The API is limited to 175k (~1k/hr) requests per week, reset every Monday morning. If you are using more, consider caching, or contact us for a higher limit. You'll be notified when you have 10% of your limit left each week (view your status on your Account Settings page), and once you've hit your limit you'll receive a 401 failure response.

Some endpoints impose rate limits, which are documented individually below. Specific endpoints may restrict the number of parallel requests, or restrict the number of requests over a window of time.

Unless stated otherwise, exceeding these limits will return an HTTP 429 response. Requests which exceed the rate limit are still counted toward the account's weekly request limit.

Language Tags

Portions of the API respond with text attributes identified by IETF language tags. These allow object attributes to have text representations in multiple languages.

ReciPal language tags always include both the language code (like "en"), and the region subtag (such as "US".)

The following language tags are used by ReciPal:

  • "en-US" FDA English Labels
  • "en-CA" Canadian English Labels
  • "fr-CA" Canadian French Labels

Ingredients

To add an ingredient to the database, you create a new ingredient object. You can retrieve individual ingredients as long as they are public or created by you. You can list all of your ingredients and update your own ingredients as well. Ingredients are identified by a unique ID.

All ingredient nutrition data is stored per 100 grams.


The ingredient object


Attributes


id: integer, unique
name: string, unique (unless private ingredient)
public: boolean

An ingredient can be public (available to all users) or private (available only to the user who created it).

recipe_id: integer

Some ingredients are derived from recipes, in which case they are automatically associated with a recipe.

brand: string

Brand name of ingredient, if any. Primarily used for verifying ingredient data.

source: string

Data source of ingredient. Could be a url, supplier, or a particular recipe_id.

ingredient_list: string

Free-form text string representing the ingredient list as it contributes to a label.

usda_verified: boolean

Is the data based on the USDA supplied database. If true, indicates that the data is very reliable.

user_verified: boolean

If it's a user created ingredient, indicates if it has been verified by ReciPal staff.

description1: string

Unit of measure for this ingredient

weight1: decimal, greater than zero

Weight, in grams associated with description1

description2: string

Unit of measure for this ingredient

weight2: decimal, greater than zero

Weight, in grams associated with description2

... ...
description15: string

Unit of measure for this ingredient

weight15: decimal, greater than zero

Weight, in grams associated with description15

calories: decimal, greater than or equal to zero

Calories for this ingredient per 100 grams

protein: decimal, greater than or equal to zero

Grams of protein for this ingredient per 100 grams

fat: decimal, greater than or equal to zero

Grams of fat for this ingredient per 100 grams

fat_saturated: decimal, greater than or equal to zero

Grams of saturated fat for this ingredient per 100 grams

fat_trans: decimal, greater than or equal to zero

Grams of trans fat for this ingredient per 100 grams

cholesterol: decimal, greater than or equal to zero

Milligrams of cholesterol for this ingredient per 100 grams

carbohydrate: decimal, greater than or equal to zero

Grams of carbohydrate for this ingredient per 100 grams

fiber: decimal, greater than or equal to zero

Grams of fiber for this ingredient per 100 grams

uncounted_fiber: decimal, greater than or equal to zero

The new FDA (2016) rules don't count certain types of fiber (e.g. oat fiber, inulin, etc.). For the new FDA format this amount will be subtracted from the original fiber attribute to calculate the labeled fiber. Grams of non-applicable fiber for this ingredient per 100 grams.

sugar: decimal, greater than or equal to zero

Grams of sugar for this ingredient per 100 grams

added_sugar: decimal, greater than or equal to zero

Grams of added sugar for this ingredient per 100 grams

sugar_alcohol: decimal, greater than or equal to zero

Grams of sugar alcohol for this ingredient per 100 grams

sodium: decimal, greater than or equal to zero

Milligrams of sodium for this ingredient per 100 grams

calcium: decimal, greater than or equal to zero

Milligrams of calcium for this ingredient per 100 grams

iron: decimal, greater than or equal to zero

Milligrams of iron for this ingredient per 100 grams

vitamin_c: decimal, greater than or equal to zero

Milligrams of Vitamin C for this ingredient per 100 grams

vitamin_a_IU: decimal, greater than or equal to zero

IU (international units) of Vitamin A for this ingredient per 100 grams

potassium: decimal, greater than or equal to zero

Milligrams of potassium for this ingredient per 100 grams

fat_monounsaturated: decimal, greater than or equal to zero

Grams of monounsaturated fat for this ingredient per 100 grams

fat_polyunsaturated: decimal, greater than or equal to zero

Grams of polyunsaturated fat for this ingredient per 100 grams

magnesium: decimal, greater than or equal to zero

Milligrams of magnesium for this ingredient per 100 grams

phosphorus: decimal, greater than or equal to zero

Milligrams of phosphorus for this ingredient per 100 grams

zinc: decimal, greater than or equal to zero

Milligrams of zinc for this ingredient per 100 grams

copper: decimal, greater than or equal to zero

Milligrams of copper for this ingredient per 100 grams

manganese: decimal, greater than or equal to zero

Milligrams of manganese for this ingredient per 100 grams

selenium: decimal, greater than or equal to zero

Micrograms of selenium for this ingredient per 100 grams

thiamin: decimal, greater than or equal to zero

Milligrams of thiamin for this ingredient per 100 grams

riboflavin: decimal, greater than or equal to zero

Milligrams of riboflavin for this ingredient per 100 grams

niacin: decimal, greater than or equal to zero

Milligrams of niacin for this ingredient per 100 grams

pantothenic_acid: decimal, greater than or equal to zero

Milligrams of pantothenic acid for this ingredient per 100 grams

vitamin_b6: decimal, greater than or equal to zero

Milligrams of Vitamin B6 for this ingredient per 100 grams

folate: decimal, greater than or equal to zero

Micrograms of folate for this ingredient per 100 grams

vitamin_b12: decimal, greater than or equal to zero

Micrograms of Vitamin B12 for this ingredient per 100 grams

vitamin_e: decimal, greater than or equal to zero

Milligrams of Vitamin E for this ingredient per 100 grams

vitamin_d_IU: decimal, greater than or equal to zero

IU (international units) of Vitamin D for this ingredient per 100 grams

vitamin_k: decimal, greater than or equal to zero

Micrograms of Vitamin K for this ingredient per 100 grams

created_at datetime
updated_at datetime
EXAMPLE OBJECT
{
"ingredient": {
"id": 77,
"name": "Butter, salted",
"public": true,
"recipe_id": null,
"brand": null,
"source": null,
"usda_verified": true,
"user_verified": false,
"ingredient_list": "Butter (Cream, Salt)",
"weight1": 227.0,
"description1": "1 cup",
"calories": 717.0,
"protein": 0.85,
"fat": 81.11,
"fat_saturated": 51.368,
"fat_trans": 5.677999999999983,
"cholesterol": 215.0,
"carbohydrate": 0.06,
"fiber": 0.0,
"uncounted_fiber": null,
"sugar": 0.06,
"added_sugar": 0.06,
"sugar_alcohol": 0.0,
"sodium": 714.0,
"calcium": 24.0,
"iron": 0.02,
"vitamin_c": 0.0,
"vitamin_a_IU": 2499.0,
"potassium": 24.0,
"fat_monounsaturated": 21.021,
"fat_polyunsaturated": 3.043,
"magnesium": 2.0,
"phosphorus": 24.0,
"zinc": 0.09,
"copper": 0.0,
"manganese": 0.0,
"selenium": 1.0,
"thiamin": 0.005,
"riboflavin": 0.034,
"niacin": 0.042,
"pantothenic_acid": 0.11,
"vitamin_b6": 0.003,
"folate": 3.0,
"food_folate": 3.0,
"folic_acid": 0.0,
"folate_dietary_equivalents": 3.0,
"chlorine": 18.8,
"vitamin_b12": 0.17,
"retinol": 671.0,
"alpha_carotene": 0.0,
"beta_carotene": 158.0,
"beta_cryptoxanthin": 0.0,
"lycopene": 0.0,
"lutein_zeaxanthin": 0.0,
"vitamin_e": 2.32,
"vitamin_d_IU": 60.0,
"vitamin_k": 7.0,
"weight2": 14.2,
"description2": "1 tbsp",
"weight3": 5.0,
"description3": "1 pat (1\" sq, 1/3\" high)",
"weight4": 113.0,
"description4": "1 stick",
"weight5": 453.592,
"description5": "1 lb",
"weight6": 3632.0,
"description6": "1 gallon",
"weight7": 1.0,
"description7": "1 gram",
"weight8": 28.35,
"description8": "1 oz",
"weight9": null,
"description9": "",
"weight10": null,
"description10": "",
"weight11": null,
"description11": "",
"weight12": null,
"description12": "",
"weight13": null,
"description13": "",
"weight14": null,
"description14": "",
"weight15": null,
"description15": "",
"created_at": "2011-10-03T20:27:08Z",
"updated_at": "2013-11-15T05:02:36Z"
}
}

Creating a new ingredient

To add an ingredient to the database, you create a new ingredient object.

Ingredient data is passed based on your weight/description1, but stored based on 100 grams. In this example, data is passed for a weight of 20 grams (described as "1 cookie"). Data returned will thus be 100/20 grams = 5 times that passed. So 5 calories per 20 grams is returned as 25 calories.

Ingredients will automatically have weights added for the following units: gram, oz, lb, kg. If you add one weight for any of these volumes, the rest will automatically be created as well: teaspoon, tablespoon, fl oz, cup, pint, quart, gallon, ml, liter.


Arguments


name: required, string, unique (unless private ingredient)
public: optional, boolean, (default: false)

An ingredient can be public (available to all users) or private (available only to the user who created it).

brand: optional, string

Brand name of ingredient, if any. Primarily used for verifying ingredient data.

source: optional, string

Data source of ingredient. Could be a url, supplier, a particular recipe_id.

ingredient_list: optional, string

Free-form text string representing the ingredient list as it contributes to a label.

description1: required, string

Unit of measure for this ingredient

weight1: required, decimal, greater than zero

Weight, in grams associated with description1

description2: optional, string

Unit of measure for this ingredient

weight2: optional, decimal, greater than zero

Weight, in grams associated with description2

... ...
description15: optional, string

Unit of measure for this ingredient

weight15: optional, decimal, greater than zero

Weight, in grams associated with description15

calories: required, decimal, greater than or equal to zero

Calories for this ingredient per 100 grams

protein: required, decimal, greater than or equal to zero

Grams of protein for this ingredient per 100 grams

fat: required, decimal, greater than or equal to zero

Grams of fat for this ingredient per 100 grams

fat_saturated: required, decimal, greater than or equal to zero

Grams of saturated fat for this ingredient per 100 grams

fat_trans: required, decimal, greater than or equal to zero

Grams of trans fat for this ingredient per 100 grams

cholesterol: required, decimal, greater than or equal to zero

Milligrams of cholesterol for this ingredient per 100 grams

carbohydrate: required, decimal, greater than or equal to zero

Grams of carbohydrate for this ingredient per 100 grams

fiber: required, decimal, greater than or equal to zero

Grams of fiber for this ingredient per 100 grams

uncounted_fiber: optional, decimal, greater than or equal to zero (default: 0.0)

The new FDA (2016) rules don't count certain types of fiber (e.g. oat fiber, inulin, etc.). For the new FDA format this amount will be subtracted from the original fiber attribute to calculate the labeled fiber. Grams of non-applicable fiber for this ingredient per 100 grams.

sugar: required, decimal, greater than or equal to zero

Grams of sugar for this ingredient per 100 grams

added_sugar: required, decimal, greater than or equal to zero

Grams of added sugar for this ingredient per 100 grams

sodium: required, decimal, greater than or equal to zero

Milligrams of sodium for this ingredient per 100 grams

calcium: required, decimal, greater than or equal to zero

Milligrams of calcium for this ingredient per 100 grams

iron: required, decimal, greater than or equal to zero

Milligrams of iron for this ingredient per 100 grams

vitamin_c: required, decimal, greater than or equal to zero

Milligrams of Vitamin C for this ingredient per 100 grams

vitamin_a_IU: required, decimal, greater than or equal to zero

IU (international units) of Vitamin A for this ingredient per 100 grams

potassium: optional, decimal, greater than or equal to zero

Milligrams of potassium for this ingredient per 100 grams

sugar_alcohol: optional, decimal, greater than or equal to zero

Grams of sugar alcohol for this ingredient per 100 grams

fat_monounsaturated: optional, decimal, greater than or equal to zero

Grams of monounsaturated fat for this ingredient per 100 grams

fat_polyunsaturated: optional, decimal, greater than or equal to zero

Grams of polyunsaturated fat for this ingredient per 100 grams

magnesium: optional, decimal, greater than or equal to zero

Milligrams of magnesium for this ingredient per 100 grams

phosphorus: optional, decimal, greater than or equal to zero

Milligrams of phosphorus for this ingredient per 100 grams

zinc: optional, decimal, greater than or equal to zero

Milligrams of zinc for this ingredient per 100 grams

copper: optional, decimal, greater than or equal to zero

Milligrams of copper for this ingredient per 100 grams

manganese: optional, decimal, greater than or equal to zero

Milligrams of manganese for this ingredient per 100 grams

selenium: optional, decimal, greater than or equal to zero

Micrograms of selenium for this ingredient per 100 grams

thiamin: optional, decimal, greater than or equal to zero

Milligrams of thiamin for this ingredient per 100 grams

riboflavin: optional, decimal, greater than or equal to zero

Milligrams of riboflavin for this ingredient per 100 grams

niacin: optional, decimal, greater than or equal to zero

Milligrams of niacin for this ingredient per 100 grams

pantothenic_acid: optional, decimal, greater than or equal to zero

Milligrams of pantothenic acid for this ingredient per 100 grams

vitamin_b6: optional, decimal, greater than or equal to zero

Milligrams of Vitamin B6 for this ingredient per 100 grams

folate: optional, decimal, greater than or equal to zero

Micrograms of folate for this ingredient per 100 grams

vitamin_b12: optional, decimal, greater than or equal to zero

Micrograms of Vitamin B12 for this ingredient per 100 grams

vitamin_e: optional, decimal, greater than or equal to zero

Milligrams of Vitamin E for this ingredient per 100 grams

vitamin_d_IU: optional, decimal, greater than or equal to zero

IU (international units) of Vitamin D for this ingredient per 100 grams

vitamin_k: optional, decimal, greater than or equal to zero

Micrograms of Vitamin K for this ingredient per 100 grams


Returns

Returns an ingredient object if successfully created, and returns an error object with failed validations otherwise.

DEFINITION
POST https://recipal.com/api/v1/ingredients
EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredients \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "ingredient[name]=New Curl Ingredient" \
-d "ingredient[ingredient_list]='Curlies (Milk, Sugar)'" \
-d "ingredient[description1]=1 cookie" \
-d "ingredient[weight1]=20" \
-d "ingredient[fat]=5" \
-d "ingredient[calories]=5" \
-d "ingredient[protein]=5" \
-d "ingredient[fat_saturated]=5" \
-d "ingredient[fat_trans]=5" \
-d "ingredient[cholesterol]=5" \
-d "ingredient[sodium]=5" \
-d "ingredient[carbohydrate]=5" \
-d "ingredient[fiber]=5" \
-d "ingredient[sugar]=5" \
-d "ingredient[added_sugar]=5" \
-d "ingredient[vitamin_a_IU]=5" \
-d "ingredient[iron]=5" \
-d "ingredient[calcium]=5" \
-d "ingredient[vitamin_c]=5"

EXAMPLE RESPONSE
{
"ingredient": {
"id": 7594,
"name": "New Curl Ingredient",
"public": true,
"recipe_id": null,
"brand": null,
"source": null,
"usda_verified": false,
"user_verified": false,
"ingredient_list": "Curlies (Milk, Sugar)",
"weight1": 20.0,
"description1": "1 cookie",
"calories": 25.0,
"protein": 25.0,
"fat": 25.0,
"fat_saturated": 25.0,
"fat_trans": 25.0,
"cholesterol": 25.0,
"carbohydrate": 25.0,
"fiber": 25.0,
"uncounted_fiber": null,
"sugar": 25.0,
"added_sugar": 25.0,
"sugar_alcohol": 0.0,
"sodium": 25.0,
"calcium": 25.0,
"iron": 25.0,
"vitamin_c": 25.0,
"vitamin_a_IU": 25.0,
"potassium": null,
"fat_monounsaturated": null,
"fat_polyunsaturated": null,
"magnesium": null,
"phosphorus": null,
"zinc": null,
"copper": null,
"manganese": null,
"selenium": null,
"thiamin": null,
"riboflavin": null,
"niacin": null,
"pantothenic_acid": null,
"vitamin_b6": null,
"folate": null,
"food_folate": null,
"folic_acid": null,
"folate_dietary_equivalents": null,
"chlorine": null,
"vitamin_b12": null,
"retinol": null,
"alpha_carotene": null,
"beta_carotene": null,
"beta_cryptoxanthin": null,
"lycopene": null,
"lutein_zeaxanthin": null,
"vitamin_e": null,
"vitamin_d_IU": null,
"vitamin_k": null,
"weight2": 453.592,
"description2": "1 lb",
"weight3": 1.0,
"description3": "1 gram",
"weight4": 28.35,
"description4": "1 oz",
"weight5": null,
"description5": null,
"weight6": null,
"description6": null,
"weight7": null,
"description7": null,
"weight8": null,
"description8": null,
"weight9": null,
"description9": null,
"weight10": null,
"description10": null,
"weight11": null,
"description11": null,
"weight12": null,
"description12": null,
"weight13": null,
"description13": null,
"weight14": null,
"description14": null,
"weight15": null,
"description15": null,
"created_at": "2014-01-10T03:32:20Z",
"updated_at": "2014-01-10T03:32:20Z"
}
}

Updating an ingredient

To update an ingredient in the database, you pass data to an existing ingredient object. Any parameters not provided will be left unchanged. Note that you can only update ingredients that you previously created.


Arguments (same as for creating an ingredient, but no required parameters)


name: optional, string, unique (unless private ingredient)
public: optional, boolean

An ingredient can be public (available to all users) or private (available only to the user who created it).

brand: optional, string

Brand name of ingredient, if any. Primarily used for verifying ingredient data.

source: optional, string

Data source of ingredient. Could be a url, supplier, a particular recipe_id.

ingredient_list: optional, string

Free-form text string representing the ingredient list as it contributes to a label.

description1: optional, string

Unit of measure for this ingredient

weight1: optional, decimal, greater than zero

Weight, in grams associated with description1

description2: optional, string

Unit of measure for this ingredient

weight2: optional, decimal, greater than zero

Weight, in grams associated with description2

... ...
description15: optional, string

Unit of measure for this ingredient

weight15: optional, decimal, greater than zero

Weight, in grams associated with description15

calories: optional, decimal, greater than or equal to zero

Calories for this ingredient per 100 grams

protein: optional, decimal, greater than or equal to zero

Grams of protein for this ingredient per 100 grams

fat: optional, decimal, greater than or equal to zero

Grams of fat for this ingredient per 100 grams

fat_saturated: optional, decimal, greater than or equal to zero

Grams of saturated fat for this ingredient per 100 grams

fat_trans: optional, decimal, greater than or equal to zero

Grams of trans fat for this ingredient per 100 grams

cholesterol: optional, decimal, greater than or equal to zero

Milligrams of cholesterol for this ingredient per 100 grams

carbohydrate: optional, decimal, greater than or equal to zero

Grams of carbohydrate for this ingredient per 100 grams

fiber: optional, decimal, greater than or equal to zero

Grams of fiber for this ingredient per 100 grams

uncounted_fiber: optional, decimal, greater than or equal to zero

The new FDA (2016) rules don't count certain types of fiber (e.g. oat fiber, inulin, etc.). For the new FDA format this amount will be subtracted from the original fiber attribute to calculate the labeled fiber. Grams of non-applicable fiber for this ingredient per 100 grams.

sugar: optional, decimal, greater than or equal to zero

Grams of sugar for this ingredient per 100 grams

added_sugar: optional, decimal, greater than or equal to zero

Grams of added sugar for this ingredient per 100 grams

sugar_alcohol: optional, decimal, greater than or equal to zero

Grams of sugar alcohol for this ingredient per 100 grams

sodium: optional, decimal, greater than or equal to zero

Milligrams of sodium for this ingredient per 100 grams

calcium: optional, decimal, greater than or equal to zero

Milligrams of calcium for this ingredient per 100 grams

iron: optional, decimal, greater than or equal to zero

Milligrams of iron for this ingredient per 100 grams

vitamin_c: optional, decimal, greater than or equal to zero

Milligrams of Vitamin C for this ingredient per 100 grams

vitamin_a_IU: optional, decimal, greater than or equal to zero

IU (international units) of Vitamin A for this ingredient per 100 grams

potassium: optional, decimal, greater than or equal to zero

Milligrams of potassium for this ingredient per 100 grams

fat_monounsaturated: optional, decimal, greater than or equal to zero

Grams of monounsaturated fat for this ingredient per 100 grams

fat_polyunsaturated: optional, decimal, greater than or equal to zero

Grams of polyunsaturated fat for this ingredient per 100 grams

magnesium: optional, decimal, greater than or equal to zero

Milligrams of magnesium for this ingredient per 100 grams

phosphorus: optional, decimal, greater than or equal to zero

Milligrams of phosphorus for this ingredient per 100 grams

zinc: optional, decimal, greater than or equal to zero

Milligrams of zinc for this ingredient per 100 grams

copper: optional, decimal, greater than or equal to zero

Milligrams of copper for this ingredient per 100 grams

manganese: optional, decimal, greater than or equal to zero

Milligrams of manganese for this ingredient per 100 grams

selenium: optional, decimal, greater than or equal to zero

Micrograms of selenium for this ingredient per 100 grams

thiamin: optional, decimal, greater than or equal to zero

Milligrams of thiamin for this ingredient per 100 grams

riboflavin: optional, decimal, greater than or equal to zero

Milligrams of riboflavin for this ingredient per 100 grams

niacin: optional, decimal, greater than or equal to zero

Milligrams of niacin for this ingredient per 100 grams

pantothenic_acid: optional, decimal, greater than or equal to zero

Milligrams of pantothenic acid for this ingredient per 100 grams

vitamin_b6: optional, decimal, greater than or equal to zero

Milligrams of Vitamin B6 for this ingredient per 100 grams

folate: optional, decimal, greater than or equal to zero

Micrograms of folate for this ingredient per 100 grams

vitamin_b12: optional, decimal, greater than or equal to zero

Micrograms of Vitamin B12 for this ingredient per 100 grams

vitamin_e: optional, decimal, greater than or equal to zero

Milligrams of Vitamin E for this ingredient per 100 grams

vitamin_d_IU: optional, decimal, greater than or equal to zero

IU (international units) of Vitamin D for this ingredient per 100 grams

vitamin_k: optional, decimal, greater than or equal to zero

Micrograms of Vitamin K for this ingredient per 100 grams

DEFINITION
PUT https://recipal.com/api/v1/ingredients/{INGREDIENT_ID}
EXAMPLE REQUEST
curl -X PUT https://recipal.com/api/v1/ingredients/7594 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "ingredient[name]=Old Curl Ingredient" \
-d "ingredient[ingredient_list]=Curlies (Milk, Sugar)" \
-d "ingredient[public]=false"

EXAMPLE RESPONSE
{
"ingredient": {
"id": 7594,
"name": "Old Curl Ingredient",
"public": false,
"recipe_id": null,
"brand": null,
"source": null,
"usda_verified": false,
"user_verified": false,
"ingredient_list": "Curlies (Milk, Sugar)",
"weight1": 20.0,
"description1": "1 cookie",
"calories": 25.0,
"protein": 25.0,
"fat": 25.0,
"fat_saturated": 25.0,
"fat_trans": 25.0,
"cholesterol": 25.0,
"carbohydrate": 25.0,
"fiber": 25.0,
"uncounted_fiber": null,
"sugar": 25.0,
"added_sugar": 25.0,
"sugar_alcohol": 0.0,
"sodium": 25.0,
"calcium": 25.0,
"iron": 25.0,
"vitamin_c": 25.0,
"vitamin_a_IU": 25.0,
"potassium": null,
"fat_monounsaturated": null,
"fat_polyunsaturated": null,
"magnesium": null,
"phosphorus": null,
"zinc": null,
"copper": null,
"manganese": null,
"selenium": null,
"thiamin": null,
"riboflavin": null,
"niacin": null,
"pantothenic_acid": null,
"vitamin_b6": null,
"folate": null,
"food_folate": null,
"folic_acid": null,
"folate_dietary_equivalents": null,
"chlorine": null,
"vitamin_b12": null,
"retinol": null,
"alpha_carotene": null,
"beta_carotene": null,
"beta_cryptoxanthin": null,
"lycopene": null,
"lutein_zeaxanthin": null,
"vitamin_e": null,
"vitamin_d_IU": null,
"vitamin_k": null,
"weight2": 453.592,
"description2": "1 lb",
"weight3": 1.0,
"description3": "1 gram",
"weight4": 28.35,
"description4": "1 oz",
"weight5": null,
"description5": null,
"weight6": null,
"description6": null,
"weight7": null,
"description7": null,
"weight8": null,
"description8": null,
"weight9": null,
"description9": null,
"weight10": null,
"description10": null,
"weight11": null,
"description11": null,
"weight12": null,
"description12": null,
"weight13": null,
"description13": null,
"weight14": null,
"description14": null,
"weight15": null,
"description15": null,
"created_at": "2014-01-10T03:32:20Z",
"updated_at": "2014-01-10T03:32:20Z"
}
}

Retrieving an ingredient

Retrieves the details of an ingredient that has been previously created. Supply the unique ingredient ID and ReciPal will return the corresponding ingredient information. The same information is returned when creating or updating an ingredient.


Arguments


id: required

Returns

Returns an ingredient object if a valid ID was provided, and returns an error otherwise.

DEFINITION
GET https://recipal.com/api/v1/ingredients/{INGREDIENT_ID}
EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredients/7594 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
Same as creating an ingredient above. It's kind of a big object, so we're saving some room here :)

Retrieving all your custom ingredients

Retrieves the details of each ingredient that you have previously created. The information is returned as an array of ingredient objects.


Arguments


per_page: optional, integer, (default: 20)

The maximum of how many ingredient objects will be returned. This can range from 1 to 20. If the number of ingredients returned is less than the value passed, that is the last page of results.

page: optional, integer, (default: 1)

If you have more ingredients than you specify with the per_page argument, you can paginate through your ingredients with this argument.

sort_field: optional, string, (default: "updated_at")

You can sort ingredient results by a few ingredient fields: created_at, updated_at, and name.

sort_order: optional, string, (default: "desc")

You can sort ingredient results in either ascending ("asc") or descending ("desc") order.


Returns

Returns an aray of ingredient objects.

DEFINITION
GET https://recipal.com/api/v1/ingredients
EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredients \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
Array of ingredient objects (each object is the same as that returned from create or retrieve results). Again, apologies for brevity, we figure you get the point.

[ingredient, ingredient, ingredient, ... , ingredient]

Deleting an ingredient

Permanently deletes an ingredient.


Arguments


id: required

Returns

Returns an object with a deleted parameter on success. If the ingredient ID does not exist, this call returns an error.

DEFINITION
DELETE https://recipal.com/api/v1/ingredients/{INGREDIENT_ID}
EXAMPLE REQUEST
curl -X DELETE https://recipal.com/api/v1/ingredients/527 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"ingredient": {
"id": 527,
"deleted": true
}
}

Retrieve all costs for an ingredient

Retrieves the details for all costs for the specified ingredient.


Arguments


per_page: optional, integer, (default: 20)

The maximum of how many ingredient cost objects will be returned. This can range from 1 to 20. If the number of costs returned is less than the value passed, that is the last page of results.

page: optional, integer, (default: 1)

If you have more ingredient costs than you can specify with the per_page argument, you can paginate through them with this argument.


Returns

Returns an array of ingredient cost objects.

DEFINITION
GET https://recipal.com/api/v1/ingredients/{INGREDIENT_ID}/ingredient_costs
EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredients/527/ingredient_costs \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
Array of ingredient cost objects. Each object is the same as returned from creating or retrieving an individual cost.

[ingredient_cost, ingredient_cost, ... , ingredient_cost]

Recipe Ingredients

Recipe ingredient objects connect ingredients to recipes by specifying which ingredients are in a recipe and how much of each ingredient. The API allows you to create, update, and delete recipe ingredients. You can also retrieve individual recipe ingredients as well as all the recipe ingredients in a particular recipe.


The recipe ingredient object


Attributes


id: integer, unique
quantity: decimal

The amount of the unit chosen for the ingredient (e.g. if the unit is "1 oz" and quantity is 5, 5 ounces of this ingredient are in a recipe)

unit: string

Identifies which unit is being used to determine the amount of the ingredient (based on ingredient object description options)

waste: decimal

Percentage of ingredient that does not go into final product. Full amount used in costing, only non-waste amount in nutrition.

ingredient_id: integer

Ingredient that this recipe ingredient represents.

recipe_id: integer

Recipe that this recipe ingredient belongs to.

name: string

Name of the ingredient which this recipe_ingredient represents

display_text: object

Object where each key is a language tag , and each value is the ingredient name in that language.

display_as: text, obsolete

How the ingredient will be displayed in the ingredient list in FDA english formats.

Corresponds to the "en-US" key of the display object.

total_grams: decimal

Total weight, in grams, of this ingredient, based on the unit, quantity, and waste.

units_and_grams: object

Object where keys represents unit options (from ingredient descriptions), and values represent the weight in grams for that unit.

created_at: datetime
updated_at: datetime
EXAMPLE OBJECT
{
"recipe_ingredient": {
"id": 1204,
"quantity": 1.0,
"unit": "1 cup",
"waste": 0.0,
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T02:37:16Z",
"name": "Butter, salted",
"display_as": "Butter (Cream, Salt)",
"display_text": {
"en-US": "Butter (Cream, Salt)",
"en-CA": "Butter (Cream, Salt)",
"fr-CA": "Beurre (Crème, Sel)",
},
"total_grams": 227.0,
"units_and_grams": {
"1 cup": 227.0,
"1 tbsp": 14.2,
"1 pat (1\" sq, 1/3\" high)": 5.0,
"1 stick": 113.0,
"1 lb": 453.592,
"1 gallon": 3632.0,
"1 gram": 1.0,
"1 oz": 28.35
}
}
}

Creating a new recipe ingredient

To add an ingredient to a recipe, you create a new recipe ingredient object.


Arguments


ingredient_id: required, integer
unit: optional, string, (default: ingredient.description1)

Must be a unit from list of keys in units_and_grams object of recipe_ingredients object.

quantity: optional, decimal, greater than or equal to zero, (default: 1.0)
waste: optional, decimal, greater than or equal to zero, less than or equal to 100, (default: 0.0)
total_grams: optional, decimal

Instead of setting the unit and quantity, you can pass the weight in grams directly with this parameter. If passing total_grams along with unit/quantity, total_grams will override the other parameters.


Returns

Returns a recipe ingredient object successfully created, and returns an error otherwise.

DEFINITION
POST https://recipal.com/api/v1/recipes/{RECIPE_ID}/recipe_ingredients
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes/522/recipe_ingredients \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "recipe_ingredient[ingredient_id]=77"

EXAMPLE RESPONSE
{
"recipe_ingredient": {
"id": 1204,
"quantity": 1.0,
"unit": "1 cup",
"waste": 0.0,
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T02:37:16Z",
"name": "Butter, salted",
"display_as": "Butter (Cream, Salt)",
"display_text": {
"en-US": "Butter (Cream, Salt)",
"en-CA": "Butter (Cream, Salt)",
"fr-CA": "Beurre (Crème, Sel)",
},
"total_grams": 227.0,
"units_and_grams": {
"1 cup": 227.0,
"1 tbsp": 14.2,
"1 pat (1\" sq, 1/3\" high)": 5.0,
"1 stick": 113.0,
"1 lb": 453.592,
"1 gallon": 3632.0,
"1 gram": 1.0,
"1 oz": 28.35
}
}
}

Updating a recipe ingredient

To update a recipe ingredient, you pass data to an existing recipe ingredient object. Any parameters not provided will be left unchanged. Only the amount of a recipe ingredient can be updated - via a combination of unit, quantity, and waste, or directly through total_grams.


Arguments


unit: optional, string

Must be a unit from list of keys in units_and_grams object of recipe_ingredients object.

quantity: optional, decimal, greater than or equal to zero
waste: optional, decimal, greater than or equal to zero, less than or equal to 100
total_grams: optional, decimal

Instead of setting the unit and quantity, you can pass the weight in grams directly with this parameter. If passing total_grams along with unit/quantity, total_grams will override the other parameters.

DEFINITION
PUT https://recipal.com/api/v1/recipes/{RECIPE_ID}/recipe_ingredients/{RECIPE_INGREDIENT_ID}
EXAMPLE REQUEST
curl -X PUT https://recipal.com/api/v1/recipes/522/recipe_ingredients/1204 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "recipe_ingredient[total_grams]=500"

EXAMPLE RESPONSE
{
"recipe_ingredient": {
"id": 1204,
"quantity": 500.0,
"unit": "1 gram",
"waste": 0.0,
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T03:07:19Z",
"name": "Butter, salted",
"display_as": "Butter (Cream, Salt)",
"display_text": {
"en-US": "Butter (Cream, Salt)",
"en-CA": "Butter (Cream, Salt)",
"fr-CA": "Beurre (Crème, Sel)",
},
"total_grams": 500.0,
"units_and_grams": {
"1 cup": 227.0,
"1 tbsp": 14.2,
"1 pat (1\" sq, 1/3\" high)": 5.0,
"1 stick": 113.0,
"1 lb": 453.592,
"1 gallon": 3632.0,
"1 gram": 1.0,
"1 oz": 28.35
}
}
}

Retrieving a recipe ingredient

Retrieves the details of a recipe ingredient that has been previously created. Supply the unique recipe ingredient ID and ReciPal will return the corresponding recipe ingredient information. The same information is returned when creating or updating a recipe ingredient.


Arguments


id: required

Returns

Returns a recipe ingredient object if a valid ID was provided, and returns an error otherwise.

DEFINITION
GET https://recipal.com/api/v1/recipes/{RECIPE_ID}/recipe_ingredients/{RECIPE_INGREDIENT_ID}
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes/522/recipe_ingredients/1204 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"recipe_ingredient": {
"id": 1204,
"quantity": 500.0,
"unit": "1 gram",
"waste": 0.0,
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T03:07:19Z",
"name": "Butter, salted",
"display_as": "Butter (Cream, Salt)",
"display_text": {
"en-US": "Butter (Cream, Salt)",
"en-CA": "Butter (Cream, Salt)",
"fr-CA": "Beurre (Crème, Sel)",
},
"total_grams": 500.0,
"units_and_grams": {
"1 cup": 227.0,
"1 tbsp": 14.2,
"1 pat (1\" sq, 1/3\" high)": 5.0,
"1 stick": 113.0,
"1 lb": 453.592,
"1 gallon": 3632.0,
"1 gram": 1.0,
"1 oz": 28.35
}
}
}

Retrieving all recipe ingredients for a particular recipe

Retrieves the details of each recipe ingredient that belongs to a particular recipe. Supply the unique url and ReciPal will return the corresponding recipe ingredient information in an array. As this can be many recipe ingredients, the units_and_grams is not supplied for each recipe ingredient in the array.


Arguments


none

Returns

Returns an array of recipe ingredient objects if a valid ID was provided, and returns an error otherwise.

DEFINITION
GET https://recipal.com/api/v1/recipes/{RECIPE_ID}/recipe_ingredients
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes/522/recipe_ingredients \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"recipe": {
"id": 522,
"name": "Curl Recipe 1",
"recipe_ingredients": [
{
"recipe_ingredient": {
"id": 1204,
"quantity": 500.0,
"unit": "1 gram",
"waste": 0.0,
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T03:07:19Z",
"name": "Butter, salted",
"display_as": "Butter (Cream, Salt)",
"display_text": {
"en-US": "Butter (Cream, Salt)",
"en-CA": "Butter (Cream, Salt)",
"fr-CA": "Beurre (Crème, Sel)",
},
"total_grams": 500.0
}
},
{
"recipe_ingredient": {
"id": 1206,
"quantity": 1.0,
"unit": "1 cup",
"waste": 0.0,
"ingredient_id": 77,
"ingredient_id": 6034,
"recipe_id": 522,
"created_at": "2014-01-12T03:19:25Z",
"updated_at": "2014-01-12T03:19:25Z",
"name": "Sugars, brown",
"display_as": "Sugars, brown",
"display_text": {
"en-US": "Butter (Cream, Salt)",
"en-CA": "Butter (Cream, Salt)",
"fr-CA": "Beurre (Crème, Sel)",
},
"total_grams": 220.0
}
}
]
}
}

Deleting a recipe ingredient

Permanently deletes a recipe ingredient from a recipe. It cannot be undone, although you can add the same ingredient back to a recipe.


Arguments


id: required

Returns

Returns an object with a deleted parameter on success. If the recipe ingredient ID does not exist, this call returns an error.

DEFINITION
DELETE https://recipal.com/api/v1/recipes/{RECIPE_ID}/recipe_ingredients/{RECIPE_INGREDIENT_ID}
EXAMPLE REQUEST
curl -X DELETE https://recipal.com/api/v1/recipes/522/recipe_ingredients/1206 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"recipe_ingredient": {
"id": 1206,
"deleted": true
}
}

Recipes

Recipes contain recipe ingredients and higher level data about a recipe (e.g. name, recipe yield, # of servings, etc.). The API allows you to create, update, and delete recipes. You can also retrieve individual recipes as well as an array of all your recipes.


The recipe object


Attributes


id: integer, unique
name: string

Meta description of the recipe.

package_yield_quantity: decimal, greater than or equal to zero

Weight of each finished package. See units below.

package_yield_unit: string in ["grams", "ounces", "mL", "fluid ounces"]

Unit of measure for weight of each finished package. See actual weight above.

servings: decimal, greater than or equal to 1.0

Number of servings in a recipe. Used in conjunction with packages for calculating "per serving" nutrition data for a recipe.

suggested_serving: string

Suggested serving size. Used on nutrition label to denote the suggested serving size in common terms (e.g. "1 piece or 1 cup").

packages: decimal, greater than or equal to 0.0

Number of packages yielded by a recipe. Used in conjunction with servings to determine "per serving" nutrition data for a recipe.

allergens: JSON hash

JSON hash of allergens, with key being name of allergen and value being true if it is an allergen for that recipe.

embed_token: string, unique

Unique embed token for embedding this recipe's nutrition fact label on an external website. See any recipe's label page to see the full code snippet.

packaging_cost: decimal, greater than or equal to zero

For calculating recipe costs, packaging cost represents the cost per package of direct and secondary packaging.

labor_cost: decimal, greater than or equal to zero

For calculating recipe costs, labor cost represents the per batch cost of labor (setup, processing, cleaning, packaging).

overhead_cost: decimal, greater than or equal to zero

For calculating recipe costs, overhead cost represents the per batch cost of everything other than ingredients, labor and packaging - kitchen rental, electricity, equipment rental, etc.

ingredient_list: text

List of ingredients for the recipe.

created_at: datetime
updated_at: datetime
nutrition: object

Contains all nutrition data for this recipe on a per serving basis. If no recipe ingredients exist for the recipe, will return "No ingredients in this recipe". Nutrients that are optional may be returned as null if insufficient data is present for each ingredient in the recipe.

nutrition.serving_size: decimal

Serving size in grams, based on package_yield_quantity, package_yield_unit and number of servings per package.

nutrition.calories: decimal

Calories per serving

nutrition.calories_from_fat: decimal

Calories from fat per serving

nutrition.protein_grams: decimal

Grams of protein per serving

nutrition.fat_grams: decimal

Grams of fat per serving

nutrition.fat_saturated_grams: decimal

Grams of saturated fat per serving

nutrition.fat_trans_grams: decimal

Grams of trans fat per serving

nutrition.cholesterol_milligrams: decimal

Milligrams of cholesterol per serving

nutrition.carbohydrate_grams: decimal

Grams of carbohydrate per serving

nutrition.fiber_grams: decimal

Grams of fiber per serving

nutrition.new_fiber_grams: decimal

Grams of fiber per serving (according to new FDA fiber rules)

nutrition.sugar_grams: decimal

Grams of sugar per serving

nutrition.added_sugar_grams: decimal

Grams of added sugar per serving

nutrition.sugar_alcohol_grams: decimal

Grams of sugar alcohol per serving

nutrition.sodium_milligrams: decimal

Milligrams of sodium per serving

nutrition.calcium_milligrams: decimal

Milligrams of calcium per serving

nutrition.iron_milligrams: decimal

Milligrams of iron per serving

nutrition.vitamin_c_milligrams: decimal

Milligrams of Vitamin C per serving

nutrition.vitamin_a_IU: decimal

IU (international units) of Vitamin A per serving

nutrition.potassium_milligrams: decimal

Milligrams of potassium per serving

nutrition.fat_monounsaturated_grams: decimal

Grams of monounsaturated fat per serving

nutrition.fat_polyunsaturated_grams: decimal

Grams of polyunsaturated fat per serving

nutrition.magnesium_milligrams: decimal

Milligrams of magnesium per serving

nutrition.phosphorus_milligrams: decimal

Milligrams of phosphorus per serving

nutrition.zinc_milligrams: decimal

Milligrams of zinc per serving

nutrition.copper_milligrams: decimal

Milligrams of copper per serving

nutrition.manganese_milligrams: decimal

Milligrams of manganese per serving

nutrition.selenium_micrograms: decimal

Micrograms of selenium per serving

nutrition.thiamin_milligrams: decimal

Milligrams of thiamin per serving

nutrition.riboflavin_milligrams: decimal

Milligrams of riboflavin per serving

nutrition.niacin_milligrams: decimal

Milligrams of niacin per serving

nutrition.pantothenic_acid_milligrams: decimal

Milligrams of pantothenic acid per serving

nutrition.vitamin_b6_milligrams: decimal

Milligrams of Vitamin B6 per serving

nutrition.folate_micrograms: decimal

Micrograms of folate per serving

nutrition.vitamin_b12_micrograms: decimal

Micrograms of Vitamin B12 per serving

nutrition.vitamin_e_milligrams: decimal

Milligrams of Vitamin E per serving

nutrition.vitamin_d_IU: decimal

IU (international units) of Vitamin D per serving

nutrition.vitamin_k_micrograms: decimal

Micrograms of Vitamin K per serving

tags: string

Recipe tags (created via GUI), concatenated by commas if multiple. Empty string if no tags.

EXAMPLE OBJECT
{
"recipe": {
"id": 522,
"name": "Curl Recipe 1",
"package_yield_quantity": 0.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": null,
"packages": 1.0,
"allergens": {"Milk":"true"},
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": null,
"preparation": null,
"archived": false,
"expired": false,
"expires_at": null,
"created_at": "2014-01-04T02:13:32Z",
"updated_at": "2014-01-12T03:47:55Z",
"nutrition": {
"serving_size": 0.0,
"calories": 3585.0,
"calories_from_fat": 3649.95,
"fat_grams": 405.55,
"saturated_fat_grams": 256.84,
"trans_fat_grams": 28.389999999999915,
"cholesterol_milligrams": 1075.0,
"sodium_milligrams": 3570.0,
"carbohydrate_grams": 0.3,
"fiber_grams": 0.0,
"new_fiber_grams": 0.0,
"sugar_grams": 0.3,
"added_sugar_grams": 0.3,
"sugar_alcohol_grams": 0.0,
"protein_grams": 4.25,
"vitamin_a_IU": 12495.0,
"vitamin_c_milligrams": 0.0,
"calcium_milligrams": 120.0,
"iron_milligrams": 0.1,
"potassium_milligrams": 120.0,
"fat_polyunsaturated_grams": 15.215,
"fat_monounsaturated_grams": 105.105,
"magnesium_milligrams": 10.0,
"zinc_milligrams": 0.45,
"copper_milligrams": 0.0,
"manganese_milligrams": 0.0,
"selenium_micrograms": 5.0,
"thiamin_milligrams": 0.025,
"riboflavin_milligrams": 0.17,
"niacin_milligrams": 0.21,
"pantothenic_acid_milligrams": 0.55,
"vitamin_b6_milligrams": 0.015,
"folate_micrograms": 15.0,
"vitamin_b12_micrograms": 0.85,
"vitamin_e_milligrams": 11.6,
"vitamin_d_IU": 300.0,
"vitamin_k_micrograms": 35.0,
"phosphorus_milligrams": 120.0
},
"tags": "Vegan, Healthy"
}
}

Creating a new recipe

To create a recipe, you create a new recipe object. However, there will not be any nutritional data until you add a recipe ingredient.


Arguments


name: optional, string
package_yield_quantity: optional, decimal, greater than or equal to zero, (default: 0.0)

Net weight of each finished package. See units below.

package_yield_unit: optional, string, in ["grams", "ounces", "mL", "fluid ounces"], (default: "grams")

Unit of the net weight of each finished package, if not grams.

servings: optional, decimal, greater than or equal to 1.0, (default: 1.0)

Number of servings in a recipe. Used in conjunction with packages for calculating "per serving" nutrition data for a recipe.

suggested_serving: optional, string

Suggested serving size. Used on nutrition label to denote the suggested serving size in common terms (e.g. "1 piece or 1 cup")

packages: optional, decimal, greater than or equal to 0.0, (default: 1.0)

Number of packages yielded by a recipe. Used in conjunction with servings to determine "per serving" nutrition data for a recipe.

allergens: optional, JSON hash

Hash of allergens for this recipe.

packaging_cost: optional, decimal, greater than or equal to zero, (default: 0.0)

For calculating recipe costs, packaging cost represents the cost per package of direct and secondary packaging.

labor_cost: optional, decimal, greater than or equal to zero, (default: 0.0)

For calculating recipe costs, labor cost represents the per batch cost of labor (setup, processing, cleaning, packaging).

overhead_cost: optional, decimal, greater than or equal to zero, (default: 0.0)

For calculating recipe costs, overhead cost represents the per batch cost of everything other than ingredients, labor and packaging - kitchen rental, electricity, equipment rental, etc.

ingredient_list: optional, text

List of ingredients for the recipe.

sku: optional, string
preparation: optional, string

Preparation Instructions (for staff, cooks, and general recipe tracking)


Returns

Returns a recipe object if successfully created, otherwise returns an error.

DEFINITION
POST https://recipal.com/api/v1/recipes
EXAMPLE REQUEST
curl -X POST https://recipal.com/api/v1/recipes \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"recipe": {
"id": 527,
"name": null,
"package_yield_quantity": 0.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": null,
"packages": 1.0,
"allergens": null,
"embed_token": "ISLMEPJMHp-uAZ-25WzdgQ",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": null,
"sku": null,
"preparation": null,
"archived": false,
"created_at": "2014-01-12T17:44:29Z",
"updated_at": "2014-01-12T17:44:29Z",
"nutrition": "No ingredients in this recipe",
"tags": ""
}
}

Updating a recipe

To update a recipe, you pass data to an existing recipe object. Any parameters not passed will remain unchanged. There are helper parameters for automatically calculating recipe yield and the ingredient list.


Arguments


name: optional, string
package_yield_quantity: optional, decimal, greater than or equal to zero

Weight (see units below) of a single finished package of your recipe after processing. Passing "default" will automatically add the weights of individual ingredients - however, this will not account for moisture loss or other processing.

package_yield_unit: optional, string, in ["grams", "ounces", "mL", "fluid ounces"]

Unit of measure (see actual weight above) of a single finished package of your recipe after processing.

servings: optional, decimal, greater than or equal to 1.0

Number of servings in a recipe. Used in conjunction with packages for calculating "per serving" nutrition data for a recipe.

suggested_serving: optional, string

Suggested serving size. Used on nutrition label to denote the suggested serving size in common terms (e.g. "1 piece or 1 cup")

packages: optional, decimal, greater than or equal to 0.0

Number of packages yielded by a recipe. Used in conjunction with servings to determine "per serving" nutrition data for a recipe.

allergens: optional, JSON hash

Hash of allergens for this recipe.

packaging_cost: optional, decimal, greater than or equal to zero

For calculating recipe costs, packaging cost represents the cost per package of direct and secondary packaging.

labor_cost: optional, decimal, greater than or equal to zero

For calculating recipe costs, labor cost represents the per batch cost of labor (setup, processing, cleaning, packaging).

overhead_cost: optional, decimal, greater than or equal to zero

For calculating recipe costs, overhead cost represents the per batch cost of everything other than ingredients, labor and packaging - kitchen rental, electricity, equipment rental, etc.

ingredient_list: optional, text

List of ingredients for the recipe. Passing "default" will automatically update the ingredient list using the descending weight order of the current recipe ingredients.

sku: optional, string
preparation: optional, string

Preparation Instructions (for staff, cooks, and general recipe tracking)

DEFINITION
PUT https://recipal.com/api/v1/recipes/{RECIPE_ID}
EXAMPLE REQUEST
curl -X PUT https://recipal.com/api/v1/recipes/522 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "recipe[name]=New Recipe Name" \
-d "recipe[packages]=2" \
-d "recipe[suggested_serving]=1 tbsp" \
-d "recipe[ingredient_list]=Butter" \
-d "recipe[package_yield_quantity]=default"

EXAMPLE RESPONSE
{
"recipe": {
"id": 522,
"name": "New Recipe Name",
"package_yield_quantity": 250.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 2.0,
"allergens": null,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"sku": null,
"preparation": null,
"archived": false,
"created_at": "2014-01-04T02:13:32Z",
"updated_at": "2014-01-12T17:57:41Z",
"nutrition": {
"serving_size": 250.0,
"calories": 1792.5,
"calories_from_fat": 1824.975,
"fat_grams": 202.775,
"saturated_fat_grams": 128.42,
"trans_fat_grams": 14.1949999999999575,
"cholesterol_milligrams": 537.5,
"sodium_milligrams": 1785.0,
"carbohydrate_grams": 0.15,
"fiber_grams": 0.0,
"new_fiber_grams": 0.0,
"sugar_grams": 0.15,
"added_sugar_grams": 0.15,
"sugar_alcohol_grams": 0.0,
"protein_grams": 2.125,
"vitamin_a_IU": 6247.5,
"vitamin_c_milligrams": 0.0,
"calcium_milligrams": 60.0,
"iron_milligrams": 0.05,
"potassium_milligrams": 60.0,
"fat_polyunsaturated_grams": 7.6075,
"fat_monounsaturated_grams": 52.5525,
"magnesium_milligrams": 5.0,
"zinc_milligrams": 0.225,
"copper_milligrams": 0.0,
"manganese_milligrams": 0.0,
"selenium_micrograms": 2.5,
"thiamin_milligrams": 0.0125,
"riboflavin_milligrams": 0.085,
"niacin_milligrams": 0.105,
"pantothenic_acid_milligrams": 0.275,
"vitamin_b6_milligrams": 0.0075,
"folate_micrograms": 7.5,
"vitamin_b12_micrograms": 0.425,
"vitamin_e_milligrams": 5.8,
"vitamin_d_IU": 150.0,
"vitamin_k_micrograms": 17.5,
"phosphorus_milligrams": 60.0
},
"tags": ""
}
}

Copying and scaling a recipe

If you have an existing recipe that you want to copy or scale up, you can do that as well. Copying and scaling use the same endpoint - copying is just scaling by a factor of 1. Each recipe ingredient quantity will be scaled by the amount you specify (or default to 1), as will the recipe yield. To maintain per serving nutrition data between the original and new recipes, recipe packages are scaled up as well. Recipe cost data will carry over as well.


Arguments


name: optional, string

If you pass a name argument, your new recipe will take that name. If you don't pass a name argument and the original recipe already has a name, we'll give it the original name and append " (copy)" or "{scale_amount}x" to the new recipe's name, depending if it's merely copied or scaled.

scale_amount: optional, decimal, greater than or equal to zero, (default: 1.0)

The amount by which you'd like to scale the original recipe, defaulting to 1 if not passed as an argument. If scaling a recipe DOWN, you might get an error that the packages recipe attribute must be greater than or equal to 1. Recipe ingredients are scaled down, and to maintain per serving nutrition data, the packages recipe attribute is scaled down by the same amount, but can't become less than 1.


Returns

Returns the new recipe object if successfully created, otherwise returns an error. The new recipe object should return the same nutrition data as the original recipe.

DEFINITION
POST https://recipal.com/api/v1/recipes/{RECIPE_ID}/scale
EXAMPLE REQUEST
curl -X POST https://recipal.com/api/v1/recipes/522/scale \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "name=Scaled Recipe" \
-d "scale_amount=5"

EXAMPLE RESPONSE
{
"recipe": {
"id": 539,
"name": "Scaled Recipe",
"package_yield_quantity": 250.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 10.0,
"allergens": null,
"embed_token": "rLfWxnse3byNMO5q_uJeeg",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"preparation": null,
"archived": false,
"created_at": "2014-01-16T05:01:28Z",
"updated_at": "2014-01-16T05:01:28Z",
"nutrition": {
"serving_size": 250.0,
"calories": 1792.5,
"calories_from_fat": 1824.975,
"fat_grams": 202.775,
"saturated_fat_grams": 128.42,
"trans_fat_grams": 14.1949999999999575,
"cholesterol_milligrams": 537.5,
"sodium_milligrams": 1785.0,
"carbohydrate_grams": 0.15,
"fiber_grams": 0.0,
"new_fiber_grams": 0.0,
"sugar_grams": 0.15,
"added_sugar_grams": 0.15,
"sugar_alcohol_grams": 0.0,
"protein_grams": 2.125,
"vitamin_a_IU": 6247.5,
"vitamin_c_milligrams": 0.0,
"calcium_milligrams": 60.0,
"iron_milligrams": 0.05,
"potassium_milligrams": 60.0,
"fat_polyunsaturated_grams": 7.6075,
"fat_monounsaturated_grams": 52.5525,
"magnesium_milligrams": 5.0,
"zinc_milligrams": 0.225,
"copper_milligrams": 0.0,
"manganese_milligrams": 0.0,
"selenium_micrograms": 2.5,
"thiamin_milligrams": 0.0125,
"riboflavin_milligrams": 0.085,
"niacin_milligrams": 0.105,
"pantothenic_acid_milligrams": 0.275,
"vitamin_b6_milligrams": 0.0075,
"folate_micrograms": 7.5,
"vitamin_b12_micrograms": 0.425,
"vitamin_e_milligrams": 5.8,
"vitamin_d_IU": 150.0,
"vitamin_k_micrograms": 17.5,
"phosphorus_milligrams": 60.0
},
"tags": ""
}
}

Creating a full recipe with all ingredients in one shortcut method

To create a full recipe, you create a new recipe object and pass parameters for which ingredients and how much of each ingredient is needed (in grams), as well as standard recipe parameters (servings, packages, yield, etc.).

This way, you can avoid multiple API calls and create your recipe and add each recipe_ingredient with a single call.


Arguments


ingredient_ids: required, comma-separated string of integers

List of ingredient IDs that will be a part of this recipe

ingredient_weights: required, comma-separated string of decimals, greater than or equal to zero

List of weights, in grams, for each ingredient listed in ingredient_ids

name: optional, string
package_yield_quantity: optional, decimal, greater than or equal to zero, (default: 0.0)

Net weight of each finished package. See units below.

package_yield_unit: optional, string, in ["grams", "ounces", "mL", "fluid ounces"], (default: "grams")

Unit of the net weight of each finished package, if not grams.

servings: optional, decimal, greater than or equal to 1.0, (default: 1.0)

Number of servings in a recipe. Used in conjunction with packages for calculating "per serving" nutrition data for a recipe.

suggested_serving: optional, string

Suggested serving size. Used on nutrition label to denote the suggested serving size in common terms (e.g. "1 piece or 1 cup")

packages: optional, decimal, greater than or equal to 0.0, (default: 1.0)

Number of packages yielded by a recipe. Used in conjunction with servings to determine "per serving" nutrition data for a recipe.

allergens: optional, JSON hash

Hash of allergens for this recipe.

packaging_cost: optional, decimal, greater than or equal to zero, (default: 0.0)

For calculating recipe costs, packaging cost represents the cost per package of direct and secondary packaging.

labor_cost: optional, decimal, greater than or equal to zero, (default: 0.0)

For calculating recipe costs, labor cost represents the per batch cost of labor (setup, processing, cleaning, packaging).

overhead_cost: optional, decimal, greater than or equal to zero, (default: 0.0)

For calculating recipe costs, overhead cost represents the per batch cost of everything other than ingredients, labor and packaging - kitchen rental, electricity, equipment rental, etc.

ingredient_list: optional, text

List of ingredients for the recipe.

sku: optional, string
preparation: optional, string

Preparation Instructions (for staff, cooks, and general recipe tracking)


Returns

Returns a recipe object if successfully created, otherwise returns an error.

DEFINITION
POST https://recipal.com/api/v1/recipes/shortcut
EXAMPLE REQUEST
curl -X POST https://recipal.com/api/v1/recipes/shortcut \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "recipe[ingredient_ids]=77,2893" \
-d "recipe[ingredient_weights]=55.2,105" \
-d "recipe[name]=Shortcut Recipe" \
-d "recipe[packages]=2" \
-d "recipe[suggested_serving]=1 piece" \
-d "recipe[package_yield_quantity]=150"

EXAMPLE RESPONSE
{
"recipe": {
"id": 572,
"name": "Shortcut Recipe",
"package_yield_quantity": 150.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": "1 piece",
"packages": 2.0,
"allergens": null,
"embed_token": "quv5VUMK2oth8nsFk4Z84g",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list":null,
"sku": null,
"preparation": null,
"archived": false,
"created_at": "2014-01-29T03:36:53Z",
"updated_at": "2014-01-29T03:36:53Z",
"nutrition": {
"serving_size": 75.0,
"calories": 282.942,
"calories_from_fat": 203.74524,
"fat_grams": 22.63836,
"saturated_fat_grams": 14.208018,
"trans_fat_grams": 1.62540299999999530275,
"cholesterol_milligrams": 59.34,
"sodium_milligrams": 240.639,
"carbohydrate_grams": 16.22856,
"fiber_grams": 4.515,
"new_fiber_grams": 4.515,
"sugar_grams": 0.01656,
"added_sugar_grams": 0.01656,
"sugar_alcohol_grams": 0.0,
"protein_grams": 5.12235,
"vitamin_a_IU": 689.724,
"vitamin_c_milligrams": 0.3675,
"calcium_milligrams": 33.924,
"iron_milligrams": 1.42827,
"potassium_milligrams": 345.774,
"fat_polyunsaturated_grams": 0.984768,
"fat_monounsaturated_grams": 5.820171,
"magnesium_milligrams": 28.902,
"zinc_milligrams": 0.38709,
"copper_milligrams": 0.0462,
"manganese_milligrams": 0.258825,
"selenium_micrograms": 1.011,
"thiamin_milligrams": 0.14523,
"riboflavin_milligrams": 0.066084,
"niacin_milligrams": 0.343392,
"pantothenic_acid_milligrams": 0.16581,
"vitamin_b6_milligrams": 0.102678,
"folate_micrograms": 18.678,
"vitamin_b12_micrograms": 0.04692,
"vitamin_e_milligrams": 0.64032,
"vitamin_d_IU": 16.56,
"vitamin_k_micrograms": 1.932,
"phosphorus_milligrams": 59.124
},
"tags": ""
}
}

Retrieving a recipe

Retrieves the details of a recipe that has been previously created. Supply the unique recipe ID and ReciPal will return the corresponding recipe information. The same information is returned when creating or updating a recipe.


Arguments


id: required

Returns

Returns a recipe object if a valid ID was provided, and returns an error otherwise.

DEFINITION
GET https://recipal.com/api/v1/recipes/{RECIPE_ID}
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes/522 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"recipe": {
"id": 522,
"name": "New Recipe Name",
"package_yield_quantity": 250.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 2.0,
"allergens": null,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"preparation": null,
"archived": false,
"created_at": "2014-01-04T02:13:32Z",
"updated_at": "2014-01-12T17:57:41Z",
"nutrition": {
"serving_size": 250.0,
"calories": 1792.5,
"calories_from_fat": 1824.975,
"fat_grams": 202.775,
"saturated_fat_grams": 128.42,
"trans_fat_grams": 14.1949999999999575,
"cholesterol_milligrams": 537.5,
"sodium_milligrams": 1785.0,
"carbohydrate_grams": 0.15,
"fiber_grams": 0.0,
"new_fiber_grams": 0.0,
"sugar_grams": 0.15,
"added_sugar_grams": 0.15,
"sugar_alcohol_grams": 0.0,
"protein_grams": 2.125,
"vitamin_a_IU": 6247.5,
"vitamin_c_milligrams": 0.0,
"calcium_milligrams": 60.0,
"iron_milligrams": 0.05,
"potassium_milligrams": 60.0,
"fat_polyunsaturated_grams": 7.6075,
"fat_monounsaturated_grams": 52.5525,
"magnesium_milligrams": 5.0,
"zinc_milligrams": 0.225,
"copper_milligrams": 0.0,
"manganese_milligrams": 0.0,
"selenium_micrograms": 2.5,
"thiamin_milligrams": 0.0125,
"riboflavin_milligrams": 0.085,
"niacin_milligrams": 0.105,
"pantothenic_acid_milligrams": 0.275,
"vitamin_b6_milligrams": 0.0075,
"folate_micrograms": 7.5,
"vitamin_b12_micrograms": 0.425,
"vitamin_e_milligrams": 5.8,
"vitamin_d_IU": 150.0,
"vitamin_k_micrograms": 17.5,
"phosphorus_milligrams": 60.0
},
"tags": ""
}
}

Retrieving all recipes

Retrieves the details of recipes you've previously created. The information is returned as an array of recipes sorted as specified.


Arguments


per_page: optional, integer, (default: 5)

The maximum of how many recipe objects will be returned. This can range from 1 to 20. If the number of recipes returned is less than the value passed, that is the last page of results.

page: optional, integer, (default: 1)

If you have more recipes than you specify with the per_page argument, you can paginate through your recipes with this argument.

sort_field: optional, string, (default: "updated_at")

You can sort recipe results by a few recipe fields: created_at, updated_at, and name.

sort_order: optional, string, (default: "desc")

You can sort recipe results in either ascending ("asc") or descending ("desc") order.


Returns

Returns an array of recipe objects

DEFINITION
GET https://recipal.com/api/v1/recipes
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes?per_page=10 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
[{
"recipe": {
"id": 522,
"name": "New Recipe Name",
"package_yield_quantity": 250.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 2.0,
"allergens": null,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"preparation": null,
"archived": false,
"created_at": "2014-01-04T02:13:32Z",
"updated_at": "2014-01-12T17:57:41Z",
"nutrition": {
"serving_size": 250.0,
"calories": 1792.5,
"calories_from_fat": 1824.975,
"fat_grams": 202.775,
"saturated_fat_grams": 128.42,
"trans_fat_grams": 14.1949999999999575,
"cholesterol_milligrams": 537.5,
"sodium_milligrams": 1785.0,
"carbohydrate_grams": 0.15,
"fiber_grams": 0.0,
"new_fiber_grams": 0.0,
"sugar_grams": 0.15,
"added_sugar_grams": 0.15,
"sugar_alcohol_grams": 0.0,
"protein_grams": 2.125,
"vitamin_a_IU": 6247.5,
"vitamin_c_milligrams": 0.0,
"calcium_milligrams": 60.0,
"iron_milligrams": 0.05,
"potassium_milligrams": 60.0,
"fat_polyunsaturated_grams": 7.6075,
"fat_monounsaturated_grams": 52.5525,
"magnesium_milligrams": 5.0,
"zinc_milligrams": 0.225,
"copper_milligrams": 0.0,
"manganese_milligrams": 0.0,
"selenium_micrograms": 2.5,
"thiamin_milligrams": 0.0125,
"riboflavin_milligrams": 0.085,
"niacin_milligrams": 0.105,
"pantothenic_acid_milligrams": 0.275,
"vitamin_b6_milligrams": 0.0075,
"folate_micrograms": 7.5,
"vitamin_b12_micrograms": 0.425,
"vitamin_e_milligrams": 5.8,
"vitamin_d_IU": 150.0,
"vitamin_k_micrograms": 17.5,
"phosphorus_milligrams": 60.0
},
"tags": ""
}
},
{
"recipe": {
"id": 527,
"name": null,
"package_yield_quantity": 0.0,
"package_yield_unit": "grams",
"servings": 1.0,
"suggested_serving": null,
"packages": 1.0,
"allergens": null,
"embed_token": "ISLMEPJMHp-uAZ-25WzdgQ",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": null,
"preparation": null,
"archived": false,
"created_at": "2014-01-12T17:44:29Z",
"updated_at": "2014-01-12T17:44:29Z",
"nutrition": "No ingredients in this recipe",
"tags": ""
}
}]

Deleting a recipe

Permanently deletes a recipe.


Arguments


id: required

Returns

Returns an object with a deleted parameter on success. If the recipe ID does not exist, this call returns an error.

DEFINITION
DELETE https://recipal.com/api/v1/recipes/{RECIPE_ID}
EXAMPLE REQUEST
curl -X DELETE https://recipal.com/api/v1/recipes/527 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"recipe": {
"id": 527,
"name": null,
"deleted": true
}
}

Creating a subrecipe

Creates a subrecipe out of the recipe. What this does is turn a recipe into an ingredient based on the recipe [nutrition, costing, and ingredient list], allowing it to be used in other recipes.

Future updates to the underlying recipe will flow through to the ingredient as well. The name will be the same as the recipe name, or if no name exists, be the recipe ID.


Arguments


id: required

Returns

Returns the created ingredient object on success. If the recipe ID does not exist or the recipe is empty, this call returns an error.

DEFINITION
POST https://recipal.com/api/v1/recipes/{RECIPE_ID}/create_subrecipe
EXAMPLE REQUEST
curl -X POST https://recipal.com/api/v1/recipes/93289/create_subrecipe \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"ingredient": {
"id":35618,
"name":"Recipe 93289",
"public":false,
"recipe_id":93289,
"brand":null,
"source":"Ingredient created from recipe 93289",
"usda_verified":false,
"user_verified":false,
"weight1":227.0,
"description1":"Recipe yield",
"calories":717.0,
"protein":0.85,
"fat":81.11,
"fat_saturated":51.368,
"fat_trans":3.278,
"cholesterol":215.0,
"carbohydrate":0.06,
"fiber":0.0,
"uncounted_fiber":0.0,
"sugar":0.06,
"added_sugar":0.0,
"sugar_alcohol":0.0,
"sodium":643.0,
"calcium":24.0,
"iron":0.02,
"vitamin_c":0.0,
"vitamin_a_IU":2499.0,
"potassium":24.0,
"fat_monounsaturated":21.021,
"fat_polyunsaturated":3.043,
"magnesium":2.0,
"phosphorus":24.0,
"zinc":0.09,
"copper":0.0,
"manganese":0.0,
"selenium":1.0,
"thiamin":0.005,
"riboflavin":0.034,
"niacin":0.042,
"pantothenic_acid":0.11,
"vitamin_b6":0.003,
"folate":3.0,
"food_folate":3.0,
"folic_acid":0.0,
"folate_dietary_equivalents":3.0,
"chlorine":18.8,
"vitamin_b12":0.17,
"retinol":671.0,
"alpha_carotene":0.0,
"beta_carotene":158.0,
"beta_cryptoxanthin":0.0,
"lycopene":0.0,
"lutein_zeaxanthin":0.0,
"vitamin_e":2.32,
"vitamin_d_IU":60.0,
"vitamin_k":7.0,
"weight2":28.35,
"description2":"1 oz",
"weight3":453.592,
"description3":"1 lb",
"weight4":56.75,
"description4":"1 serving",
"weight5":227.0,
"description5":"1 package",
"weight6":1.0,
"description6":"1 gram",
"weight7":1000.0,
"description7":"1 kg",
"weight8":null,
"description8":null,
"weight9":null,
"description9":null,
"weight10":null,
"description10":null,
"weight11":null,
"description11":null,
"weight12":null,
"description12":null,
"weight13":null,
"description13":null,
"weight14":null,
"description14":null,
"weight15":null,
"description15":null,
"created_at":"2017-04-26T01:05:18Z",
"updated_at":"2017-04-26T01:05:18Z"
}
}

Downloading a Recipe's Label PDF

Generates and responds with a PDF rendering of the recipe's label. The response blocks until the label is generated, and may take several seconds to respond.

This endpoint is rate-limited. Each account is limited to 5 combined parallel requests between the label endpoints. If you exceed this limit, an HTTP 429 response will be returned.


Arguments


id: required
page_size: optional, string in ["auto", "letter", "legal", "A4"], (default "auto")

Determines the page size of the resulting PDF. The "auto" value crops the PDF to the label size.


Returns

A binary payload with a Content-Type of application/pdf.

DEFINITION
GET https://recipal.com/api/v1/recipes/{RECIPE_ID}/label.pdf
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes/93289/label.pdf \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

Downloading a Recipe's Label PNG

Generates and responds with a PNG rendering of the recipe's label. The response blocks until the label is generated, and may take several seconds to respond.

This endpoint is rate-limited. Each account is limited to 5 combined parallel requests between the label endpoints. If you exceed this limit, an HTTP 429 response will be returned.


Arguments


id: required
zoom: optional, float in (0.8 .. 6.0) (default: 3.0)

Determines the scaling of the returned image, where larger values lead to larger images with crisper text.


Returns

A binary payload with a Content-Type of image/png.

DEFINITION
GET https://recipal.com/api/v1/recipes/{RECIPE_ID}/label.png
EXAMPLE REQUEST
curl https://recipal.com/api/v1/recipes/93289/label.png \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

Ingredient Costs

Ingredient costs allow you track your costs over time. There is one 'active' cost for an ingredient at any specific date which is the cost with the closest 'effective_at' date that is earlier than that date.

Only one cost can exist per date.

You also cannot create/update/delete costs for a subrecipe. Those costs are managed automatically when their subrecipe ingredient costs are changed.

The API allows you to create, update, and delete costs. You can retrieve individual costs, all of your current costs, or all of the costs for a single ingredient.


The ingredient cost object


Attributes


id: integer, unique
effective_at: date

The first date this cost becomes active. Unique per ingredient.

quantity: decimal

The amount of the unit chosen for the ingredient cost

unit: string

Identifies which unit is being used to determine the cost

price: decimal

How much you pay per quantity * unit of this ingredient.

shipping: decimal

How much you pay in shipping costs per quantity * unit of this ingredient.

created_at datetime
updated_at datetime
EXAMPLE OBJECT
{
"ingredient_cost": {
"id": 4382,
"ingredient_id": 77,
"effective_at": "2019-02-12",
"quantity": 1.0,
"unit": "1 cup",
"price": 0.12,
"shipping": 0.0,
"created_at": "2021-01-12T02:37:16Z",
"updated_at": "2022-09-04T22:10:15Z",
}
}
}

Creating a new ingredient cost


Arguments


ingredient_id: required, integer
effective_at: required, date, unique to ingredient

The date this cost becomes active. Costs are active starting on their date until the day before the next costs' 'effective_at' date.

unit: required, string

Must be a unit from the ingredient used for this cost

quantity: optional, decimal, greater than or equal to zero, (default: 0.0)

How much of each unit corresponds to the price/shipping.

price: optional, decimal, greater than or equal to zero, (default: 0.0)

How much you pay per quantity * unit of this ingredient.

shipping: optional, decimal, greater than or equal to zero, (default: 0.0)

How much you pay in shipping costs per quantity * unit of this ingredient.


Returns

Returns an ingredient cost if successfully created, otherwise returns an error.

DEFINITION
POST https://recipal.com/api/v1/ingredient_costs
EXAMPLE REQUEST
curl -X POST https://recipal.com/api/v1/ingredient_costs \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "ingredient_cost[ingredient_id]=77" \
-d "ingredient_cost[effective_at]=2019-02-12" \
-d "ingredient_cost[unit]=1 cup" \
-d "ingredient_cost[quantity]=1.0" \
-d "ingredient_cost[price]=0.12" \
-d "ingredient_cost[shipping]=0.0" \

EXAMPLE RESPONSE
{
"ingredient_cost": {
"id": 4382,
"ingredient_id": 77,
"effective_at": "2019-02-12",
"quantity": 1.0,
"unit": "1 cup",
"price": 0.12,
"shipping": 0.0,
"created_at": "2021-01-12T02:37:16Z",
"updated_at": "2022-09-04T22:10:15Z",
}
}
}

Updating an ingredient cost

To update an ingredient cost in the database, pass data for an existing ingredient cost object. Any parameters not provided will be left unchanged.


Arguments


effective_at: optional, date, unique to ingredient

The date this cost becomes active. Costs are active starting on their date until the day before the next costs' 'effective_at' date.

unit: optional, string

Must be a unit from the ingredient used for this cost

quantity: optional, decimal, greater than or equal to zero, (default: 0.0)

How much of each unit corresponds to the price/shipping.

price: optional, decimal, greater than or equal to zero, (default: 0.0)

How much you pay per quantity * unit of this ingredient.

shipping: optional, decimal, greater than or equal to zero, (default: 0.0)

How much you pay in shipping costs per quantity * unit of this ingredient.


Returns

Returns the ingredient cost if successfully updated, otherwise returns an error.

DEFINITION
PUT https://recipal.com/api/v1/ingredient_costs/{INGREDIENT_COST_ID}
EXAMPLE REQUEST
curl -X PUT https://recipal.com/api/v1/ingredient_costs/3258 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106' \
-d "ingredient_cost[effective_at]=2019-02-12" \
-d "ingredient_cost[unit]=1 cup" \
-d "ingredient_cost[quantity]=1.0" \
-d "ingredient_cost[price]=0.12" \
-d "ingredient_cost[shipping]=0.0" \

EXAMPLE RESPONSE
{
"ingredient_cost": {
"id": 3258,
"ingredient_id": 77,
"effective_at": "2019-02-12",
"quantity": 1.0,
"unit": "1 cup",
"price": 0.12,
"shipping": 0.0,
"created_at": "2021-01-12T02:37:16Z",
"updated_at": "2022-09-04T22:10:15Z",
}
}
}

Retrieving an ingredient cost

Retrieves the details of an ingredient cost.


Arguments


id: required

Returns

Returns an ingredient cost object if a valid ID was provided. Returns an error otherwise.

DEFINITION
GET https://recipal.com/api/v1/ingredient_costs/{INGREDIENT_COST_ID}
EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredient_costs/3258 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"ingredient_cost": {
"id": 3258,
"ingredient_id": 77,
"effective_at": "2019-02-12",
"quantity": 1.0,
"unit": "1 cup",
"price": 0.12,
"shipping": 0.0,
"created_at": "2021-01-12T02:37:16Z",
"updated_at": "2022-09-04T22:10:15Z",
}
}
}

Retrieving all current ingredient costs.

Retrieves the details of the current/active ingredient cost for all ingredients.

This route only shows active costs, to view all costs, you can request an ingredient's costs


Arguments


per_page: optional, integer, (default: 20)

The maximum of how many ingredient cost objects will be returned. This can range from 1 to 20. If the number of costs returned is less than the value passed, that is the last page of results.

page: optional, integer, (default: 1)

If you have more ingredient costs than you can specify with the per_page argument, you can paginate through them with this argument.


Returns

Returns an array of ingredient cost objects.

DEFINITION
GET https://recipal.com/api/v1/ingredient_costs
EXAMPLE REQUEST
curl https://recipal.com/api/v1/ingredient_costs \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
Array of ingredient cost objects. Each object is the same as returned from creating or retrieving an individual cost.

[ingredient_cost, ingredient_cost, ... , ingredient_cost]

Deleting an ingredient cost

Permanently deletes an ingredient cost.

Cannot delete the first cost for an ingredient (the one with the effective date of "-4712-01-01").


Arguments


id: required

Returns

Returns an object with a deleted parameter on success. If the ingredient cost ID does not exist, this call returns an error.

DEFINITION
DELETE https://recipal.com/api/v1/ingredient_costs/{INGREDIENT_ID}
EXAMPLE REQUEST
curl -X DELETE https://recipal.com/api/v1/ingredient_costs/241 \
-H 'Authorization: Token token=c9f30c2fd3784e21462cb01eb6967106'

EXAMPLE RESPONSE
{
"ingredient_cost": {
"id": 241,
"deleted": true
}
}