curl --request PUT \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <api-key>'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default"
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>"
}
response = requests.put(url, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', Authorization: 'Bearer <token>'}
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default', 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}/clients/me/addresses/{addressId}/default",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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"
"net/http"
"io"
)
func main() {
url := "https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"entityType": "CLIENT_PROFILE",
"clientId": "<string>",
"projectId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"fullName": "<string>",
"firstNameNormalized": "<string>",
"lastNameNormalized": "<string>",
"fullNameNormalized": "<string>",
"email": "<string>",
"emailNormalized": "<string>",
"invitationStatus": "NONE",
"stripeCustomerId": "<string>",
"stripeAccountId": "<string>",
"active": true,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"createdBy": "<string>",
"updatedBy": "<string>",
"addresses": [
{
"addressOneLine": "10 Main St, Toronto, ON M5V 1A1, Canada",
"streetNumber": "10",
"streetName": "Main St",
"city": "Toronto",
"state": "ON",
"country": "CA",
"zipCode": "M5V 1A1",
"id": "<string>",
"unitNumber": "4B",
"source": "BOOKING",
"latitude": 123,
"longitude": 123
}
],
"phone": "<string>",
"defaultAddressId": "<string>",
"externalId": "<string>",
"externalData": {},
"userId": "<string>",
"notes": "<string>",
"lifetimeSpend": 123,
"orderCount": 123,
"lastPurchaseAt": "<string>",
"lastPaymentMethodId": "<string>",
"lastPayment": {
"type": "CARD",
"brand": "<string>",
"last4": "<string>",
"paidAt": "<string>",
"expMonth": 6,
"expYear": 123
},
"defaultLocale": "<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"
}Set the caller's default address
Points the client’s defaultAddressId at an address they have already saved; it does not create one, so add the address first or this is a 404. Returns the whole updated profile.
Worth doing deliberately rather than leaving to chance, because the default is not just a delivery preference: it is the fallback the pricing engine uses to pick a region when an order names no reservation, location or address of its own. Moving the default across a country or subdivision border therefore changes what that client is quoted for the same offering. It does not touch orders already placed, which snapshot their region at creation, so repointing it fixes future orders only.
curl --request PUT \
--url https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default \
--header 'Authorization: Bearer <token>' \
--header 'x-api-key: <api-key>'import requests
url = "https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default"
headers = {
"x-api-key": "<api-key>",
"Authorization": "Bearer <token>"
}
response = requests.put(url, headers=headers)
print(response.text)const options = {
method: 'PUT',
headers: {'x-api-key': '<api-key>', Authorization: 'Bearer <token>'}
};
fetch('https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default', 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}/clients/me/addresses/{addressId}/default",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"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"
"net/http"
"io"
)
func main() {
url := "https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default"
req, _ := http.NewRequest("PUT", url, nil)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.put("https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default")
.header("x-api-key", "<api-key>")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://apiv2.gomarketbox.com/v1/projects/{projectId}/clients/me/addresses/{addressId}/default")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Put.new(url)
request["x-api-key"] = '<api-key>'
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"data": {
"entityType": "CLIENT_PROFILE",
"clientId": "<string>",
"projectId": "<string>",
"firstName": "<string>",
"lastName": "<string>",
"fullName": "<string>",
"firstNameNormalized": "<string>",
"lastNameNormalized": "<string>",
"fullNameNormalized": "<string>",
"email": "<string>",
"emailNormalized": "<string>",
"invitationStatus": "NONE",
"stripeCustomerId": "<string>",
"stripeAccountId": "<string>",
"active": true,
"deleted": true,
"createdAt": "<string>",
"updatedAt": "<string>",
"createdBy": "<string>",
"updatedBy": "<string>",
"addresses": [
{
"addressOneLine": "10 Main St, Toronto, ON M5V 1A1, Canada",
"streetNumber": "10",
"streetName": "Main St",
"city": "Toronto",
"state": "ON",
"country": "CA",
"zipCode": "M5V 1A1",
"id": "<string>",
"unitNumber": "4B",
"source": "BOOKING",
"latitude": 123,
"longitude": 123
}
],
"phone": "<string>",
"defaultAddressId": "<string>",
"externalId": "<string>",
"externalData": {},
"userId": "<string>",
"notes": "<string>",
"lifetimeSpend": 123,
"orderCount": 123,
"lastPurchaseAt": "<string>",
"lastPaymentMethodId": "<string>",
"lastPayment": {
"type": "CARD",
"brand": "<string>",
"last4": "<string>",
"paidAt": "<string>",
"expMonth": 6,
"expYear": 123
},
"defaultLocale": "<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"
}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.