Add item to cart
curl --request POST \
--url https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"productId": "prod_margherita",
"quantity": 2,
"itemUnavailableAction": "remove_item",
"selections": [
{
"groupId": "mod_group_crust",
"selectedOptions": [
{
"optionId": "mod_option_thin",
"quantity": 1,
"children": [
{
"groupId": "<string>",
"selectedOptions": [
{
"optionId": "<string>",
"quantity": 123
}
]
}
]
}
]
}
],
"specialInstructions": "Extra crispy",
"categoryId": "cat_pizzas"
}
'import requests
url = "https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item"
payload = {
"productId": "prod_margherita",
"quantity": 2,
"itemUnavailableAction": "remove_item",
"selections": [
{
"groupId": "mod_group_crust",
"selectedOptions": [
{
"optionId": "mod_option_thin",
"quantity": 1,
"children": [
{
"groupId": "<string>",
"selectedOptions": [
{
"optionId": "<string>",
"quantity": 123
}
]
}
]
}
]
}
],
"specialInstructions": "Extra crispy",
"categoryId": "cat_pizzas"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
productId: 'prod_margherita',
quantity: 2,
itemUnavailableAction: 'remove_item',
selections: [
{
groupId: 'mod_group_crust',
selectedOptions: [
{
optionId: 'mod_option_thin',
quantity: 1,
children: [
{groupId: '<string>', selectedOptions: [{optionId: '<string>', quantity: 123}]}
]
}
]
}
],
specialInstructions: 'Extra crispy',
categoryId: 'cat_pizzas'
})
};
fetch('https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'productId' => 'prod_margherita',
'quantity' => 2,
'itemUnavailableAction' => 'remove_item',
'selections' => [
[
'groupId' => 'mod_group_crust',
'selectedOptions' => [
[
'optionId' => 'mod_option_thin',
'quantity' => 1,
'children' => [
[
'groupId' => '<string>',
'selectedOptions' => [
[
'optionId' => '<string>',
'quantity' => 123
]
]
]
]
]
]
]
],
'specialInstructions' => 'Extra crispy',
'categoryId' => 'cat_pizzas'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item"
payload := strings.NewReader("{\n \"productId\": \"prod_margherita\",\n \"quantity\": 2,\n \"itemUnavailableAction\": \"remove_item\",\n \"selections\": [\n {\n \"groupId\": \"mod_group_crust\",\n \"selectedOptions\": [\n {\n \"optionId\": \"mod_option_thin\",\n \"quantity\": 1,\n \"children\": [\n {\n \"groupId\": \"<string>\",\n \"selectedOptions\": [\n {\n \"optionId\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ]\n }\n ],\n \"specialInstructions\": \"Extra crispy\",\n \"categoryId\": \"cat_pizzas\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"prod_margherita\",\n \"quantity\": 2,\n \"itemUnavailableAction\": \"remove_item\",\n \"selections\": [\n {\n \"groupId\": \"mod_group_crust\",\n \"selectedOptions\": [\n {\n \"optionId\": \"mod_option_thin\",\n \"quantity\": 1,\n \"children\": [\n {\n \"groupId\": \"<string>\",\n \"selectedOptions\": [\n {\n \"optionId\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ]\n }\n ],\n \"specialInstructions\": \"Extra crispy\",\n \"categoryId\": \"cat_pizzas\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"prod_margherita\",\n \"quantity\": 2,\n \"itemUnavailableAction\": \"remove_item\",\n \"selections\": [\n {\n \"groupId\": \"mod_group_crust\",\n \"selectedOptions\": [\n {\n \"optionId\": \"mod_option_thin\",\n \"quantity\": 1,\n \"children\": [\n {\n \"groupId\": \"<string>\",\n \"selectedOptions\": [\n {\n \"optionId\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ]\n }\n ],\n \"specialInstructions\": \"Extra crispy\",\n \"categoryId\": \"cat_pizzas\"\n}"
response = http.request(request)
puts response.read_body{
"cartId": "cart_123",
"cart": {
"id": "cart_123",
"locationId": "loc_456def",
"status": "OPEN",
"lockedAt": null,
"discountCode": "SAVE10",
"currency": "usd",
"fulfilmentMethod": "pickup",
"statementDescriptor": "CRAVE*Downtown Pizza Co",
"pickupType": "ASAP",
"orderDate": "2024-11-12",
"orderTime": "18:30",
"totalQuantity": 3,
"subTotal": "3600",
"subTotalFormatted": "$36.00",
"discountTotal": "0.00",
"discountTotalFormatted": "$0.00",
"waiterTipTotal": "540",
"waiterTipTotalFormatted": "$5.40",
"taxTotal": "280",
"taxTotalFormatted": "$2.80",
"taxAndFeeTotal": "320",
"taxAndFeeTotalFormatted": "$3.20",
"serviceFeeTotal": "120",
"serviceFeeTotalFormatted": "$1.20",
"paymentProcessingFeeTotal": "40",
"paymentProcessingFeeTotalFormatted": "$0.40",
"applicationFeeTotal": "0.00",
"applicationFeeTotalFormatted": "$0.00",
"netSalesTotal": "3600",
"netSalesTotalFormatted": "$36.00",
"fulfillmentMethodFeeTotal": "0.00",
"fulfillmentMethodFeeTotalFormatted": "$0.00",
"orderTotalWithServiceFee": "4460",
"orderTotalWithServiceFeeFormatted": "$44.60",
"orderTotalWithServiceFeeAmount": 4460,
"orderTotal": "4040",
"orderTotalFormatted": "$40.40",
"enterpriseFeeTotal": "0.00",
"enterpriseFeeTotalFormatted": "$0.00",
"subTotalWithoutDiscount": "3600",
"subTotalWithoutDiscountFormatted": "$36.00",
"restaurantDisplayName": "Downtown Pizza Co",
"deliveryInfo": {
"addressString": "123 Market Street, San Francisco, CA 94105",
"addressData": {}
},
"tableServiceInfo": {
"tableNumber": "A5"
},
"roomServiceInfo": {
"lastName": "Smith",
"roomNumber": "1203"
},
"fees": {
"enterpriseFeeRate": "0.0000",
"enterpriseFeeFix": "0.00",
"serviceFeeRate": "0.0250",
"serviceFeeFix": "0.00",
"taxRate": "0.0775",
"tipRate": "0.0000",
"fulfillmentMethodFeeFix": "0.00",
"fulfillmentMethodFeeRate": "0.0000",
"paymentProcessingFeeRate": "0.0290",
"paymentProcessingFeeFix": "0.30"
},
"metadata": {},
"checkoutUrl": "<string>",
"fulfillmentIdentifier": null
}
}{
"success": false,
"message": "Invalid input parameters",
"code": "BAD_REQUEST",
"data": {}
}{
"success": false,
"message": "Unauthorized access",
"code": "UNAUTHORIZED"
}{
"success": false,
"message": "An unexpected error occurred",
"code": "GENERIC_ERROR"
}Carts
Add item to cart
Appends a product to the cart, merging with existing items when the configuration matches.
POST
/
locations
/
{locationId}
/
carts
/
{cartId}
/
cart-item
Add item to cart
curl --request POST \
--url https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item \
--header 'Content-Type: application/json' \
--header 'X-API-Key: <api-key>' \
--data '
{
"productId": "prod_margherita",
"quantity": 2,
"itemUnavailableAction": "remove_item",
"selections": [
{
"groupId": "mod_group_crust",
"selectedOptions": [
{
"optionId": "mod_option_thin",
"quantity": 1,
"children": [
{
"groupId": "<string>",
"selectedOptions": [
{
"optionId": "<string>",
"quantity": 123
}
]
}
]
}
]
}
],
"specialInstructions": "Extra crispy",
"categoryId": "cat_pizzas"
}
'import requests
url = "https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item"
payload = {
"productId": "prod_margherita",
"quantity": 2,
"itemUnavailableAction": "remove_item",
"selections": [
{
"groupId": "mod_group_crust",
"selectedOptions": [
{
"optionId": "mod_option_thin",
"quantity": 1,
"children": [
{
"groupId": "<string>",
"selectedOptions": [
{
"optionId": "<string>",
"quantity": 123
}
]
}
]
}
]
}
],
"specialInstructions": "Extra crispy",
"categoryId": "cat_pizzas"
}
headers = {
"X-API-Key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'X-API-Key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
productId: 'prod_margherita',
quantity: 2,
itemUnavailableAction: 'remove_item',
selections: [
{
groupId: 'mod_group_crust',
selectedOptions: [
{
optionId: 'mod_option_thin',
quantity: 1,
children: [
{groupId: '<string>', selectedOptions: [{optionId: '<string>', quantity: 123}]}
]
}
]
}
],
specialInstructions: 'Extra crispy',
categoryId: 'cat_pizzas'
})
};
fetch('https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'productId' => 'prod_margherita',
'quantity' => 2,
'itemUnavailableAction' => 'remove_item',
'selections' => [
[
'groupId' => 'mod_group_crust',
'selectedOptions' => [
[
'optionId' => 'mod_option_thin',
'quantity' => 1,
'children' => [
[
'groupId' => '<string>',
'selectedOptions' => [
[
'optionId' => '<string>',
'quantity' => 123
]
]
]
]
]
]
]
],
'specialInstructions' => 'Extra crispy',
'categoryId' => 'cat_pizzas'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-Key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item"
payload := strings.NewReader("{\n \"productId\": \"prod_margherita\",\n \"quantity\": 2,\n \"itemUnavailableAction\": \"remove_item\",\n \"selections\": [\n {\n \"groupId\": \"mod_group_crust\",\n \"selectedOptions\": [\n {\n \"optionId\": \"mod_option_thin\",\n \"quantity\": 1,\n \"children\": [\n {\n \"groupId\": \"<string>\",\n \"selectedOptions\": [\n {\n \"optionId\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ]\n }\n ],\n \"specialInstructions\": \"Extra crispy\",\n \"categoryId\": \"cat_pizzas\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-API-Key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item")
.header("X-API-Key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"productId\": \"prod_margherita\",\n \"quantity\": 2,\n \"itemUnavailableAction\": \"remove_item\",\n \"selections\": [\n {\n \"groupId\": \"mod_group_crust\",\n \"selectedOptions\": [\n {\n \"optionId\": \"mod_option_thin\",\n \"quantity\": 1,\n \"children\": [\n {\n \"groupId\": \"<string>\",\n \"selectedOptions\": [\n {\n \"optionId\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ]\n }\n ],\n \"specialInstructions\": \"Extra crispy\",\n \"categoryId\": \"cat_pizzas\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.craveup.com/api/v1/locations/{locationId}/carts/{cartId}/cart-item")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"productId\": \"prod_margherita\",\n \"quantity\": 2,\n \"itemUnavailableAction\": \"remove_item\",\n \"selections\": [\n {\n \"groupId\": \"mod_group_crust\",\n \"selectedOptions\": [\n {\n \"optionId\": \"mod_option_thin\",\n \"quantity\": 1,\n \"children\": [\n {\n \"groupId\": \"<string>\",\n \"selectedOptions\": [\n {\n \"optionId\": \"<string>\",\n \"quantity\": 123\n }\n ]\n }\n ]\n }\n ]\n }\n ],\n \"specialInstructions\": \"Extra crispy\",\n \"categoryId\": \"cat_pizzas\"\n}"
response = http.request(request)
puts response.read_body{
"cartId": "cart_123",
"cart": {
"id": "cart_123",
"locationId": "loc_456def",
"status": "OPEN",
"lockedAt": null,
"discountCode": "SAVE10",
"currency": "usd",
"fulfilmentMethod": "pickup",
"statementDescriptor": "CRAVE*Downtown Pizza Co",
"pickupType": "ASAP",
"orderDate": "2024-11-12",
"orderTime": "18:30",
"totalQuantity": 3,
"subTotal": "3600",
"subTotalFormatted": "$36.00",
"discountTotal": "0.00",
"discountTotalFormatted": "$0.00",
"waiterTipTotal": "540",
"waiterTipTotalFormatted": "$5.40",
"taxTotal": "280",
"taxTotalFormatted": "$2.80",
"taxAndFeeTotal": "320",
"taxAndFeeTotalFormatted": "$3.20",
"serviceFeeTotal": "120",
"serviceFeeTotalFormatted": "$1.20",
"paymentProcessingFeeTotal": "40",
"paymentProcessingFeeTotalFormatted": "$0.40",
"applicationFeeTotal": "0.00",
"applicationFeeTotalFormatted": "$0.00",
"netSalesTotal": "3600",
"netSalesTotalFormatted": "$36.00",
"fulfillmentMethodFeeTotal": "0.00",
"fulfillmentMethodFeeTotalFormatted": "$0.00",
"orderTotalWithServiceFee": "4460",
"orderTotalWithServiceFeeFormatted": "$44.60",
"orderTotalWithServiceFeeAmount": 4460,
"orderTotal": "4040",
"orderTotalFormatted": "$40.40",
"enterpriseFeeTotal": "0.00",
"enterpriseFeeTotalFormatted": "$0.00",
"subTotalWithoutDiscount": "3600",
"subTotalWithoutDiscountFormatted": "$36.00",
"restaurantDisplayName": "Downtown Pizza Co",
"deliveryInfo": {
"addressString": "123 Market Street, San Francisco, CA 94105",
"addressData": {}
},
"tableServiceInfo": {
"tableNumber": "A5"
},
"roomServiceInfo": {
"lastName": "Smith",
"roomNumber": "1203"
},
"fees": {
"enterpriseFeeRate": "0.0000",
"enterpriseFeeFix": "0.00",
"serviceFeeRate": "0.0250",
"serviceFeeFix": "0.00",
"taxRate": "0.0775",
"tipRate": "0.0000",
"fulfillmentMethodFeeFix": "0.00",
"fulfillmentMethodFeeRate": "0.0000",
"paymentProcessingFeeRate": "0.0290",
"paymentProcessingFeeFix": "0.30"
},
"metadata": {},
"checkoutUrl": "<string>",
"fulfillmentIdentifier": null
}
}{
"success": false,
"message": "Invalid input parameters",
"code": "BAD_REQUEST",
"data": {}
}{
"success": false,
"message": "Unauthorized access",
"code": "UNAUTHORIZED"
}{
"success": false,
"message": "An unexpected error occurred",
"code": "GENERIC_ERROR"
}Authorizations
API Key required to authenticate requests
Body
application/json
Example:
"prod_margherita"
Required range:
x >= 1Example:
2
Behavior when the item becomes unavailable.
Available options:
remove_item, cancel_entire_order Example:
"remove_item"
Selected modifier groups and options.
Show child attributes
Show child attributes
Example:
"Extra crispy"
Example:
"cat_pizzas"
⌘I