Skip to main content

Shipments — Mailhub API Reference

Get shipping rate quotes for an order's shipment; buy the label for a selected rate under Labels. Merge 2 to 25 Draft or Created orders going to the same recipient, from the same source, into one shipment that is bought with one label; the orders stay separate orders. While no label covers a merged shipment, add an order to it, change its address or parcel, or take it apart again. Live carrier tracking is not part of the public API — a shipment's `status` field reflects this and stays `Unknown` after a label purchase.

Operations

POST /api/v1/shipments/merge

Merge orders into one shipment

Puts 2 to 25 Draft or Created orders going to the same recipient, from the same source, into one new shipment that is bought with one label. The orders stay separate orders; each one's shipment becomes the merged shipment. Rates and the label are then requested on the returned shipmentId. Sending the same merge again answers with the same shipment.

Authentication: JWTBearerAuth, Bearer http, JWT

Parameters

NameInTypeRequiredDescription
X-SubAccount-Idheaderstring (uuid)optionalOptional. If present, every order must belong to this sub-account; a shipment never mixes sub-accounts.

Example: 3a7d9e21-6b48-4c15-9f2e-7d0c5b83a614

Idempotency-KeyheaderstringoptionalOptional. Identifies one merge action. Repeating the request with the same value returns the first answer instead of acting again, even if the shipment changed since. The same value with a different request or another merge action is refused with 422 Idempotency.KeyReused. A request that failed stores nothing and may be repeated with the same value. Scoped to the account, and a repeat must carry the same X-SubAccount-Id as the first request. Maximum 200 characters.

Constraints: max length 200

Example: order-2026-09-07-0001

Request body (required)

application/json — MergeOrdersRequest

{
  "anchorOrderId": "5f2c1a10-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
  "orderIds": [
    "5f2c1a10-2b3d-4e5f-8a9b-0c1d2e3f4a5b",
    "114f6a6a-4b16-410a-9007-5086de668065"
  ]
}

Responses

StatusDescriptionBody
200The merged shipment and its orders, anchor first

application/json — MergedShipmentEnvelope

400The request could not be read as sent — for example an `X-SubAccount-Id` header that is not a GUID.

application/json — ErrorEnvelope

401Not authenticated

application/json — ErrorEnvelope

403Authenticated, but not with an Open API integration token. Sent without a body.No response body.
404An order was not found

application/json — ErrorEnvelope

409Order.MergeRefused: metadata lists each refused order with its reason. Shipment.MergeChangedConcurrently: the orders changed meanwhile; send it again

application/json — ErrorEnvelope

415The request was sent with a `Content-Type` other than `application/json`. Answered by middleware ahead of authentication, so it is reachable on every write operation.

application/json — ErrorEnvelope

422Invalid request: order count, anchor missing, parcel, or Idempotency.KeyReused

application/json — ErrorEnvelope

500The request could not be completed because of an unexpected server-side failure.

application/json — ErrorEnvelope

PUT /api/v1/shipments/{shipmentId}

Change a merged shipment's address or parcel

Edits the recipient address (US only) and the parcel that the merged shipment owns, while no label covers it. Send either or both. The orders keep their own addresses and parcels. Quoted rates are dropped.

Authentication: JWTBearerAuth, Bearer http, JWT

Parameters

NameInTypeRequiredDescription
shipmentIdpathstring (guid)required

Example: b91a2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d

X-SubAccount-Idheaderstring (uuid)optionalOptional. If present, the shipment must belong to this sub-account.

Example: 3a7d9e21-6b48-4c15-9f2e-7d0c5b83a614

Idempotency-KeyheaderstringoptionalOptional. Identifies one merge action. Repeating the request with the same value returns the first answer instead of acting again, even if the shipment changed since. The same value with a different request or another merge action is refused with 422 Idempotency.KeyReused. A request that failed stores nothing and may be repeated with the same value. Scoped to the account, and a repeat must carry the same X-SubAccount-Id as the first request. Maximum 200 characters.

Constraints: max length 200

Example: order-2026-09-07-0001

Request body (required)

application/json — UpdateMergedShipmentRequest

{
  "parcel": {
    "weight": 32,
    "length": 10,
    "width": 8,
    "height": 4
  }
}

Responses

StatusDescriptionBody
200The merged shipment and its orders, anchor first

application/json — MergedShipmentEnvelope

400The request could not be read as sent — for example an `X-SubAccount-Id` header that is not a GUID.

