Delete Shipment
Deletes a shipment from your account.
Endpoint
DELETE /v1/shipments/{id}
Authentication
API key required. Include it in the Authorization header:
Authorization: Bearer YOUR_API_KEY
Path Parameters
| Parameter | Type | Description |
|---|---|---|
id | string | The ID of the shipment to delete. |
Response
204 No Content
A successful deletion returns a 204 No Content response with no body.
Error Responses
| Status Code | Description |
|---|---|
| 401 | Unauthorized - Invalid or missing API key |
| 403 | Forbidden - You don't have permission to delete this shipment |
| 404 | Not Found - The specified shipment could not be found |
| 422 | Unprocessable Entity - Cannot delete successfully created shipments |
| 429 | Too Many Requests - Rate limit exceeded |
| 500 | Server Error - Something went wrong on our end |
Example Request
cURL
curl -X DELETE \
https://api.shipping-channels.com/v1/shipments/sh_123456 \
-H "Authorization: Bearer YOUR_API_KEY"
PHP
<?php
$client = new \GuzzleHttp\Client();
$response = $client->request('DELETE', 'https://api.shipping-channels.com/v1/shipments/sh_123456', [
'headers' => [
'Authorization' => 'Bearer YOUR_API_KEY',
'Accept' => 'application/json',
],
]);
// 204 No Content response indicates success
$statusCode = $response->getStatusCode();
JavaScript
fetch('https://api.shipping-channels.com/v1/shipments/sh_123456', {
method: 'DELETE',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Accept': 'application/json'
}
})
.then(response => {
if (response.status === 204) {
console.log('Shipment deleted successfully');
} else {
return response.json().then(data => Promise.reject(data));
}
})
.catch(error => console.error('Error:', error));
Implications of Deletion
Shipments can only be deleted if they have not been successfully created with the shipping provider. Once a shipment is successfully created (e.g., a label has been generated), it cannot be deleted via this API.