curl --request PUT \
--url https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"address_2": "<string>",
"province": "<string>",
"phone": "<string>",
"company": "<string>",
"expected_updated_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'PUT',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
address_1: '<string>',
city: '<string>',
postal_code: '<string>',
country_code: '<string>',
address_2: '<string>',
province: '<string>',
phone: '<string>',
company: '<string>',
expected_updated_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"address_2": "<string>",
"province": "<string>",
"phone": "<string>",
"company": "<string>",
"expected_updated_at": "2023-11-07T05:31:56Z"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"address_2\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\",\n \"expected_updated_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'first_name' => '<string>',
'last_name' => '<string>',
'address_1' => '<string>',
'city' => '<string>',
'postal_code' => '<string>',
'country_code' => '<string>',
'address_2' => '<string>',
'province' => '<string>',
'phone' => '<string>',
'company' => '<string>',
'expected_updated_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"amount_due_minor": 123,
"billing_address": null,
"created_at": "<string>",
"currency_code": "<string>",
"customer_id": null,
"discount_total_minor": 123,
"display_id": 123,
"email": "<string>",
"gift_card_total_minor": 123,
"id": "<string>",
"line_items": [
{
"id": "<string>",
"product_title": "<string>",
"quantity": 123,
"unit_price_minor": 123,
"variant_id": "<string>",
"variant_title": "<string>"
}
],
"loyalty_total_minor": 123,
"shipping_address": {
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"company": "<string>",
"country_code": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"province": "<string>"
},
"shipping_option_name": null,
"shipping_total_minor": 123,
"status": "<string>",
"store_credit_total_minor": 123,
"subtotal_minor": 123,
"tax_total_minor": 123,
"total_minor": 123,
"updated_at": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}Replace an order's shipping address
curl --request PUT \
--url https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"address_2": "<string>",
"province": "<string>",
"phone": "<string>",
"company": "<string>",
"expected_updated_at": "2023-11-07T05:31:56Z"
}
'const options = {
method: 'PUT',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
first_name: '<string>',
last_name: '<string>',
address_1: '<string>',
city: '<string>',
postal_code: '<string>',
country_code: '<string>',
address_2: '<string>',
province: '<string>',
phone: '<string>',
company: '<string>',
expected_updated_at: '2023-11-07T05:31:56Z'
})
};
fetch('https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address"
payload = {
"first_name": "<string>",
"last_name": "<string>",
"address_1": "<string>",
"city": "<string>",
"postal_code": "<string>",
"country_code": "<string>",
"address_2": "<string>",
"province": "<string>",
"phone": "<string>",
"company": "<string>",
"expected_updated_at": "2023-11-07T05:31:56Z"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.put(url, json=payload, headers=headers)
print(response.text)package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address"
payload := strings.NewReader("{\n \"first_name\": \"<string>\",\n \"last_name\": \"<string>\",\n \"address_1\": \"<string>\",\n \"city\": \"<string>\",\n \"postal_code\": \"<string>\",\n \"country_code\": \"<string>\",\n \"address_2\": \"<string>\",\n \"province\": \"<string>\",\n \"phone\": \"<string>\",\n \"company\": \"<string>\",\n \"expected_updated_at\": \"2023-11-07T05:31:56Z\"\n}")
req, _ := http.NewRequest("PUT", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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))
}<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.mercemur.com/api/v1/orders/{orderId}/shipping-address",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PUT",
CURLOPT_POSTFIELDS => json_encode([
'first_name' => '<string>',
'last_name' => '<string>',
'address_1' => '<string>',
'city' => '<string>',
'postal_code' => '<string>',
'country_code' => '<string>',
'address_2' => '<string>',
'province' => '<string>',
'phone' => '<string>',
'company' => '<string>',
'expected_updated_at' => '2023-11-07T05:31:56Z'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}{
"data": {
"amount_due_minor": 123,
"billing_address": null,
"created_at": "<string>",
"currency_code": "<string>",
"customer_id": null,
"discount_total_minor": 123,
"display_id": 123,
"email": "<string>",
"gift_card_total_minor": 123,
"id": "<string>",
"line_items": [
{
"id": "<string>",
"product_title": "<string>",
"quantity": 123,
"unit_price_minor": 123,
"variant_id": "<string>",
"variant_title": "<string>"
}
],
"loyalty_total_minor": 123,
"shipping_address": {
"address_1": "<string>",
"address_2": "<string>",
"city": "<string>",
"company": "<string>",
"country_code": "<string>",
"first_name": "<string>",
"last_name": "<string>",
"phone": "<string>",
"postal_code": "<string>",
"province": "<string>"
},
"shipping_option_name": null,
"shipping_total_minor": 123,
"status": "<string>",
"store_credit_total_minor": 123,
"subtotal_minor": 123,
"tax_total_minor": 123,
"total_minor": 123,
"updated_at": "<string>"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}{
"error": {
"code": "<string>",
"message": "<string>",
"resource": "<string>",
"field": "<string>",
"reason": "malformed_json"
}
}Authorizations
A secret API key. Publishable keys cannot reach this API. A key may carry an expiry, and an expired key is refused exactly like an unknown one, with a 401 that names no reason; check the key's expires_at in the dashboard rather than inferring it from a response. When a merchant rolls a key's secret they choose a grace window of up to 3 days, and for its duration BOTH the new secret and the one it replaced authenticate, so an integration moves over on its own deploy schedule instead of at the instant the button is pressed. Move before the window closes: after it, the old secret is refused. Nothing else about this contract moves with a roll. The key keeps its id and its scopes, so the only thing an integration updates is the credential itself.
Headers
A unique key per logical write. Replaying a request with the same key returns the first response byte for byte instead of applying the write twice.
Path Parameters
Body
The body IS the address document; there is no shipping_address wrapper. It REPLACES the stored address wholesale, so an omitted optional field is stored as empty: correcting a postal code without resending phone erases the phone number the carrier needs. Refused with 409 once the order carries a shipment or has moved past paid, because after that the parcel has gone and a rewrite would make the record lie about where it went. Money is snapshotted at placement, so this does NOT recompute tax for the new destination.
Required.
255Required.
255Required.
255Required.
128Required.
32Required, exactly two letters. Stored LOWERCASED, so a client that sends "US" reads "us" back from the next GET and must not treat that as a change it did not make.
225512832255OPTIONAL precondition, the same contract as the metadata replace. Send the updated_at you read and the write is refused with 409 order_modified if the order moved since. Omit it to accept last-write-wins. It is checked BEFORE the shipped/paid gate, so a caller working from a stale read is told the order moved rather than that it has shipped.
Response
Success
Show child attributes
Show child attributes