application/json — ErrorEnvelope

401Not authenticated

application/json — ErrorEnvelope

403Authenticated, but not with an Open API integration token. Sent without a body.No response body.
404Not a merged shipment of this account (Shipment.NotMerged)

application/json — ErrorEnvelope

409Shipment.MergeHasActiveLabel, Shipment.MergePurchaseInProgress or Shipment.MergeChangedConcurrently

application/json — ErrorEnvelope

415The request was sent with a `Content-Type` other than `application/json`. Answered by middleware ahead of authentication, so it is reachable on every write operation.

application/json — ErrorEnvelope

422Invalid address or parcel, nothing to change, or Idempotency.KeyReused

application/json — ErrorEnvelope

500The request could not be completed because of an unexpected server-side failure.

application/json — ErrorEnvelope

POST /api/v1/shipments/{shipmentId}/orders

Add an order to a merged shipment

Puts one more Draft or Created order into a merged shipment that has no label. The order must go to the merged shipment's own recipient address. Its weight is added to the shipment's parcel and quoted rates are dropped. Adding an order already in the shipment answers with the shipment unchanged.

Authentication: JWTBearerAuth, Bearer http, JWT

Parameters

NameInTypeRequiredDescription
shipmentIdpathstring (guid)required

Example: b91a2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d

X-SubAccount-Idheaderstring (uuid)optionalOptional. If present, the shipment and the order must belong to this sub-account.

Example: 3a7d9e21-6b48-4c15-9f2e-7d0c5b83a614

Idempotency-KeyheaderstringoptionalOptional. Identifies one merge action. Repeating the request with the same value returns the first answer instead of acting again, even if the shipment changed since. The same value with a different request or another merge action is refused with 422 Idempotency.KeyReused. A request that failed stores nothing and may be repeated with the same value. Scoped to the account, and a repeat must carry the same X-SubAccount-Id as the first request. Maximum 200 characters.

Constraints: max length 200

Example: order-2026-09-07-0001

Request body (required)

application/json — AddOrderToShipmentRequest

{
  "orderId": "4c9b5bfa-99fd-457d-8ab5-5358c2bd3673"
}

Responses

StatusDescriptionBody
200The merged shipment and its orders, anchor first

application/json — MergedShipmentEnvelope

400The request could not be read as sent — for example an `X-SubAccount-Id` header that is not a GUID.

application/json — ErrorEnvelope

401Not authenticated

application/json — ErrorEnvelope

403Authenticated, but not with an Open API integration token. Sent without a body.No response body.
404The order was not found, or the shipment is not a merged shipment of this account (Shipment.NotMerged)

application/json — ErrorEnvelope

409Order.MergeRefused with the reason in metadata, Shipment.MergeHasActiveLabel, Shipment.MergePurchaseInProgress or Shipment.MergeChangedConcurrently

application/json — ErrorEnvelope

415The request was sent with a `Content-Type` other than `application/json`. Answered by middleware ahead of authentication, so it is reachable on every write operation.

application/json — ErrorEnvelope

422Invalid request, or Idempotency.KeyReused

application/json — ErrorEnvelope

500The request could not be completed because of an unexpected server-side failure.

application/json — ErrorEnvelope

POST /api/v1/shipments/{shipmentId}/unmerge

Take a merged shipment apart

Puts every order of the merged shipment back on the shipment it had before, with its own address and parcel. Allowed whatever the orders' status while no label covers the shipment and none is being bought. Taking apart a shipment that was already taken apart answers with an empty list.

Authentication: JWTBearerAuth, Bearer http, JWT

Parameters

NameInTypeRequiredDescription
shipmentIdpathstring (guid)required

Example: b91a2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d

X-SubAccount-Idheaderstring (uuid)optionalOptional. If present, the shipment must belong to this sub-account.

Example: 3a7d9e21-6b48-4c15-9f2e-7d0c5b83a614

Idempotency-KeyheaderstringoptionalOptional. Identifies one merge action. Repeating the request with the same value returns the first answer instead of acting again, even if the shipment changed since. The same value with a different request or another merge action is refused with 422 Idempotency.KeyReused. A request that failed stores nothing and may be repeated with the same value. Scoped to the account, and a repeat must carry the same X-SubAccount-Id as the first request. Maximum 200 characters.

Constraints: max length 200

Example: order-2026-09-07-0001

Responses

StatusDescriptionBody
200Each order and the shipment it is back on

