MailHub
Close menu
API Docs

Overview

Partner integration surface for programmatic access to MailHub's order and shipment management platform.

Base URL & Versioning

Base URLhttps://api.example.com/api
Versionv1
Content-Typeapplication/json (all endpoints unless noted)

All paths in this documentation are relative to the base URL. For example, POST /v1/auth/token means POST https://api.example.com/api/v1/auth/token.

Quick Start

Step 1 — Get your API key from the MailHub partner dashboard.

Step 2 — Authenticate. Exchange your API key for a Bearer token:

curl -X POST https://api.example.com/api/v1/auth/token \
  -H "Content-Type: application/json" \
  -d '{"apiKey": "your_api_key_here"}'

Step 3 — Make requests using the accessToken from the response:

curl -X POST https://api.example.com/api/v1/orders \
  -H "Authorization: Bearer <accessToken>" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

Endpoint Overview

Authentication

MethodPathDescriptionAuth
POST /v1/auth/tokenLogin — exchange API key for tokensAPI Key
POST /v1/auth/token/refreshRefresh an expired access tokenRefresh Token
POST /v1/auth/token/revokeRevoke a refresh token (logout)Refresh Token

Orders

MethodPathDescriptionAuth
POST /v1/ordersCreate an orderBearer
PATCH /v1/orders/{orderId}/statusUpdate order statusBearer
GET /v1/ordersList orders (paginated, filterable)Bearer
GET /v1/orders/{orderId}Get a single order by IDBearer

V2 Orders

MethodPathDescriptionAuth
POST /v2/ordersCreate an order and return shipment ratesBearer

Shipments

MethodPathDescriptionAuth
POST /v1/shipments/{shipmentId}/ratesGet carrier rate quotesBearer
POST /v1/shipments/{shipmentId}/labelsBuy a shipping labelBearer

Labels

MethodPathDescriptionAuth
GET /v1/labels/{labelId}/downloadDownload label file (PDF/ZPL/EPL2)Bearer
DELETE /v1/labels/{labelId}Cancel (void) a labelBearer

Typical Integration Flow

1. Authenticate
   POST /v1/auth/token  →  receive accessToken + refreshToken

2. Create order
   POST /v1/orders  →  receive orderId + shipmentId
                        (order status: Created)

3. Update order status to Packed
   PATCH /v1/orders/{orderId}/status  →  set status to 7 (Packed)
   ⚠️  Order must be in Packed status before you can get rates or buy labels.

4. Get rates
   POST /v1/shipments/{shipmentId}/rates  →  compare carrier quotes

5. Buy label
   POST /v1/shipments/{shipmentId}/labels  →  receive labelId + trackingCode

6. Download label
   GET /v1/labels/{labelId}/download  →  print and ship

7. Update order status to Fulfilled
   PATCH /v1/orders/{orderId}/status  →  set status to 4 (Fulfilled)

   If needed: cancel the label before shipping
   DELETE /v1/labels/{labelId}  →  void the label

Alternative — Create with rates (V2): If you want to create an order and fetch its shipment rates in a single call, use POST /v2/orders instead of steps 2 and 4. It creates the order and returns the rates per shipment in one response. See the V2 Orders section for details.

Optional Headers

HeaderTypeDescription
X-SubAccount-Iduuid Optional. Scopes the request to a specific sub-account. When omitted, the request operates at the account level.

See the Sub-Accounts section for full details.

General Notes

  • All timestamps are UTC in ISO 8601 format (e.g. 2026-04-02T19:30:00Z).
  • All resource identifiers are UUIDs.
  • Rate and price values are returned as decimals. The rate field in the selectedRate object on the Buy Label response is returned as a string to preserve formatting.
  • The /v1 API does not support batch operations — one order per request. Use /v2/orders to create an order and fetch its rates together.
  • Request and response bodies use camelCase field names.