Create Stock Item

Creates a new stock item.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

A stock item is a package unit that defines the formats in which an ingredient can be stored or ordered in. It can also describe the same for a recipe, in the case of stockable recipes.

Stock items for stockable recipes

Either main_ingredient_id or stockable_recipe must be given, but not both.

When stockable_recipe is given, you are defining a package for a stockable recipe. The recipe referenced in this field must be stockable.

Defining stock items as units of other stock items

In the PackageDescription object in this endpoint, one of base_unit or unit_stock_item must be given, but not both. When unit_stock_item is given, you are defining this stock item as a multiple of another stock item.

Stock items can be defined in base units (for example g, ml, cl...) but also as units of other stock items. Imagine a Cola that can be purchased as a can (33cl) but also as a pack of 6 cans (therefore 6 units of the base 33cl package).

For clarity, check the examples.

How the name is built

name is optional, and it is not returned as sent. It is treated as a qualifier: it is stored on the package description and returned as package_description.type. The name in the response is composed as <main_ingredient_name> <qualifier> (<content>).

For example, sending name: "Can" for an ingredient called Cola with a content of 200 ml returns name: "Cola Can (200 ml)" and package_description.type: "Can".

If no name is given, the composed name is <main_ingredient_name> (<content>).

Returnable packaging

returnable marks the package as a deposit-bearing container that goes back to the supplier, such as a crate, keg, CO2 cylinder or pallet. It is a marker only: nothing about ordering, counting or costing changes because a package is returnable.

GTIN validation

gtin and every entry of gtin_list must be numeric, 8, 12, 13 or 14 digits long, and carry a valid GS1 check digit. A random number of the right length is rejected.

gtin_list accepts several values. Duplicates are removed and the order you send is kept.

Body Params
string
string

An ingredient ID.

string

A recipe ID.

package_description
object
required
string

GTIN/EAN

boolean

Whether the stock item defines a "piece" of the ingredient. Only one stock item in an ingredient can be a piece.

boolean
boolean
boolean
Defaults to false

Whether the package is returnable packaging: a crate, keg, CO2 cylinder, pallet or similar container that carries a deposit and goes back to the supplier. A marker only, it does not change how the package is ordered, counted or costed.

boolean
gtin_list
array of strings

List of GTIN/EAN values.

gtin_list
Responses

400

Validation error. For example: neither main_ingredient_id nor stockable_recipe given, both given, neither base_unit nor unit_stock_item given, or an invalid GTIN.

404

The referenced ingredient, recipe or stock item was not found, or belongs to a different library.

Language
Credentials
OAuth2
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json