Skip to main content

Update Shipment

Updates an existing shipment with new information or metadata. Only certain fields can be updated after creation.

Endpoint

PUT /v1/shipments/{id}
PATCH /v1/shipments/{id}

Authentication

API key required. Include it in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Path Parameters

ParameterTypeDescription
idstringThe ID of the shipment to update.

Request Body

ParameterTypeRequiredDescription
reference_numberstringNoYour internal reference number for this shipment.
metadataobjectNoArbitrary metadata for the shipment.
enable_trackingbooleanNoWhether to enable tracking for the shipment.

Example Request Body

{
"reference_number": "UPDATED-ORD-2025-001",
"metadata": {
"customer_notes": "Fragile items, handle with care."
}
}

Response

200 OK

{
"data": {
"id": "sh_123456",
"reference_number": "UPDATED-ORD-2025-001",
"shipping_channel_id": "ch_123456",
"provider_shipment_id": "DHL-ABC-123",
"status": "created",
"total_price": 15.50,
"currency": "USD",
"created_at": "2025-08-10T10:00:00Z",
"updated_at": "2025-08-10T10:05:00Z"
}
}

Error Responses

Status CodeDescription
400Bad Request - Invalid input parameters
401Unauthorized - Invalid or missing API key
403Forbidden - You don't have permission to update this shipment
404Not Found - The specified shipment could not be found
422Unprocessable Entity - Validation errors
429Too Many Requests - Rate limit exceeded
500Server Error - Something went wrong on our end

Example Request

cURL

curl -X PUT \
https://api.shipping-channels.com/v1/shipments/sh_123456 \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"reference_number": "UPDATED-ORD-2025-001",
"metadata": {
"customer_notes": "Fragile items, handle with care."
}
}'

PHP

<?php
$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.shipping-channels.com/v1/shipments/sh_123456', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
'Content-Type' => 'application/json',
],
'json' => [
"reference_number" => "UPDATED-ORD-2025-001",
"metadata" => [
"customer_notes" => "Fragile items, handle with care."
]
],
]);

$data = json_decode($response->getBody(), true);

JavaScript

fetch('https://api.shipping-channels.com/v1/shipments/sh_123456', {
method: 'PUT',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
'Accept': 'application/json'
},
body: JSON.stringify({
reference_number: "UPDATED-ORD-2025-001",
metadata: {
customer_notes: "Fragile items, handle with care."
}
})
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error('Error:', error));