curl --request POST \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"serviceId": "srv_01kv60qg12e82acr78edfnjhvv",
"offeringId": "off_01kv60qge5eh59ap0gw0pqrrys",
"quantity": 2
}
'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items"
payload = {
"serviceId": "srv_01kv60qg12e82acr78edfnjhvv",
"offeringId": "off_01kv60qge5eh59ap0gw0pqrrys",
"quantity": 2
}
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({
serviceId: 'srv_01kv60qg12e82acr78edfnjhvv',
offeringId: 'off_01kv60qge5eh59ap0gw0pqrrys',
quantity: 2
})
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items', 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://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items",
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([
'serviceId' => 'srv_01kv60qg12e82acr78edfnjhvv',
'offeringId' => 'off_01kv60qge5eh59ap0gw0pqrrys',
'quantity' => 2
]),
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://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items"
payload := strings.NewReader("{\n \"serviceId\": \"srv_01kv60qg12e82acr78edfnjhvv\",\n \"offeringId\": \"off_01kv60qge5eh59ap0gw0pqrrys\",\n \"quantity\": 2\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://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"serviceId\": \"srv_01kv60qg12e82acr78edfnjhvv\",\n \"offeringId\": \"off_01kv60qge5eh59ap0gw0pqrrys\",\n \"quantity\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items")
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 \"serviceId\": \"srv_01kv60qg12e82acr78edfnjhvv\",\n \"offeringId\": \"off_01kv60qge5eh59ap0gw0pqrrys\",\n \"quantity\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"order": {
"projectId": "<string>",
"tenantId": "<string>",
"orderId": "<string>",
"clientId": "<string>",
"currency": "<string>",
"subtotal": {
"amount": 1,
"currency": "<string>"
},
"tax": {
"amount": 1,
"currency": "<string>"
},
"total": {
"amount": 1,
"currency": "<string>"
},
"amountPaid": {
"amount": 1,
"currency": "<string>"
},
"amountRefunded": {
"amount": 1,
"currency": "<string>"
},
"status": "DRAFT",
"statusUpdatedAt": "2023-11-07T05:31:56Z",
"deleted": true,
"version": 1,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>",
"feeTotal": {
"amount": 1,
"currency": "<string>"
},
"cancellationReason": "<string>",
"cancelledBy": "<string>",
"paymentMethod": "STRIPE",
"settledAt": "2023-11-07T05:31:56Z",
"amountComped": {
"amount": 1,
"currency": "<string>"
},
"pricingRegion": {
"country": "<string>",
"state": "<string>",
"postalCode": "<string>"
},
"locale": "<string>",
"attribution": {
"searchId": "srch_01k7q3x9h4e8rb2d6m0z5a7c1n",
"sessionKey": "sess-example-01",
"surface": "results"
}
},
"items": [
{
"projectId": "<string>",
"orderId": "<string>",
"orderItemId": "<string>",
"skuType": "SINGLE_SESSION",
"serviceId": "<string>",
"offeringId": "<string>",
"quantity": 1,
"quantityAllocated": 1,
"quantityRemaining": 1,
"unitPrice": {
"amount": 1,
"currency": "<string>"
},
"lineTotal": {
"amount": 1,
"currency": "<string>"
},
"deleted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>",
"packageId": "<string>",
"taxSnapshot": {
"taxable": true,
"taxPercentage": 1
},
"feeSnapshot": [
{
"feeId": "fee_booking",
"name": {
"en": "Booking fee"
},
"calculation": "FLAT",
"amount": 2500,
"percentage": 5,
"taxable": false
}
],
"businessModelId": "<string>",
"label": {},
"priceRuleId": "<string>",
"priceScope": "DEFAULT",
"priceSource": "RULE",
"taxExemptReason": "NO_RATE",
"expiresAt": "2023-11-07T05:31:56Z"
}
],
"summary": {
"currency": "<string>",
"lines": [
{
"orderItemId": "<string>",
"label": {},
"skuType": "SINGLE_SESSION",
"quantity": 1,
"unitPrice": {
"amount": 1,
"currency": "<string>"
},
"lineTotal": {
"amount": 1,
"currency": "<string>"
},
"tax": {
"amount": 1,
"currency": "<string>"
},
"taxable": true,
"priceRuleId": "<string>",
"priceScope": "DEFAULT"
}
],
"fees": [
{
"feeId": "<string>",
"businessModelId": "<string>",
"name": {},
"calculation": "FLAT",
"basis": {
"amount": 1,
"currency": "<string>"
},
"amount": {
"amount": 1,
"currency": "<string>"
},
"tax": {
"amount": 1,
"currency": "<string>"
},
"taxable": true,
"percentage": 123
}
],
"feeTotal": {
"amount": 1,
"currency": "<string>"
},
"subtotal": {
"amount": 1,
"currency": "<string>"
},
"taxTotal": {
"amount": 1,
"currency": "<string>"
},
"total": {
"amount": 1,
"currency": "<string>"
},
"amountPaid": {
"amount": 1,
"currency": "<string>"
},
"amountRefunded": {
"amount": 1,
"currency": "<string>"
},
"amountDue": {
"amount": 1,
"currency": "<string>"
}
}
}
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}Add an item to an order
Adds a line and returns the whole order with its items, so you never need a follow-up read to get the new total. You do not send a price: the server resolves it from the offering against the order’s pricingRegion, which is what keeps the charge honest. A line whose resolved currency differs from the order’s is rejected with 400 rather than silently converted — if you hit that, the order resolved a different region than you expected, so check priceScope on the existing items. A PACKAGE line cannot be added here (400 VALIDATION_ERROR): packages are bought when the order is created, by packageId in POST /orders.
curl --request POST \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"serviceId": "srv_01kv60qg12e82acr78edfnjhvv",
"offeringId": "off_01kv60qge5eh59ap0gw0pqrrys",
"quantity": 2
}
'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items"
payload = {
"serviceId": "srv_01kv60qg12e82acr78edfnjhvv",
"offeringId": "off_01kv60qge5eh59ap0gw0pqrrys",
"quantity": 2
}
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({
serviceId: 'srv_01kv60qg12e82acr78edfnjhvv',
offeringId: 'off_01kv60qge5eh59ap0gw0pqrrys',
quantity: 2
})
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items', 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://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items",
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([
'serviceId' => 'srv_01kv60qg12e82acr78edfnjhvv',
'offeringId' => 'off_01kv60qge5eh59ap0gw0pqrrys',
'quantity' => 2
]),
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://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items"
payload := strings.NewReader("{\n \"serviceId\": \"srv_01kv60qg12e82acr78edfnjhvv\",\n \"offeringId\": \"off_01kv60qge5eh59ap0gw0pqrrys\",\n \"quantity\": 2\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://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"serviceId\": \"srv_01kv60qg12e82acr78edfnjhvv\",\n \"offeringId\": \"off_01kv60qge5eh59ap0gw0pqrrys\",\n \"quantity\": 2\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/orders/{orderId}/items")
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 \"serviceId\": \"srv_01kv60qg12e82acr78edfnjhvv\",\n \"offeringId\": \"off_01kv60qge5eh59ap0gw0pqrrys\",\n \"quantity\": 2\n}"
response = http.request(request)
puts response.read_body{
"data": {
"order": {
"projectId": "<string>",
"tenantId": "<string>",
"orderId": "<string>",
"clientId": "<string>",
"currency": "<string>",
"subtotal": {
"amount": 1,
"currency": "<string>"
},
"tax": {
"amount": 1,
"currency": "<string>"
},
"total": {
"amount": 1,
"currency": "<string>"
},
"amountPaid": {
"amount": 1,
"currency": "<string>"
},
"amountRefunded": {
"amount": 1,
"currency": "<string>"
},
"status": "DRAFT",
"statusUpdatedAt": "2023-11-07T05:31:56Z",
"deleted": true,
"version": 1,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>",
"feeTotal": {
"amount": 1,
"currency": "<string>"
},
"cancellationReason": "<string>",
"cancelledBy": "<string>",
"paymentMethod": "STRIPE",
"settledAt": "2023-11-07T05:31:56Z",
"amountComped": {
"amount": 1,
"currency": "<string>"
},
"pricingRegion": {
"country": "<string>",
"state": "<string>",
"postalCode": "<string>"
},
"locale": "<string>",
"attribution": {
"searchId": "srch_01k7q3x9h4e8rb2d6m0z5a7c1n",
"sessionKey": "sess-example-01",
"surface": "results"
}
},
"items": [
{
"projectId": "<string>",
"orderId": "<string>",
"orderItemId": "<string>",
"skuType": "SINGLE_SESSION",
"serviceId": "<string>",
"offeringId": "<string>",
"quantity": 1,
"quantityAllocated": 1,
"quantityRemaining": 1,
"unitPrice": {
"amount": 1,
"currency": "<string>"
},
"lineTotal": {
"amount": 1,
"currency": "<string>"
},
"deleted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>",
"packageId": "<string>",
"taxSnapshot": {
"taxable": true,
"taxPercentage": 1
},
"feeSnapshot": [
{
"feeId": "fee_booking",
"name": {
"en": "Booking fee"
},
"calculation": "FLAT",
"amount": 2500,
"percentage": 5,
"taxable": false
}
],
"businessModelId": "<string>",
"label": {},
"priceRuleId": "<string>",
"priceScope": "DEFAULT",
"priceSource": "RULE",
"taxExemptReason": "NO_RATE",
"expiresAt": "2023-11-07T05:31:56Z"
}
],
"summary": {
"currency": "<string>",
"lines": [
{
"orderItemId": "<string>",
"label": {},
"skuType": "SINGLE_SESSION",
"quantity": 1,
"unitPrice": {
"amount": 1,
"currency": "<string>"
},
"lineTotal": {
"amount": 1,
"currency": "<string>"
},
"tax": {
"amount": 1,
"currency": "<string>"
},
"taxable": true,
"priceRuleId": "<string>",
"priceScope": "DEFAULT"
}
],
"fees": [
{
"feeId": "<string>",
"businessModelId": "<string>",
"name": {},
"calculation": "FLAT",
"basis": {
"amount": 1,
"currency": "<string>"
},
"amount": {
"amount": 1,
"currency": "<string>"
},
"tax": {
"amount": 1,
"currency": "<string>"
},
"taxable": true,
"percentage": 123
}
],
"feeTotal": {
"amount": 1,
"currency": "<string>"
},
"subtotal": {
"amount": 1,
"currency": "<string>"
},
"taxTotal": {
"amount": 1,
"currency": "<string>"
},
"total": {
"amount": 1,
"currency": "<string>"
},
"amountPaid": {
"amount": 1,
"currency": "<string>"
},
"amountRefunded": {
"amount": 1,
"currency": "<string>"
},
"amountDue": {
"amount": 1,
"currency": "<string>"
}
}
}
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}{
"code": "NOT_FOUND",
"message": "Booking not found",
"statusCode": 404,
"requestId": "a3f1c2de-9b64-4a2f-8f0e-5c9d1b7a2e10"
}Authorizations
API key minted in the MarketBox dashboard. Scope is restricted to the projects you select at creation time. Every route needs the key's standard API access (*) except POST /v1/projects/{projectId}/events, which needs events:write; a key without * is refused with 403 CAPABILITY_NOT_GRANTED.
Path Parameters
Body
Item data