Skip to main content

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​

ParameterTypeDescription
idstringThe 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 CodeDescription
401Unauthorized - Invalid or missing API key
403Forbidden - You don't have permission to delete this shipment
404Not Found - The specified shipment could not be found
422Unprocessable Entity - Cannot delete successfully created shipments
429Too Many Requests - Rate limit exceeded
500Server Error - Something went wrong on our end

Example Request​

cURL​

curl -X DELETE \
https://api.uniship.com/v1/shipments/sh_123456 \
-H "Authorization: Bearer YOUR_API_KEY"

PHP​

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

$response = $client->request('DELETE', 'https://api.uniship.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.uniship.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.