Skip to main content

Print AWB labels β€” Client & B2B Integration

POST
/api/v1/shipments/print

Renders one or more Air Waybills as JSON, standalone HTML, or PDF in a single bulk request.

Authentication & scope β€” Authenticate with either a client JWT (Authorization: Bearer …) or a B2B API key (X-API-Key: …). The tenant scope is derived server-side from the credential: a client owner is scoped to all sub-accounts under their mainAccountId; an API key is scoped to its bound sub-account. AWBs outside that scope are rejected with 403 β€” never silently dropped.

Formats β€” html returns a fully self-contained document (inline CSS + base64 barcode/QR) that prints pixel-accurately on 6Γ—4 thermal stock; json returns the filtered data; pdf returns a print-ready binary.


cURL

curl -X POST 'https://api.absegy.com/api/v1/shipments/print' \
-H 'X-API-Key: <YOUR_API_KEY>' # or: -H 'Authorization: Bearer <JWT>' \
-H 'Content-Type: application/json' \
-d '{ "trackingNumbers": ["LVN6018056","LVN6018057"], "format": "html", "pageSize": "thermal_4x6", "lang": "en" }' \
-o labels.html

Axios (TypeScript)

import axios from 'axios';

const { data: html } = await axios.post(
'https://api.absegy.com/api/v1/shipments/print',
{ trackingNumbers: ['LVN6018056', 'LVN6018057'], format: 'html', pageSize: 'thermal_4x6', lang: 'en' },
{ headers: { 'X-API-Key': process.env.ABS_API_KEY, // or Authorization: `Bearer ${jwt}` }, responseType: 'text' },
);
// Embed offline β€” fully self-contained:
document.querySelector('#awb-frame').srcdoc = html;

Request​

Responses​

200 OK

Rendered AWBs. The Content-Type mirrors the requested format: application/json (data envelope), text/html (standalone document), or application/pdf (binary).

400 Bad Request

Validation failed β€” empty/oversized tracking list, duplicates, or bad enum value.

401 Unauthorized

Missing or invalid credentials (JWT or API key).

403 Forbidden

One or more tracking numbers are outside the caller’s tenant scope, or the account has no linked sub-account.

404 Not Found

All tracking numbers are valid for the caller, but none resolve to a printable shipment.

500 Internal Server Error

Unexpected server error while resolving or rendering the labels.

501

PDF rendering is not enabled on this deployment yet β€” use format: "html".