Introduction
Welcome to the Openleaf B2B API Documentation.
This is a separate, curated API surface for the Openleaf B2B Platform, used to book forward shipments against Purchase Orders and to fetch Purchase Order data. It is served on its own host and is independent from the Openleaf B2C API.
It covers three areas:
- Create Shipment API — book a forward shipment (order) against a Purchase Order and get an AWB/LR number, label and tracking status from a carrier.
- Get Purchase Orders API — list, filter and fetch Purchase Orders (POs) raised against a client.
- Other Miscellaneous APIs — supporting lookups (carriers, warehouses) and utilities needed to drive the two flows above.
These endpoints are a stable, curated API surface purpose-built for external integrations — the request/response shapes documented here are exactly what the server accepts and returns today.
Base URL & Environment
This API is served on its own dedicated prefix:
https://<host>/api/external/v1
| Environment | Host |
|---|---|
| UAT | https://uat-b2b.openleaf.tech |
| Production | https://api-b2b.openleaf.tech |
e.g. https://api-b2b.openleaf.tech/api/external/v1/po/getOrdersBatchwise in production.
Authentication
Authentication is a single static API token — no login call, no cookie, no session to manage. Send it on every request as a bearer token:
Authorization: Bearer <api_token>
Openleaf will issue you this token directly. If it's ever compromised, contact Openleaf team to have it rotated.
If the header is missing, malformed, or the token is invalid/the account is disabled, the server
returns 401 Unauthorized.
This token uniquely identifies your account. It should not be shared with others.
Example authenticated request
curl -X POST 'https://<host>/api/external/v1/po/getOrdersBatchwise' \
-H 'Content-Type: application/json' \
-H 'Authorization: Bearer <api_token>' \
-d '{"batch": 0, "filters": {}}'
Standard Response Envelope
Every endpoint returns the same envelope:
{
"success": true,
"status_code": 200,
"message": "Human readable message",
"data": { "...": "endpoint-specific payload" },
"error": null
}
| Field | Type | Notes |
|---|---|---|
success | boolean | true for 2xx responses, false otherwise |
status_code | number | Mirrors the HTTP status code |
message | string | Human-readable summary |
data | object | Present on success; shape documented per-endpoint |
error | any | Present on failure; usually a string with the underlying error message |
Common HTTP status codes used across the API: 200 success, 400 bad request / validation /
business-rule failure, 401 unauthorized (missing/expired session or token), 404 not found,
500 internal/upstream (e.g. carrier) error.