Create Shipment
POST /inboxes/{inbox_id}/shipments
Creates a shipment request for one or more pieces using a rate previously retrieved with getShippingRates. The shipping address is the one the rate was requested for.
The rate must not be expired, and items must list the same pieces the rate was requested for. All pieces must be stored at the same facility and must not be junk mail or have another operation in progress. Declared values and customs details given here replace the ones from the rate request.
International shipments need customs information (see getShippingRates). If it is missing, the request fails with 400.
Authorizations
Section titled “Authorizations”Send your API key in the x-api-key header.
See Authentication.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body required
Section titled “Request Body required ”object
Ignored. The shipping address is taken from the rate.
The id of a rate returned by getShippingRates. Required.
The pieces to ship. Must match the pieces the rate was requested for.
object
Customs line items. Replaces the ones from the rate request.
object
20000men's cotton trousers620520Require a signature on delivery.
Insure the shipment.
Total declared value of the shipment, in cents.
Description of the contents for customs.
AES Internal Transaction Number, for destinations whose shipping address has requires_itn.
Kind of contents, for customs. With Documents, HS tariff codes are not required.
Earliest date to ship. Optional. If it is missing or not a valid shipping date, the next valid shipping date is used.
Examples
{ "rate_id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "items": [ { "piece_id": 1234000 }, { "piece_id": 1234001 } ]}{ "rate_id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "items": [ { "piece_id": 123456789 } ], "is_insured": true, "declared_value_in_cents": 100000}{ "rate_id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "items": [ { "piece_id": 120000 } ], "contents_type": "Merchandise", "custom_items": [ { "description": "men's cotton trousers", "declared_value_in_cents": 20000, "hs_tariff_code": "620520" } ]}Responses
Section titled “ Responses ”Success
object
shippendingobject
123456Molly Smith1004 S Mt Olive StPHOENIXAZArizonaUSUnited States72761[ "domestic"]object
a1b2c3d4-e5f6-7890-abcd-ef1234567890USPS - ExpressExpress5335trueobject
object
20000men's cotton trousers620520object
object
14460059975990000000101 0016615290433808312186object
122028Bruce Wayne97599[ "unscanned", "read", "inbox", "stored"][ "unscanned", "read", "inbox", "stored"]0.1623.90.18.88object
UnknownUnknownobject
1_1_2_0_0image/jpg[ "color", "large", "enclosure", "front"]144600591mailletterobject
object
3001Urgent12Examples
{ "created_at": "2024-11-01T10:00:00Z", "id": 60001, "updated_at": "2024-11-01T10:00:00Z", "operation_action": "ship", "operation_status": "pending", "tags": [], "aes_itn": null, "contents_type": null, "custom_items": [], "customs_description": null, "declared_value_in_cents": null, "estimated_shipped_at": "2024-11-05T20:00:00Z", "is_insured": false, "is_shared": false, "items": [ { "customs_description": null, "declared_value_in_cents": null, "has_complete_scan": false, "piece_id": 1234000 }, { "customs_description": null, "declared_value_in_cents": null, "has_complete_scan": false, "piece_id": 1234001 } ], "owner_user_id": "12345", "pieces": [], "rate": { "carrier_service": "GroundAdvantage", "carrier_type": "USPS - Ground Advantage", "created_at": "2024-11-04T10:00:00Z", "expired_at": "2024-11-07T10:00:00Z", "id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "price_in_cents": 910, "tracking_available": true }, "rate_id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "return_address": { "address_line_1": "", "address_line_2": null, "addressee": "", "country": "", "country_abbreviation": "", "locality": "", "postal_code": "", "region": "", "region_abbreviation": "" }, "ship_after": "2024-11-05T20:00:00Z", "shipping_address": { "created_at": "2024-11-04T10:00:00Z", "id": 12345, "updated_at": "2024-11-04T10:00:00Z", "address_line_1": "1004 S Mt Olive St", "address_line_2": "", "addressee": "Molly Smith", "company": null, "country": "United States", "country_abbreviation": "US", "delivery_confidence_percent": null, "inbox_id": 97599, "is_authorized": null, "locality": "PHOENIX", "phone": "", "postal_code": "72761", "region": "Arizona", "region_abbreviation": "AZ", "requires_hs_tariff_codes": false, "requires_itn": false, "tags": [ "domestic" ] }, "shipping_address_id": 12345, "shipping_comment": null, "signature_on_delivery": false, "tracking_number": null}{ "created_at": "2024-11-04T10:38:05Z", "id": 300000, "updated_at": "2024-11-04T10:38:05Z", "operation_action": "ship", "operation_status": "pending", "tags": [], "aes_itn": null, "contents_type": null, "custom_items": [], "customs_description": null, "declared_value_in_cents": 100000, "estimated_shipped_at": "2024-11-20T20:00:00Z", "is_insured": true, "is_shared": false, "items": [ { "customs_description": null, "declared_value_in_cents": null, "has_complete_scan": true, "piece_id": 123456789 } ], "owner_user_id": "116561", "pieces": [], "rate": { "carrier_service": "GroundAdvantage", "carrier_type": "USPS - Ground Advantage", "created_at": "2024-11-04T10:38:00Z", "expired_at": "2024-11-07T10:38:00Z", "id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "price_in_cents": 1295, "tracking_available": true }, "rate_id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "return_address": { "address_line_1": "", "address_line_2": null, "addressee": "", "country": "", "country_abbreviation": "", "locality": "", "postal_code": "", "region": "", "region_abbreviation": "" }, "ship_after": "2024-11-20T20:00:00Z", "shipping_address_id": 123456, "shipping_comment": null, "signature_on_delivery": false, "tracking_number": null}{ "created_at": "2024-11-04T10:55:40Z", "id": 234234, "updated_at": "2024-11-04T10:55:40Z", "operation_action": "ship", "operation_status": "pending", "tags": [], "aes_itn": null, "contents_type": "Merchandise", "custom_items": [ { "declared_value_in_cents": 20000, "description": "men's cotton trousers", "hs_tariff_code": "620520" } ], "customs_description": null, "declared_value_in_cents": null, "estimated_shipped_at": "2024-11-20T18:00:00Z", "is_insured": true, "is_shared": false, "items": [ { "customs_description": null, "declared_value_in_cents": null, "has_complete_scan": false, "piece_id": 120000 } ], "owner_user_id": "116561", "pieces": [], "rate": { "carrier_service": "FirstClassPackageInternationalService", "carrier_type": "USPS - First Class Package International Service", "created_at": "2024-11-04T10:55:22Z", "expired_at": "2024-11-07T10:55:22Z", "id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "price_in_cents": 2855, "tracking_available": true }, "rate_id": "1a5c1a4f-ee30-4269-abbc-63a7fc991342", "return_address": { "address_line_1": "", "address_line_2": null, "addressee": "", "country": "", "country_abbreviation": "", "locality": "", "postal_code": "", "region": "", "region_abbreviation": "" }, "ship_after": "2024-11-20T18:00:00Z", "shipping_address_id": 12345, "shipping_comment": null, "signature_on_delivery": false, "tracking_number": null}The request could not be processed, for example an international shipment without customs information.
Error envelope returned with 4xx and 5xx responses.
object
object
Usually the HTTP status code. It can differ; a request to an unknown path returns HTTP 400 with code 500.
401Human-readable description of the error.
The kind of error, for example Authorization or REST.
RESTReturned only with 422 responses. It may give more details about what failed validation, as lists of messages keyed by the name of the input.
object
The x-api-key header is missing or the key is not valid, or the caller can’t access an ID in the request. IDs that don’t exist return the same response as IDs the caller can’t access.
Error envelope returned with 4xx and 5xx responses.
object
object
Usually the HTTP status code. It can differ; a request to an unknown path returns HTTP 400 with code 500.
401Human-readable description of the error.
The kind of error, for example Authorization or REST.
RESTReturned only with 422 responses. It may give more details about what failed validation, as lists of messages keyed by the name of the input.
object
Examples
{ "error": { "code": 401, "message": "The request does not include a valid access token. Please provide a valid access token.", "type": "Authorization" }}{ "error": { "code": 401, "message": "x-api-key: x-api-key is invalid", "type": "REST" }}{ "error": { "code": 401, "message": "User does not have access to requested resource.", "type": "Authorization" }}Actions are blocked for a piece in the request. When an account’s mail actions are blocked, for example because the account wasn’t reverified or an identity document expired, pieces received after that can’t be changed. These pieces have actions-blocked-no-reverification or actions-blocked-document-expired in their attributes.
Error envelope returned with 4xx and 5xx responses.
object
object
Usually the HTTP status code. It can differ; a request to an unknown path returns HTTP 400 with code 500.
401Human-readable description of the error.
The kind of error, for example Authorization or REST.
RESTReturned only with 422 responses. It may give more details about what failed validation, as lists of messages keyed by the name of the input.
object
Examples
{ "error": { "code": 403, "message": "piece: Mail actions for piece with ID 123456 has been blocked.", "type": "REST" }}The referenced resource is accessible, but the requested item does not exist, for example a pending operation. IDs the caller can’t access, or that don’t exist at all, return 401 instead.
Error envelope returned with 4xx and 5xx responses.
object
object
Usually the HTTP status code. It can differ; a request to an unknown path returns HTTP 400 with code 500.
401Human-readable description of the error.
The kind of error, for example Authorization or REST.
RESTReturned only with 422 responses. It may give more details about what failed validation, as lists of messages keyed by the name of the input.
object
Example
{ "error": { "code": 404, "message": "piece_id: Piece with ID 14460059 does not have outstanding Operation of type Recycle.", "type": "REST" }}The request body failed validation. The message names the invalid field.
Error envelope returned with 4xx and 5xx responses.
object
object
Usually the HTTP status code. It can differ; a request to an unknown path returns HTTP 400 with code 500.
401Human-readable description of the error.
The kind of error, for example Authorization or REST.
RESTReturned only with 422 responses. It may give more details about what failed validation, as lists of messages keyed by the name of the input.
object
Example
{ "error": { "code": 422, "message": "label: must have a value", "type": "REST", "fields": {} }}