REST API · Guide
Stores
Connect an online store and its orders come into ParcelHub ready to ship. When you buy a label for an imported order, ParcelHub marks the order shipped in the store with the tracking number, so you don't have to.
1. See what can be connected
curl -s https://api.parcelhub.ca/v1/integrations -H "Authorization: Bearer $TOKEN"
# → channels: the platforms you can connect, each with how it connects
# ("oauth", or "api_key" with the fields it needs) and whether it's available
# → connections: stores already connected, with their id and sync status 2. Connect a store
# Platforms that use a sign-in (e.g. Shopify): get a link for the store owner to approve
curl -s https://api.parcelhub.ca/v1/integrations/connect -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{"channel":"shopify","shop":"your-store.myshopify.com"}'
# → data.connect_url
# Platforms that use API keys (e.g. WooCommerce, Wix): send that platform's fields
curl -s https://api.parcelhub.ca/v1/integrations/connect-api-key -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{
"channel": "woocommerce",
"fields": { … the fields GET /v1/integrations lists for this channel … }
}' Store keys are passed on to connect the store and are not shown again. Most people connect from the dashboard instead, at my.parcelhub.ca/integrations; the API works the same either way.
3. Get orders
Connected stores sync on their own every 15–20 minutes, and Shopify and WooCommerce also tell us about new orders as they come in. To fetch now:
# Ask for the latest orders now (runs in the background)
curl -s -X POST https://api.parcelhub.ca/v1/integrations/connections/$CONNECTION/sync -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{}'
# Orders, newest first; page with next_cursor
curl -s "https://api.parcelhub.ca/v1/integrations/orders?connection_id=$CONNECTION&status=unfulfilled" -H "Authorization: Bearer $TOKEN"
curl -s https://api.parcelhub.ca/v1/integrations/orders/$ORDER -H "Authorization: Bearer $TOKEN" Each order says whether it was already imported. Before importing orders from your own files or system, POST /v1/imports/lookup with their order ids tells you which ones this account already has.
4. Import orders and ship them
curl -s https://api.parcelhub.ca/v1/integrations/import -H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' -d '{
"connection_id": "<connection id>",
"external_order_ids": ["<order id from /v1/integrations/orders>", "…"]
}'
# → one shipment draft per order. Then for each draft:
# POST /v1/rates with its addresses and packages → PATCH the chosen rate → POST /v1/shipments/draft/{id}/process Importing never buys anything. Drafts from a store join that store's own batch when
their labels are bought, unless you pass a batch_id. See drafts for the
buy step.
Disconnect
DELETE /v1/integrations/connections/{id} stops syncing. Shipments already made are kept.