Partner API

OpenAPI JSON

Integrate 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

  1. Ask us for an API key (looks like gbk_...), issued with specific scopes and tied to your partner account.
  2. Send the key in the header Authorization: Bearer gbk_.... Never put the key in public code or a browser.
  3. Add ?lang=vi or header Accept-Language: vi for 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.

ScopeAllows
rates:readRead rates
quotes:writePrice a shipment
tracking:readLook up tracking
tracking:writePost status updates (carriers)
orders:readRead own orders
orders:writeCreate/edit/cancel/confirm orders
payments:readRead payments
payments:writeReport payments
addresses:rwAddress book
ledger:readRead balance and statement
webhooks:rwManage webhooks
batches:rwBatches

Endpoints

System 2
MethodPathSummaryScope
GET/openapi.jsonOpenAPI 3 document. Public copy omits admin/staff endpoints; send a valid Bearer key with an admin:/staff: scope for the full documentnone
GET/meDescribe the calling API key (scopes, partner, expiry, limits)none
Rates 1
MethodPathSummaryScope
GET/ratesCurrent published rates for all routesrates:read
Quotes 1
MethodPathSummaryScope
POST/quotesPrice a shipment (no order is created)quotes:write
Tracking 4
MethodPathSummaryScope
GET/tracking/{code}Public tracking (6 milestones) for a GBT-... codetracking:read
POST/tracking/searchLook up up to 50 tracking codes at oncetracking:read
POST/tracking/updatesCarrier pushes a status update (same rules as POST /api/v1/partner/status)tracking:write
POST/partner/statusLEGACY carrier status update (kept for existing integrations; prefer POST /tracking/updates)tracking:write
Orders 7
MethodPathSummaryScope
POST/ordersCreate an order (optionally confirm it; on-account accounts are charged to the ledger)orders:write
GET/ordersList 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 orderorders:write
POST/orders/{id}/confirmConfirm a draft (on_account: ledger debit, blocked above credit limit)orders:write
POST/orders/{id}/cancelCancel an order that has not been received yet (ledger charges are credited back)orders:write
Payments 3
MethodPathSummaryScope
GET/orders/{id}/paymentsPayments, amount outstanding and bank transfer details of an orderpayments:read
POST/orders/{id}/payments/reportReport that the bank transfer has been madepayments:write
POST/orders/{id}/payments/cardStart a hosted card checkout; returns the URL to paypayments:write
Addresses 5
MethodPathSummaryScope
GET/addressesList saved addressesaddresses:rw
POST/addressesSave an addressaddresses:rw
GET/addresses/{id}Get an addressaddresses:rw
PUT/addresses/{id}Update an addressaddresses:rw
DELETE/addresses/{id}Delete an addressaddresses:rw
Ledger 2
MethodPathSummaryScope
GET/ledgerOwn balance, credit limit and ageing (0-30 / 31-60 / 60+ days)ledger:read
GET/ledger/statementOwn statement (date filter, cursor; format=csv needs from+to)ledger:read
Batches 7
MethodPathSummaryScope
GET/batchesList batches (latest 100)batches:rw
POST/batchesCreate a batchbatches:rw
GET/batches/{id}Batch with its ordersbatches:rw
PATCH/batches/{id}Rename / change notebatches:rw
DELETE/batches/{id}Delete an EMPTY batchbatches:rw
POST/batches/{id}/ordersAdd orders by code (GBG-..., GBT-... or partner tracking)batches:rw
POST/batches/{id}/statusMove every order in the batch to a status (per-order result)batches:rw
Webhooks 9
MethodPathSummaryScope
GET/webhooksList own webhook endpointswebhooks:rw
POST/webhooksRegister an https endpoint; the signing secret is shown oncewebhooks:rw
GET/webhooks/{id}Endpoint detailwebhooks:rw
PATCH/webhooks/{id}Update url / events / name / activewebhooks:rw
DELETE/webhooks/{id}Delete an endpoint and its historywebhooks:rw
POST/webhooks/{id}/rotate-secretIssue a new signing secret (shown once)webhooks:rw
POST/webhooks/{id}/testQueue a webhook.ping deliverywebhooks:rw
GET/webhooks/{id}/deliveriesDelivery history (cursor)webhooks:rw
POST/webhooks/{id}/deliveries/{did}/redeliverSend a past delivery againwebhooks: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.created Order confirmed/submitted. data: { order }
  • order.status_changed data: { order, from, to }
  • order.cancelled data: { order }
  • payment.received data: { order, payment }
  • ledger.entry data: { entry, balance_pence, credit_limit_pence }

