# Add Item v2.0Beta

The Add Item endpoint adds an item to a cart. Values supplied will be validated against a set of basic validation rules and added to the cart. The item will reflect immediately in the cart.

# Request

POST /v2.0/customers/{profileKey}/carts/{cartId}/items

# Authorization

An OAuth 2.0 Bearer token with the Cart.Write scope is required. For more information, see Authentication.

# Path Parameters

A list of the supported path parameters is described below.

Name Required Type Description
profileKey true guid The profile key for the customer.
cartId true guid The cart id for the cart.

# Request Body

The request body must be a JSON representation of an AddCartItem object which is described below.

# AddCartItem

Name Required Type Description
menuKey true string(20) The key for the menu that item is from.
menuVersion true int The menu version for the menu that item is from.
menuItemKey true int64 The key for the menu item.
displayName true string(100) The display name of the item.
currency true string(3) The ISO 4217 currency code for the currency applicable for the item.
price true double The item price excluding the price of any selected options. This is the price of the item on the menu.
quantity true int The quantity of the item and its selected options to order.
options false CartItemOption[] The options the customer selected for the item.
specialInstructions false string(300) Instructions to be submitted for the item. Special instructions print in the kitchen at the restaurant.

# CartItemOption

Name Required Type Description
optionSetKey true int64 The option set that the option set item is from.
optionSetItemKey true int64 The key for the option.
displayName true string(100) The display name of the selected option.
currency true string(3) The ISO 4217 currency code for the currency applicable for the option.
price true double The price of the selected option.

# Sample

{
    "menuKey": "ROCO-ZA-3",
    "menuVersion": 202107,
    "menuItemKey": 811000176,
    "displayName": "Classic Cheese Burger",
    "currency": "ZAR",
    "price": 69.00,
    "options": [
        {
            "optionSetKey": 861000001,
            "optionSetItemKey": 811000011,
            "displayName": "Beef",
            "currency": "ZAR",
            "price": 0.00
        },
        {
            "optionSetKey": 861000035,
            "optionSetItemKey": 811000205,
            "displayName": "Bacon",
            "currency": "ZAR",
            "price": 19.00
        }
    ],
    "quantity": 1,
    "specialInstructions": null
}

# Response

200
OK
Returns an ApiResponse envelope.

# Response Body

The endpoint returns our ApiResponse envelope. The data property of the response will contain a cartId.

Name Required Type Description
itemId true guid The unique identifier for the item in the cart.

# Sample

{
    "message": "The operation succeeded!",
    "notifications": [
        {
            "severity": "Success",
            "text": "The item was added.",
            "code": null,
            "additionalData": null
        }
    ],
    "data": {
        "itemId": "672fb54a-db33-4549-b55e-90963b721e23"
    }
}

# Errors

The standard error responses apply.

400
Bad Request
When the request fails validation.
401
Unauthorized
When authentication fails.
403
Forbidden
When authorisation fails.
404
Not Found
When the cart cannot be found.