Partner API
OpenAPI JSONIntegrate GB Cargo into your own system: quotes, orders, tracking, ledger. Money is always an integer number of pence (GBP). Error codes, statuses and scopes are language-independent.
Quick start
- Ask us for an API key (looks like gbk_...), issued with specific scopes and tied to your partner account.
- Send the key in the header
Authorization: Bearer gbk_.... Never put the key in public code or a browser. - Add
?lang=vior headerAccept-Language: vifor Vietnamese messages.
Check your key
curl https://cargo.gbglobal.trade/api/v1/me \ -H "Authorization: Bearer gbk_xxxxxxxx"
Get a quote
curl -X POST https://cargo.gbglobal.trade/api/v1/quotes \
-H "Authorization: Bearer gbk_xxxxxxxx" \
-H "Content-Type: application/json" \
-d '{"route":"UK_VN_HN","parcels":[{"kg":12.5,"l_cm":50,"w_cm":40,"h_cm":30}]}'
Create an order (safe to retry)
curl -X POST https://cargo.gbglobal.trade/api/v1/orders \
-H "Authorization: Bearer gbk_xxxxxxxx" \
-H "Idempotency-Key: order-2026-0001" \
-H "Content-Type: application/json" \
-d '{"route":"UK_VN_HN","parcels":[...],"sender":{...},"receiver":{...},
"ack_prohibited":true,"external_ref":"PO-0001","confirm":true,"payment_method":"on_account"}'
Same Idempotency-Key and body: you get the first response back (48 h). Same key with a different body: 422.
Scopes
A key only has the scopes granted to it. A missing scope returns 403 insufficient_scope.
| Scope | Allows |
|---|---|
rates:read | Read rates |
quotes:write | Price a shipment |
tracking:read | Look up tracking |
tracking:write | Post status updates (carriers) |
orders:read | Read own orders |
orders:write | Create/edit/cancel/confirm orders |
payments:read | Read payments |
payments:write | Report payments |
addresses:rw | Address book |
ledger:read | Read balance and statement |
webhooks:rw | Manage webhooks |
batches:rw | Batches |
Endpoints
System 2
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /openapi.json | OpenAPI 3 document. Public copy omits admin/staff endpoints; send a valid Bearer key with an admin:/staff: scope for the full document | none |
| GET | /me | Describe the calling API key (scopes, partner, expiry, limits) | none |
Rates 1
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /rates | Current published rates for all routes | rates:read |
Quotes 1
| Method | Path | Summary | Scope |
|---|---|---|---|
| POST | /quotes | Price a shipment (no order is created) | quotes:write |
Tracking 4
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /tracking/{code} | Public tracking (6 milestones) for a GBT-... code | tracking:read |
| POST | /tracking/search | Look up up to 50 tracking codes at once | tracking:read |
| POST | /tracking/updates | Carrier pushes a status update (same rules as POST /api/v1/partner/status) | tracking:write |
| POST | /partner/status | LEGACY carrier status update (kept for existing integrations; prefer POST /tracking/updates) | tracking:write |
Orders 7
| Method | Path | Summary | Scope |
|---|---|---|---|
| POST | /orders | Create an order (optionally confirm it; on-account accounts are charged to the ledger) | orders:write |
| GET | /orders | List own orders (cursor pagination, limit <= 200; filters status, route, from, to, q) | orders:read |
| GET | /orders/{id} | Order detail by numeric id or code GBG-... | orders:read |
| PATCH | /orders/{id} | Edit a DRAFT order (partial update) | orders:write |
| DELETE | /orders/{id} | Delete a DRAFT order | orders:write |
| POST | /orders/{id}/confirm | Confirm a draft (on_account: ledger debit, blocked above credit limit) | orders:write |
| POST | /orders/{id}/cancel | Cancel an order that has not been received yet (ledger charges are credited back) | orders:write |
Payments 3
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /orders/{id}/payments | Payments, amount outstanding and bank transfer details of an order | payments:read |
| POST | /orders/{id}/payments/report | Report that the bank transfer has been made | payments:write |
| POST | /orders/{id}/payments/card | Start a hosted card checkout; returns the URL to pay | payments:write |
Addresses 5
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /addresses | List saved addresses | addresses:rw |
| POST | /addresses | Save an address | addresses:rw |
| GET | /addresses/{id} | Get an address | addresses:rw |
| PUT | /addresses/{id} | Update an address | addresses:rw |
| DELETE | /addresses/{id} | Delete an address | addresses:rw |
Ledger 2
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /ledger | Own balance, credit limit and ageing (0-30 / 31-60 / 60+ days) | ledger:read |
| GET | /ledger/statement | Own statement (date filter, cursor; format=csv needs from+to) | ledger:read |
Batches 7
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /batches | List batches (latest 100) | batches:rw |
| POST | /batches | Create a batch | batches:rw |
| GET | /batches/{id} | Batch with its orders | batches:rw |
| PATCH | /batches/{id} | Rename / change note | batches:rw |
| DELETE | /batches/{id} | Delete an EMPTY batch | batches:rw |
| POST | /batches/{id}/orders | Add orders by code (GBG-..., GBT-... or partner tracking) | batches:rw |
| POST | /batches/{id}/status | Move every order in the batch to a status (per-order result) | batches:rw |
Webhooks 9
| Method | Path | Summary | Scope |
|---|---|---|---|
| GET | /webhooks | List own webhook endpoints | webhooks:rw |
| POST | /webhooks | Register an https endpoint; the signing secret is shown once | webhooks:rw |
| GET | /webhooks/{id} | Endpoint detail | webhooks:rw |
| PATCH | /webhooks/{id} | Update url / events / name / active | webhooks:rw |
| DELETE | /webhooks/{id} | Delete an endpoint and its history | webhooks:rw |
| POST | /webhooks/{id}/rotate-secret | Issue a new signing secret (shown once) | webhooks:rw |
| POST | /webhooks/{id}/test | Queue a webhook.ping delivery | webhooks:rw |
| GET | /webhooks/{id}/deliveries | Delivery history (cursor) | webhooks:rw |
| POST | /webhooks/{id}/deliveries/{did}/redeliver | Send a past delivery again | webhooks:rw |
Full request/response schemas: OpenAPI JSON.
Webhook
We POST JSON to your https URL. Verify the header X-GB-Signature: t=<unix>,v1=<hex> = HMAC-SHA256(secret, t + "." + rawBody). Reply 2xx within 10 s or it is retried.
order.createdOrder confirmed/submitted. data: { order }order.status_changeddata: { order, from, to }order.cancelleddata: { order }payment.receiveddata: { order, payment }ledger.entrydata: { entry, balance_pence, credit_limit_pence }
Error codes
Errors look like {"ok":false,"error":"code","message":"...","request_id":"..."}. Branch on error, not on message.
| HTTP | Code | Meaning |
|---|---|---|
| 400 | bad_amount | Invalid amount: it must be a positive number (web forms and CSV: pounds, e.g. 12.50; API: whole pence, e.g. 1250). |
| 400 | bad_credit_limit | Invalid credit limit. |
| 400 | bad_cursor | Invalid cursor. |
| 400 | bad_date | Invalid date. Use DD/MM/YYYY or YYYY-MM-DD (the API accepts YYYY-MM-DD only). |
| 400 | bad_events | Unknown webhook event. |
| 400 | bad_expires_at | expires_at must be a future time. |
| 400 | bad_idempotency_key | Idempotency-Key must be 8-120 printable characters. |
| 400 | bad_ip_allowlist | Invalid IP allowlist. |
| 400 | bad_json | Request body is not valid JSON. |
| 400 | bad_kind | Type must be deposit or withdrawal. |
| 400 | bad_limit | limit must be an integer between 1 and 200. |
| 400 | bad_payment_method | payment_method must be on_account or bank. |
| 400 | bad_prohibited | Invalid prohibited item (VI and EN labels required). |
| 400 | bad_request | Invalid request. |
| 400 | bad_scopes | Invalid scope list. |
| 400 | bad_status | Unknown status code. |
| 400 | bad_surcharge | Invalid surcharge. |
| 400 | bad_terms_days | terms_days must be 0-365. |
| 400 | bad_webhook_url | Webhook URL must be a public https URL. |
| 400 | idempotency_key_required | Idempotency-Key header is required for this request. |
| 400 | invalid_occurred_at | occurred_at is invalid. |
| 400 | invalid_status | Unknown status. |
| 400 | ip_allowlist_required | Admin/staff API keys must have an ip_allowlist. |
| 400 | name_required | name is required. |
| 400 | note_required | A note is required for adjustments. |
| 400 | too_many_codes | At most 50 codes per request. |
| 400 | tracking_code_required | tracking_code is required. |
| 400 | unknown_route | Unknown route. |
| 401 | api_key_expired | API key has expired. |
| 401 | invalid_api_key | Missing or invalid API key. |
| 402 | credit_limit_exceeded | The order would exceed the account credit limit. |
| 403 | email_not_verified | The owner account email is not verified. |
| 403 | insufficient_scope | The API key lacks the required scope. |
| 403 | ip_not_allowed | Request IP is not in the key allowlist. |
| 403 | partner_inactive | Partner account is disabled. |
| 403 | partner_required | This key is not linked to a partner. |
| 404 | not_found | Resource not found. |
| 404 | partner_not_found | Partner not found or inactive. |
| 404 | unknown_tracking_code | Unknown tracking code. |
| 409 | batch_not_empty | The batch still contains orders. |
| 409 | cannot_cancel | The order can no longer be cancelled online. |
| 409 | card_disabled | Card payment is not enabled. |
| 409 | conflict | The resource was just updated elsewhere. |
| 409 | exists | Already exists. |
| 409 | idempotency_in_progress | A request with this Idempotency-Key is still being processed. |
| 409 | invalid_transition | Invalid status change. |
| 409 | ledger_inactive | On-account billing is not enabled for this account. |
| 409 | no_balance_due | No balance due. |
| 409 | not_editable | The order can no longer be edited. |
| 409 | not_payable | The payment is no longer pending. |
| 409 | not_payable_order | The order cannot accept payment now. |
| 409 | not_receivable | Order is not at the warehouse yet. |
| 409 | nothing_due | Nothing left to pay. |
| 409 | order_not_payable | The order cannot accept payment now. |
| 409 | partner_has_no_account | This partner has no login account; ledger needs one. |
| 409 | partner_user_mismatch | The order belongs to a different account than this partner. |
| 409 | payment_required | Payment must be received first. |
| 409 | too_many_addresses | Address book is full (50). |
| 409 | user_already_partner | That account is already a partner. |
| 409 | user_not_customer | That email belongs to a staff/admin account. |
| 409 | webhook_limit_reached | Webhook limit reached (5 endpoints per partner). Delete one first. |
| 409 | weigh_required | Weigh first. |
| 413 | export_too_large | The export is above the row limit; choose a shorter date range. |
| 422 | idempotency_key_reuse | Idempotency-Key was already used with a different request. |
| 422 | incomplete | The order is incomplete. |
| 429 | rate_limited | Too many requests. |
| 500 | server_error | Internal error. |
| 502 | card_unavailable | Card payment is unavailable right now. |