API

Introduction Authentication

METHODS

Ingredients Create a new ingredient Update an ingredient Retrieve an ingredient Retrieve all your ingredients Recipe Ingredients Create a new recipe ingredient Update a recipe ingredient Retrieve a recipe ingredient Retrieve all recipe ingredients Delete a recipe ingredient Recipe Create a new recipe Update a recipe Copy/Scale a recipe Create a full recipe (with ingredients) Retrieve a recipe Retrieve all your recipes Delete a recipe

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/recipes /v1/recipes/{RECIPE_ID} /v1/recipes/{RECIPE_ID}/scale /v1/recipes/shortcut /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="8ea3a5a23f6a216745943b67940ee3bb"'

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.

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.

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

sugar: decimal, greater than or equal to zero

Grams of sugar 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,
"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,
"sugar": 0.06,
"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.


Arguments


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

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.

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

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

Grams of 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

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[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[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,
"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,
"sugar": 25.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.

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

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

Grams of sugar 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[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,
"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,
"sugar": 25.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


none

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]

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)

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

total_grams: decimal

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

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",
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T02:37:16Z",
"name": "Butter, salted",
"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)
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",
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T02:37:16Z",
"name": "Butter, salted",
"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 and quantity, 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
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",
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T03:07:19Z",
"name": "Butter, salted",
"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",
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T03:07:19Z",
"name": "Butter, salted",
"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",
"ingredient_id": 77,
"recipe_id": 522,
"created_at": "2014-01-12T02:37:16Z",
"updated_at": "2014-01-12T03:07:19Z",
"name": "Butter, salted",
"total_grams": 500.0
}
},
{
"recipe_ingredient": {
"id": 1206,
"quantity": 1.0,
"unit": "1 cup",
"ingredient_id": 6034,
"recipe_id": 522,
"created_at": "2014-01-12T03:19:25Z",
"updated_at": "2014-01-12T03:19:25Z",
"name": "Sugars, brown",
"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.

recipe_yield: decimal, greater than or equal to zero

Weight, after processing/moisture loss of a recipe.

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 1.0

Number of packages yielded by a recipe. Used in conjunction with servings to determine "per serving" nutrition data for a 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 recipe_yield and number of servings and packages.

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.sugar_grams: decimal

Grams of sugar 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

EXAMPLE OBJECT
{
"recipe": {
"id": 522,
"name": "Curl Recipe 1",
"recipe_yield": 0.0,
"servings": 1.0,
"suggested_serving": null,
"packages": 1.0,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": 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,
"sugar_grams": 0.3,
"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
}
}
}

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
recipe_yield: optional, decimal, greater than or equal to zero, (default: 0.0)

Weight of a recipe after processing/moisture loss.

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 1.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.

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.


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,
"recipe_yield": 0.0,
"servings": 1.0,
"suggested_serving": null,
"packages": 1.0,
"embed_token": "ISLMEPJMHp-uAZ-25WzdgQ",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": null,
"created_at": "2014-01-12T17:44:29Z",
"updated_at": "2014-01-12T17:44:29Z",
"nutrition": "No ingredients in this recipe"
}
}

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
recipe_yield: optional, decimal, greater than or equal to zero

Weight of a recipe after processing/moisture loss. Passing "default" will automatically add the weights of individual ingredients - however, this will not account for moisture loss.

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 1.0

Number of packages yielded by a recipe. Used in conjunction with servings to determine "per serving" nutrition data for a 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.

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[recipe_yield]=default"

EXAMPLE RESPONSE
{
"recipe": {
"id": 522,
"name": "New Recipe Name",
"recipe_yield": 500.0,
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 2.0,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"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,
"sugar_grams": 0.15,
"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
}
}
}

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",
"recipe_yield": 2500.0,
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 10.0,
"embed_token": "rLfWxnse3byNMO5q_uJeeg",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"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,
"sugar_grams": 0.15,
"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
}
}
}

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
recipe_yield: optional, decimal, greater than or equal to zero, (default: 0.0)

Weight of a recipe after processing/moisture loss.

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 1.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.

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.


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[recipe_yield]=150"

EXAMPLE RESPONSE
{
"recipe": {
"id": 572,
"name": "Shortcut Recipe",
"recipe_yield": 150.0,
"servings": 1.0,
"suggested_serving": "1 piece",
"packages": 2.0,
"embed_token": "quv5VUMK2oth8nsFk4Z84g",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list":null,
"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,
"sugar_grams": 0.01656,
"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
}
}
}

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",
"recipe_yield": 500.0,
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 2.0,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"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,
"sugar_grams": 0.15,
"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
}
}
}

Retrieving all your recipes

Retrieves the details of all your recipes. The information is returned as an array of recipes.


Arguments


none

Returns

Returns an array of recipe objects

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

EXAMPLE RESPONSE
[{
"recipe": {
"id": 522,
"name": "New Recipe Name",
"recipe_yield": 500.0,
"servings": 1.0,
"suggested_serving": "1 tbsp",
"packages": 2.0,
"embed_token": "7pA3-YGX2dzZ3jzC2BOf5A",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": "Butter",
"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,
"sugar_grams": 0.15,
"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
}
}
},
{
"recipe": {
"id": 527,
"name": null,
"recipe_yield": 0.0,
"servings": 1.0,
"suggested_serving": null,
"packages": 1.0,
"embed_token": "ISLMEPJMHp-uAZ-25WzdgQ",
"packaging_cost": 0.0,
"labor_cost": 0.0,
"overhead_cost": 0.0,
"ingredient_list": null,
"created_at": "2014-01-12T17:44:29Z",
"updated_at": "2014-01-12T17:44:29Z",
"nutrition": "No ingredients in this recipe"
}
}]

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
}
}
Progress_large

Feedback, we LOVE it.