application/json — UnmergeShipmentResponseEnvelope

400The request could not be read as sent — for example an `X-SubAccount-Id` header that is not a GUID.

application/json — ErrorEnvelope

401Not authenticated

application/json — ErrorEnvelope

403Authenticated, but not with an Open API integration token. Sent without a body.No response body.
404Not a merged shipment of this account (Shipment.NotMerged)

application/json — ErrorEnvelope

409Shipment.MergeHasActiveLabel, Shipment.MergePurchaseInProgress or Shipment.MergeChangedConcurrently

application/json — ErrorEnvelope

415The request was sent with a `Content-Type` other than `application/json`. Answered by middleware ahead of authentication, so it is reachable on every write operation.

application/json — ErrorEnvelope

422Invalid request, or Idempotency.KeyReused

application/json — ErrorEnvelope

500The request could not be completed because of an unexpected server-side failure.

application/json — ErrorEnvelope

POST /api/v1/shipments/{shipmentId}/rates

Get shipment rates

Gets shipping rate quotes from all available carriers for a shipment using a bearer token. For a merged shipment, rating is refused while another of its orders is cancelled, on hold, fulfilled or returned: the error keeps that refusal's own code and names the order in its metaData (orderId, orderNumber, reason).

Authentication: JWTBearerAuth, Bearer http, JWT

Parameters

NameInTypeRequiredDescription
shipmentIdpathstringrequired

Example: b91a2c3d-4e5f-6a7b-8c9d-0e1f2a3b4c5d

X-SubAccount-Idheaderstring (uuid)optionalOptional. Evaluates the request against the sub-account's carrier availability, which can narrow the carriers returned to those enabled for that sub-account. Does not change rate pricing, and does not restrict which shipments can be rated — that is enforced by account ownership alone.

Example: 3a7d9e21-6b48-4c15-9f2e-7d0c5b83a614

Responses

StatusDescriptionBody
200Rates retrieved successfully

application/json — GetRatesResponseEnvelope

400Invalid request

application/json — ErrorEnvelope

401Not authenticated

application/json — ErrorEnvelope

403Authenticated, but not with an Open API integration token. Sent without a body.No response body.
404Shipment not found

application/json — ErrorEnvelope

409Shipment.Superseded: a merge replaced this shipment, or the merged shipment was taken apart. Read the order again and rate its current shipment. Also `SubAccount.Inactive` when `X-SubAccount-Id` names an inactive sub-account

application/json — ErrorEnvelope

415The request was sent with a `Content-Type` other than `application/json`. Answered by middleware ahead of authentication, so it is reachable on every write operation.

application/json — ErrorEnvelope

422The shipment exists but is missing the address or parcel information rating needs

application/json — ErrorEnvelope

500The request could not be completed because of an unexpected server-side failure.

application/json — ErrorEnvelope

503The carrier is temporarily unavailable. Nothing to correct; retry later

application/json — ErrorEnvelope

Schemas

The public schemas that the operations above reference. Each is listed once; a type name in the tables above links to its fields here.

AddOrderToShipmentRequest

FieldTypeRequiredDescription
orderIdstring (guid)required

Format: guid

ApiError

One thing that went wrong.

FieldTypeRequiredDescription
codestringrequiredMachine-readable error identifier, dotted and stable — for example Order.NotFound. Branch on this rather than on message.
messagestringrequiredReadable explanation of the failure. Wording may change; do not parse it.
metaDataobject nullableoptionalExtra detail about this particular failure. Its shape depends on code.

CarrierRateResult

Public-contract mirror of CarrierRateResponse. Intentionally omits the nested Provider diagnostics object (raw upstream-carrier HTTP status and an opaque provider-specific "parameter" string): that is support's material, not the caller's. ErrorField is carried, because naming which field a carrier objected to is the difference between a caller highlighting one input and re-presenting the whole form.

FieldTypeRequiredDescription
carrierstringrequiredThe carrier that was asked for rates.
errorCodestring nullablerequiredMachine-readable reason the carrier returned no rates.
errorFieldstring nullablerequiredWhich part of the request the carrier objected to, from the shared field vocabulary — sender or recipient, address or phone. Null, not omitted, where the carrier names no field; direct UPS never does.
errorMessagestring nullablerequiredReadable explanation of why the carrier returned no rates.
successbooleanrequiredWhether that carrier returned rates.

ErrorEnvelope

The envelope every JSON operation answers with: a success flag and either a result or errors.

