Developers
Integrate Turkey & China → Africa shipping into your store or backend. Authenticate with X-API-Key, create orders, pull rates, and track freight under /api/v1.
Endpoint
https://bagster.io/api/v1
All partner routes live under /api/v1/*. There is no /api/v2 today. Unversioned admin routes are not for partner integrations.
Auth
Send your API key on every partner request via the X-API-Key header. Bearer tokens are for Supabase user sessions (carrier dashboard / org seats), not for API keys.
yk_live_… — production keysyk_test_… — sandbox keys (sandbox carriers only)bgst_… — legacy prefix (still accepted)curl -H "X-API-Key: yk_live_…" \ "https://bagster.io/api/v1/carriers/quote?origin_country=Turkey&destination_country=Nigeria&weight_kg=5"
Keys are issued by Bagster ops (Admin → API keys). Treat them like passwords; rotate if exposed.
Reliability
Pass Idempotency-Key (UUID recommended) so retries do not double-create work.
/orders/create, /shipments, update-statuscurl -X POST "https://bagster.io/api/v1/orders/cancel" \
-H "X-API-Key: yk_live_…" \
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000" \
-H "Content-Type: application/json" \
-d '{ "tracking_number": "BGT-…", "reason": "Customer cancelled" }'Orders
/orders/createOrigin must be Turkey or China when provided. Destination must be an African country name supported by the platform. Provide weight_kg or packages[] with positive weight.
Required body
destination_countryAfrican destination (e.g. Nigeria)customer_nameRecipient namecustomer_phoneRecipient phonecustomer_addressDelivery addressweight_kg | packages[]Positive weight (kg)Optional
origin_country, carrier_id, service_tier, order_reference, external_reference_id, tracking_pin, dimensions, HS code, declared value, delivery instructions, quote_id.
curl -X POST "https://bagster.io/api/v1/orders/create" \
-H "X-API-Key: yk_live_…" \
-H "Content-Type: application/json" \
-H "Idempotency-Key: $(uuidgen)" \
-d '{
"origin_country": "Turkey",
"destination_country": "Nigeria",
"weight_kg": 5,
"customer_name": "Ada Okonkwo",
"customer_phone": "+234…",
"customer_address": "Lagos, Nigeria",
"order_reference": "ORD-12345"
}'There is no POST /api/v1/orders alias — use /orders/create.
Rates
/carriers/quoteQuery parameters (all required): origin_country, destination_country, weight_kg.
GET /api/v1/carriers/quote?origin_country=Turkey&destination_country=Nigeria&weight_kg=5
Response includes quotes[] with carrier_id, name, price_per_kg, total_price, estimated_days, and markup_rate when applicable. For structured address-based rating use POST /rates.
Tracking
/tracking/{trackingNumber}Partner machine tracking requires your API key. Envelope shape: { success, data }. You can also use GET /orders/{tracking_number}.
Recipients use the public page /track with optional PIN unlock for PII via /api/public/track-unlock. There is no unauthenticated /api/v1/track/… route.
curl -H "X-API-Key: yk_live_…" \ "https://bagster.io/api/v1/tracking/BGT-ABC123XYZ"
Lifecycle
pendingCreated; awaiting assignmentassignedCarrier assignedpackage_receivedCarrier received the packagein_transitMoving on the corridordelivery_failedDelivery attempt faileddeliveredDelivered to recipientreturnedReturned / reverse logisticscompletedClosed after delivery workflowcancelledCancelledEvents
Outbound webhooks are configured on your API key (URL + signing secret). Payloads are signed with X-Webhook-Signature: sha256=<hex>. Monitor delivery via GET /webhooks/health or Partner → Webhooks health.
There is no POST /webhooks registration endpoint. Store intake uses connector routes (Shopify / WooCommerce HMAC) and /webhooks/inbound for registered partners.
Typical outbound events include order.created, order.assigned, order.status_changed, order.delivered, order.cancelled.
Payments
Bagster settles carrier payouts and partner invoicing through the admin payments desk (manual operator action). Partner APIs do not move funds.
POST /payments/retry returns 410 GoneSee /reliability for the honest production surface.
Index
| Method | Path | Purpose | Idempotency |
|---|---|---|---|
| POST | /api/v1/orders/create | Create a shipment with automatic carrier assignment | Optional |
| POST | /api/v1/orders/bulk-create | Create many orders in one request | Required |
| POST | /api/v1/orders/cancel | Cancel by tracking_number or order_id | Required |
| GET | /api/v1/orders/list | List orders scoped to your API key or org seat | — |
| GET | /api/v1/orders/{tracking_number} | Order detail + status timeline | — |
| GET | /api/v1/orders/{tracking_number}/label | Label payload (JSON / HTML / PDF via ?format=) | — |
| POST | /api/v1/orders/preview-assignment | Rank eligible carriers without creating an order | — |
| POST | /api/v1/orders/status-bulk | Poll status for up to 500 tracking numbers | — |
| POST | /api/v1/shipments | Ecommerce-style create (fromAddress / toAddress / packages) | Optional |
| GET | /api/v1/shipments | Cursor-paginated shipment list | — |
| GET | /api/v1/carriers/quote | Lane quotes (query: origin_country, destination_country, weight_kg) | — |
| GET | /api/v1/carriers/list | Partner-safe carrier directory | — |
| POST | /api/v1/rates | Structured rates from address objects | — |
| GET | /api/v1/rates-cached | Cached rate lookup | — |
| GET | /api/v1/tracking/{trackingNumber} | Canonical tracking envelope (API key required) | — |
| GET | /api/v1/estimate-delivery | ETA window for a corridor | — |
| POST | /api/v1/validate-address | Address validation (Mapbox when configured) | — |
| GET | /api/v1/partner/me | Partner profile for API key or org seat | — |
| GET | /api/v1/partner/usage | Usage / allowance metering | — |
| GET | /api/v1/invoices | List invoices; optional create via query | — |
| GET | /api/v1/analytics/delivery | On-time / volume analytics for your key | — |
| GET | /api/v1/webhooks/health | Outbound webhook delivery health | — |
Carrier marketplace routes (available / accept / claim / reject) use a carrier session, not a partner API key. Interactive OpenAPI: /docs.
Limits
Canonical error envelope (newer routes): { success: false, error: { code, message, requestId? } }. Some older handlers may still return { error }.
400Bad request / validation401Missing or invalid API key403Forbidden (scope / allowlist)404Not found409Conflict (state machine)410Gone (retired payment retry)429Rate limited500Server errorHelp
API questions: api@bagster.io. General support: support@bagster.io.
Versioning policy lives in-repo at docs/API_VERSIONING.md. Partner honesty surface: /reliability.