Create an Item

POST /items

Create an Item without a Supplier or with a Supplier you added yourself. The optional supplier.id cannot refer to a YBM Connect Supplier; that request is rejected with 400 (INVALID). To add a product maintained by a YBM Connect Supplier, use POST /items/import instead. Creating Items requires Items:UPDATE_DETAILS permission.

Status codes

  • 200 on success
  • 400 on invalid request

Request properties

The request body must contain these properties:

  • category: The ID of the Product group
  • name: The name of the Item

It can also contain the following optional properties:

  • account_code: Optional string with the account code
  • external_id: Optional identifier from an external system
  • vessel: The vessel object:
    • size: Integer size of at least 1 in the specified unit
    • unit: One of "l", "dl", "cl", "ml", "kg", "g" or "quantity"
    • type: See vessel and bundle types
    • display_unit: Optional display unit: "kg", "l", "dl" or "cl".
  • supplier contains information about the supplier:
    • id: The id of the supplier.
    • reference: The supplier reference for this item.
    • comment: Account-specific supplier note.
  • bundles: The array of bundle objects:
    • type: See vessel and bundle types
    • size: Integer of at least 2: the number of vessels in the bundle, or the number of bundles on the pallet if type is "PX".
    • unit: Set to g, if the bundle is by weight
    • pallet_bundle: Only if type is "PX". Specifies the bundle on the pallet:
      • type: See vessel and bundle types.
      • size: The number of vessels in the bundle. This bundle must also appear in bundles.
  • price: The integer price in cents
  • container_price: Optional container deposit price in cents
  • price_per: One of "vessel", "l", "kg" or "100g"
  • order_by: Optional property set to "vessel" or "kg"
  • count_fractions: Optional value expressing how fractional counts will be represented. Can be one of "l", "dl", "cl", "ml", "kg", "g", "quantity", "quarters", "decimal", "none".
  • min_inventory: Optional minimum stock level, with integer count and an optional package unit.
  • custom_properties: Optional additional product details such as description and labels.

The category may be cat_UNASSIGNED. If you specify another Product group, it must exist in your account. order_by="kg" requires a 1 kg vessel; price_per and count_fractions must be compatible with the vessel unit.

If another active Item has the same supplier ID and supplier reference, the API rejects the request with 400 (ITEM_DUPLICATE_REFERENCE).

Response properties

The created Item, including its generated id. Optional fields may be absent, and price fields are only visible with the Items:READ_PRICE permission.

You can see all the Item properties on the GET /items/:id page under "Response properties".

Example request and response

Request body:

{
  "category": "cat_KaNDv51Gh0",
  "name": "Vodka",
  "vessel": {
    "size": 7,
    "unit": "dl",
    "type": "BO"
  },
  "price": 1275,
  "price_per": "l",
  "supplier": {
    "id": 1693919950079,
    "reference": "1100992"
  }
}

Response body:

{
  "id": "itm_80oz3W0dka",
  "category": "cat_KaNDv51Gh0",
  "name": "Vodka",
  "vessel": {
    "size": 7,
    "unit": "dl",
    "type": "BO"
  },
  "price": 1275,
  "price_per": "l",
  "supplier": {
    "id": 1693919950079,
    "reference": "1100992"
  }
}