FieldTypeRequiredDescription
dataobject nullablerequiredThe operation's result. Absent when the call failed.
errorsApiError[]requiredWhat went wrong. Absent when the call succeeded.
successbooleanrequiredWhether the operation succeeded. When false, read errors.

GetRatesResponse

The shipping options available for a shipment, and how each carrier answered.

FieldTypeRequiredDescription
carrierCountinteger (int32)requiredNumber of carriers that returned at least one rate.

Format: int32

carrierResponsesCarrierRateResult[]requiredOne entry per carrier that was asked, including the ones that returned nothing, so a carrier that declined can be told apart from a carrier that was never contacted.
ratesRateQuote[]requiredEvery rate available for the shipment, across all carriers that answered. Buy one by sending its id to the label operation.
totalCountinteger (int32)requiredNumber of entries in rates.

Format: int32

GetRatesResponseEnvelope

The envelope every JSON operation answers with: a success flag and either a result or errors.

FieldTypeRequiredDescription
dataGetRatesResponse nullablerequiredThe operation's result. Absent when the call failed.
errorsApiError[] nullablerequiredWhat went wrong. Absent when the call succeeded.
successbooleanrequiredWhether the operation succeeded. When false, read errors.

MergedShipment

A merged shipment and its orders, anchor first.

FieldTypeRequiredDescription
orderIdsstring[]required
shipmentIdstring (guid)required

Format: guid

MergedShipmentEnvelope

The envelope every JSON operation answers with: a success flag and either a result or errors.

FieldTypeRequiredDescription
dataMergedShipment nullablerequiredThe operation's result. Absent when the call failed.
errorsApiError[] nullablerequiredWhat went wrong. Absent when the call succeeded.
successbooleanrequiredWhether the operation succeeded. When false, read errors.

MergeOrdersRequest

FieldTypeRequiredDescription
anchorOrderIdstring (guid)requiredThe order the merge starts from; its addresses are copied onto the merged shipment.

Format: guid

orderIdsstring[]requiredEvery order to merge, the anchor included: from 2 to 25.
parcelOrderParcelRequest nullableoptionalThe box. When omitted it has the anchor's size and the orders' weights added together.

OrderAddressRequest

A postal address supplied on an order.

FieldTypeRequiredDescription
carrierFacilitystring nullableoptionalCarrier facility this address refers to, when the shipment is dropped at or collected from a named facility rather than the street address.
citystringrequiredCity or locality.

Constraints: min length 1

companystring nullableoptionalCompany name at the address.
countrystringrequiredTwo-letter ISO 3166-1 alpha-2 country code, for example US.

Constraints: min length 1

emailstring nullableoptionalContact email address.
federalTaxIdstring nullableoptionalFederal tax identifier of the party at this address, used on customs paperwork for international shipments.
namestring nullableoptionalContact name at the address.
phonestringrequiredContact phone number. FedEx and DHL reject shipments whose addresses carry no phone number, so supply one whenever those carriers may be used.

Constraints: min length 1

residentialboolean nullableoptionalWhether the address is residential. Carriers price residential delivery differently, so an incorrect value can change the rates you are quoted.
statestringrequiredState, province or region. For US addresses, the two-letter state code.

Constraints: min length 1

stateTaxIdstring nullableoptionalState tax identifier of the party at this address, used on customs paperwork for international shipments.
street1stringrequiredFirst street line — house or building number and street.

Constraints: min length 1

street2string nullableoptionalSecond street line: apartment, suite, unit or floor.
zipstringrequiredPostal or ZIP code.

Constraints: min length 1

OrderParcelRequest

The physical package. Give explicit dimensions, or name a carrier predefinedPackage.

FieldTypeRequiredDescription
heightnumber (decimal) nullableoptionalShortest side of the package, in inches.

Format: decimal

lengthnumber (decimal) nullableoptionalLongest side of the package, in inches. Supply length, width and height together, or supply predefinedPackage instead. Dimensions are sent to every carrier in inches.

Format: decimal

predefinedPackagestring nullableoptionalCarrier-defined packaging to use instead of explicit dimensions, for example a flat-rate box. The accepted values depend on the carrier.
weightnumber (decimal)requiredPackage weight in pounds.

Format: decimal

widthnumber (decimal) nullableoptionalSecond-longest side of the package, in inches.

Format: decimal

RateQuote

