curl --request POST \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"pricing": [
{
"ruleId": "<string>",
"price": {
"amount": 1,
"currency": "<string>"
},
"country": "<string>",
"state": "<string>",
"postalCodes": [
"<string>"
]
}
],
"creditCount": 1,
"name": {},
"description": {},
"discountPercent": 50,
"validityDays": null,
"status": "ACTIVE",
"capacity": 1
}
'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages"
payload = {
"pricing": [
{
"ruleId": "<string>",
"price": {
"amount": 1,
"currency": "<string>"
},
"country": "<string>",
"state": "<string>",
"postalCodes": ["<string>"]
}
],
"creditCount": 1,
"name": {},
"description": {},
"discountPercent": 50,
"validityDays": None,
"status": "ACTIVE",
"capacity": 1
}
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({
pricing: [
{
ruleId: '<string>',
price: {amount: 1, currency: '<string>'},
country: '<string>',
state: '<string>',
postalCodes: ['<string>']
}
],
creditCount: 1,
name: {},
description: {},
discountPercent: 50,
validityDays: null,
status: 'ACTIVE',
capacity: 1
})
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages', 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}/services/{serviceId}/offerings/{offeringId}/packages",
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([
'pricing' => [
[
'ruleId' => '<string>',
'price' => [
'amount' => 1,
'currency' => '<string>'
],
'country' => '<string>',
'state' => '<string>',
'postalCodes' => [
'<string>'
]
]
],
'creditCount' => 1,
'name' => [
],
'description' => [
],
'discountPercent' => 50,
'validityDays' => null,
'status' => 'ACTIVE',
'capacity' => 1
]),
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}/services/{serviceId}/offerings/{offeringId}/packages"
payload := strings.NewReader("{\n \"pricing\": [\n {\n \"ruleId\": \"<string>\",\n \"price\": {\n \"amount\": 1,\n \"currency\": \"<string>\"\n },\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCodes\": [\n \"<string>\"\n ]\n }\n ],\n \"creditCount\": 1,\n \"name\": {},\n \"description\": {},\n \"discountPercent\": 50,\n \"validityDays\": null,\n \"status\": \"ACTIVE\",\n \"capacity\": 1\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}/services/{serviceId}/offerings/{offeringId}/packages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pricing\": [\n {\n \"ruleId\": \"<string>\",\n \"price\": {\n \"amount\": 1,\n \"currency\": \"<string>\"\n },\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCodes\": [\n \"<string>\"\n ]\n }\n ],\n \"creditCount\": 1,\n \"name\": {},\n \"description\": {},\n \"discountPercent\": 50,\n \"validityDays\": null,\n \"status\": \"ACTIVE\",\n \"capacity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages")
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 \"pricing\": [\n {\n \"ruleId\": \"<string>\",\n \"price\": {\n \"amount\": 1,\n \"currency\": \"<string>\"\n },\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCodes\": [\n \"<string>\"\n ]\n }\n ],\n \"creditCount\": 1,\n \"name\": {},\n \"description\": {},\n \"discountPercent\": 50,\n \"validityDays\": null,\n \"status\": \"ACTIVE\",\n \"capacity\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"entityType": "SERVICE_PACKAGE",
"projectId": "<string>",
"serviceId": "<string>",
"offeringId": "<string>",
"packageId": "<string>",
"pricingModel": "PER_SESSION",
"pricing": [
{
"ruleId": "<string>",
"scope": "DEFAULT",
"price": {
"amount": 1,
"currency": "<string>"
},
"country": "<string>",
"state": "<string>",
"postalCodes": [
"<string>"
],
"tax": {
"taxable": true,
"taxPercentage": 1
}
}
],
"creditCount": 1,
"validityDays": 1,
"status": "DRAFT",
"capacity": 1,
"deleted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>",
"name": {},
"description": {},
"discountPercent": 50
}
}{
"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"
}Create a sellable package (bundle) for an offering
Sells creditCount prepaid sessions of one offering as a single bundle. The parent service must already carry an ACTIVE business model of type PACKAGE — without it this is a 400, and that guard is the usual reason a first package create fails, so add the business model before the package. The offering must belong to the service named in the path and not be deleted, or 404. Pricing is FLAT and cannot be changed: each rule’s amount is the total for the WHOLE bundle, not per session, so a 10-session bundle at 45000 charges 45000 once. The pricing array obeys the same rules as an offering’s — exactly one DEFAULT rule, children require parents, country and state coerce to ISO codes. Defaults if omitted: status ACTIVE (so it is on sale the moment it is created — send DRAFT if it is not ready), capacity 1, and validityDays null meaning credits never expire.
curl --request POST \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"pricing": [
{
"ruleId": "<string>",
"price": {
"amount": 1,
"currency": "<string>"
},
"country": "<string>",
"state": "<string>",
"postalCodes": [
"<string>"
]
}
],
"creditCount": 1,
"name": {},
"description": {},
"discountPercent": 50,
"validityDays": null,
"status": "ACTIVE",
"capacity": 1
}
'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages"
payload = {
"pricing": [
{
"ruleId": "<string>",
"price": {
"amount": 1,
"currency": "<string>"
},
"country": "<string>",
"state": "<string>",
"postalCodes": ["<string>"]
}
],
"creditCount": 1,
"name": {},
"description": {},
"discountPercent": 50,
"validityDays": None,
"status": "ACTIVE",
"capacity": 1
}
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({
pricing: [
{
ruleId: '<string>',
price: {amount: 1, currency: '<string>'},
country: '<string>',
state: '<string>',
postalCodes: ['<string>']
}
],
creditCount: 1,
name: {},
description: {},
discountPercent: 50,
validityDays: null,
status: 'ACTIVE',
capacity: 1
})
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages', 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}/services/{serviceId}/offerings/{offeringId}/packages",
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([
'pricing' => [
[
'ruleId' => '<string>',
'price' => [
'amount' => 1,
'currency' => '<string>'
],
'country' => '<string>',
'state' => '<string>',
'postalCodes' => [
'<string>'
]
]
],
'creditCount' => 1,
'name' => [
],
'description' => [
],
'discountPercent' => 50,
'validityDays' => null,
'status' => 'ACTIVE',
'capacity' => 1
]),
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}/services/{serviceId}/offerings/{offeringId}/packages"
payload := strings.NewReader("{\n \"pricing\": [\n {\n \"ruleId\": \"<string>\",\n \"price\": {\n \"amount\": 1,\n \"currency\": \"<string>\"\n },\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCodes\": [\n \"<string>\"\n ]\n }\n ],\n \"creditCount\": 1,\n \"name\": {},\n \"description\": {},\n \"discountPercent\": 50,\n \"validityDays\": null,\n \"status\": \"ACTIVE\",\n \"capacity\": 1\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}/services/{serviceId}/offerings/{offeringId}/packages")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"pricing\": [\n {\n \"ruleId\": \"<string>\",\n \"price\": {\n \"amount\": 1,\n \"currency\": \"<string>\"\n },\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCodes\": [\n \"<string>\"\n ]\n }\n ],\n \"creditCount\": 1,\n \"name\": {},\n \"description\": {},\n \"discountPercent\": 50,\n \"validityDays\": null,\n \"status\": \"ACTIVE\",\n \"capacity\": 1\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/services/{serviceId}/offerings/{offeringId}/packages")
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 \"pricing\": [\n {\n \"ruleId\": \"<string>\",\n \"price\": {\n \"amount\": 1,\n \"currency\": \"<string>\"\n },\n \"country\": \"<string>\",\n \"state\": \"<string>\",\n \"postalCodes\": [\n \"<string>\"\n ]\n }\n ],\n \"creditCount\": 1,\n \"name\": {},\n \"description\": {},\n \"discountPercent\": 50,\n \"validityDays\": null,\n \"status\": \"ACTIVE\",\n \"capacity\": 1\n}"
response = http.request(request)
puts response.read_body{
"data": {
"entityType": "SERVICE_PACKAGE",
"projectId": "<string>",
"serviceId": "<string>",
"offeringId": "<string>",
"packageId": "<string>",
"pricingModel": "PER_SESSION",
"pricing": [
{
"ruleId": "<string>",
"scope": "DEFAULT",
"price": {
"amount": 1,
"currency": "<string>"
},
"country": "<string>",
"state": "<string>",
"postalCodes": [
"<string>"
],
"tax": {
"taxable": true,
"taxPercentage": 1
}
}
],
"creditCount": 1,
"validityDays": 1,
"status": "DRAFT",
"capacity": 1,
"deleted": true,
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z",
"createdBy": "<string>",
"updatedBy": "<string>",
"name": {},
"description": {},
"discountPercent": 50
}
}{
"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
Package data
Percentage discount (0-100) recorded when this package's prices were seeded from the offering's prices (price = offering price * creditCount * (1 - discountPercent/100)). Informational metadata only: pricing is the authoritative source of the amounts charged. Individual prices can be manually overridden after seeding, and the offering's prices may change later, so this value is not guaranteed to match the actual prices - never derive amounts from it.
0 <= x <= 100