Error codes

Errors look like {"ok":false,"error":"code","message":"...","request_id":"..."}. Branch on error, not on message.

HTTPCodeMeaning
400bad_amountInvalid amount: it must be a positive number (web forms and CSV: pounds, e.g. 12.50; API: whole pence, e.g. 1250).
400bad_credit_limitInvalid credit limit.
400bad_cursorInvalid cursor.
400bad_dateInvalid date. Use DD/MM/YYYY or YYYY-MM-DD (the API accepts YYYY-MM-DD only).
400bad_eventsUnknown webhook event.
400bad_expires_atexpires_at must be a future time.
400bad_idempotency_keyIdempotency-Key must be 8-120 printable characters.
400bad_ip_allowlistInvalid IP allowlist.
400bad_jsonRequest body is not valid JSON.
400bad_kindType must be deposit or withdrawal.
400bad_limitlimit must be an integer between 1 and 200.
400bad_payment_methodpayment_method must be on_account or bank.
400bad_prohibitedInvalid prohibited item (VI and EN labels required).
400bad_requestInvalid request.
400bad_scopesInvalid scope list.
400bad_statusUnknown status code.
400bad_surchargeInvalid surcharge.
400bad_terms_daysterms_days must be 0-365.
400bad_webhook_urlWebhook URL must be a public https URL.
400idempotency_key_requiredIdempotency-Key header is required for this request.
400invalid_occurred_atoccurred_at is invalid.
400invalid_statusUnknown status.
400ip_allowlist_requiredAdmin/staff API keys must have an ip_allowlist.
400name_requiredname is required.
400note_requiredA note is required for adjustments.
400too_many_codesAt most 50 codes per request.
400tracking_code_requiredtracking_code is required.
400unknown_routeUnknown route.
401api_key_expiredAPI key has expired.
401invalid_api_keyMissing or invalid API key.
402credit_limit_exceededThe order would exceed the account credit limit.
403email_not_verifiedThe owner account email is not verified.
403insufficient_scopeThe API key lacks the required scope.
403ip_not_allowedRequest IP is not in the key allowlist.
403partner_inactivePartner account is disabled.
403partner_requiredThis key is not linked to a partner.
404not_foundResource not found.
404partner_not_foundPartner not found or inactive.
404unknown_tracking_codeUnknown tracking code.
409batch_not_emptyThe batch still contains orders.
409cannot_cancelThe order can no longer be cancelled online.
409card_disabledCard payment is not enabled.
409conflictThe resource was just updated elsewhere.
409existsAlready exists.
409idempotency_in_progressA request with this Idempotency-Key is still being processed.
409invalid_transitionInvalid status change.
409ledger_inactiveOn-account billing is not enabled for this account.
409no_balance_dueNo balance due.
409not_editableThe order can no longer be edited.
409not_payableThe payment is no longer pending.
409not_payable_orderThe order cannot accept payment now.
409not_receivableOrder is not at the warehouse yet.
409nothing_dueNothing left to pay.
409order_not_payableThe order cannot accept payment now.
409partner_has_no_accountThis partner has no login account; ledger needs one.
409partner_user_mismatchThe order belongs to a different account than this partner.
409payment_requiredPayment must be received first.
409too_many_addressesAddress book is full (50).
409user_already_partnerThat account is already a partner.
409user_not_customerThat email belongs to a staff/admin account.
409webhook_limit_reachedWebhook limit reached (5 endpoints per partner). Delete one first.
409weigh_requiredWeigh first.
413export_too_largeThe export is above the row limit; choose a shorter date range.
422idempotency_key_reuseIdempotency-Key was already used with a different request.
422incompleteThe order is incomplete.
429rate_limitedToo many requests.
500server_errorInternal error.
502card_unavailableCard payment is unavailable right now.