One priced shipping option for a package: which carrier and service, what it costs and how fast it is expected to be. Returned by the rate and combined create-and-rate operations.

FieldTypeRequiredDescription
billingTypestring nullablerequiredHow the carrier bills this rate, in the carrier's own vocabulary.
carrierstringrequiredThe carrier offering the rate, for example USPS or UPS.
carrierCodestring nullablerequiredThe carrier's own account or brand code, when the carrier supplies one.
currencystringrequiredCurrency of rate, as an ISO 4217 three-letter code. The set of codes a carrier may return is not constrained by this contract.
deliveryDateGuaranteedbooleanrequiredWhether the carrier guarantees the delivery date rather than estimating it.
deliveryDaysinteger (int32)requiredCarrier-supplied transit estimate, in days. This is not a commitment: every carrier integration fills deliveryDays and estDeliveryDays from one quantity, so the two always carry the same number on a given rate. 0 means the carrier supplied no transit time for this rate, not same-day delivery. The day basis is the carrier's own — UPS reports business days in transit, USPS a span derived from its quoted delivery window — so do not compare the number across carriers. Read deliveryDateGuaranteed for whether anything is guaranteed.

Format: int32

destinationEntryFacilityTypestring nullablerequiredUSPS destination entry facility the price assumes, when the carrier is USPS.
estDeliveryDaysinteger (int32)requiredCarrier-supplied transit estimate, in days. Currently always equal to deliveryDays: both are filled from the same carrier quantity on every integration, and neither is a separate estimated-versus-committed figure. 0 means the carrier supplied no transit time.

Format: int32

estimatedDeliveryDatestring (date-time) nullablerequiredDate the carrier expects to deliver on. null when the carrier supplied no date, which is the common case for carriers that report transit days instead. The label-purchase response republishes this same value under the name selectedRate.deliveryDate.

Format: date-time

idstring (guid) nullablerequiredIdentifier of this rate. Send it as rate.id to the label operation to buy this exact option; a rate cannot be reconstructed from its other fields.

Format: guid

listCurrencystring nullablerequiredCurrency of listRate, as an ISO 4217 three-letter code.
listRatenumber (decimal) nullablerequiredThe carrier's published list price for the same service, when the carrier publishes one. Like retailRate, a comparison figure rather than the charged amount.

Format: decimal

mailClassstring nullablerequiredUSPS mail class for the rate, when the carrier is USPS.
processingCategorystring nullablerequiredUSPS processing category for the package, when the carrier is USPS.
ratenumber (decimal)requiredThe amount your account is charged if this rate is bought.

Format: decimal

rateIndicatorstring nullablerequiredUSPS rate indicator describing how the price was derived, when the carrier is USPS.
retailCurrencystring nullablerequiredCurrency of retailRate, as an ISO 4217 three-letter code.
retailRatenumber (decimal) nullablerequiredThe carrier's over-the-counter retail price for the same service, when the carrier publishes one. It is a comparison figure, not what you are charged.

Format: decimal

serviceCodestringrequiredThe carrier's own code for the service, for example GroundAdvantage. This is the machine value; serviceName is the readable one.
serviceNamestringrequiredReadable name of the service, for example USPS Ground Advantage. Suitable for display; match on serviceCode rather than on this.
skustring nullablerequiredThe carrier's own product code for this rate, when it supplies one.
zonestring nullablerequiredCarrier delivery zone between origin and destination, when the carrier reports one.

UnmergedOrder

FieldTypeRequiredDescription
orderIdstring (guid)required

Format: guid

shipmentIdstring (guid)required

Format: guid

UnmergeShipmentResponse

FieldTypeRequiredDescription
ordersUnmergedOrder[]requiredEach order and the shipment it is back on. Empty when the shipment was already taken apart.

UnmergeShipmentResponseEnvelope

The envelope every JSON operation answers with: a success flag and either a result or errors.

FieldTypeRequiredDescription
dataUnmergeShipmentResponse nullablerequiredThe operation's result. Absent when the call failed.
errorsApiError[] nullablerequiredWhat went wrong. Absent when the call succeeded.
successbooleanrequiredWhether the operation succeeded. When false, read errors.

UpdateMergedShipmentRequest

Required: one of these field sets — toAddress; or parcel.

FieldTypeRequiredDescription
parcelOrderParcelRequest nullableoptionalThe new box; unchanged when omitted.
toAddressOrderAddressRequest nullableoptionalThe new recipient address, in the shape orders are created with; unchanged when omitted.