Your shipment data is most useful when it reaches the systems where decisions are made: the ERP that plans purchasing, the warehouse system that schedules labor, the dashboard the finance team opens every morning. Two mechanisms do most of the work. An API lets your systems ask for data when they need it. Webhooks let the platform tell your systems the moment something changes. Used together, they replace manual exports and status emails.
This guide explains how both work in QueChains and the design patterns that make integrations dependable. The full reference is on the API documentation page, and the same guidance appears inside the app under Settings, Integrations.
Pull vs push: which do you need?
| API (pull) | Webhooks (push) | |
|---|---|---|
| Who starts it | Your system requests data | QueChains sends data to your endpoint |
| Best for | Reports, nightly syncs, on-demand lookups, creating records | Near real-time reactions: a status change, a customs clearance, a stock alert |
| Latency | As often as you poll | Seconds after the event |
| Load | Grows with polling frequency | Only when something happens |
| Typical combination | Use webhooks to learn that something changed, then call the API for the full record if you need it | |
The API in five minutes
1. Create an API key
An organization administrator opens Settings, Integrations, API Keys and chooses Create API Key. Give it a clear name (for example "Warehouse system sync"), tick only the permissions it needs, and copy the Bearer token when it is shown. The token contains the secret and appears only once, so store it in a secret manager.
2. Authenticate every request
Send the token as a Bearer token:
Authorization: Bearer qc_<key>.<secret>
3. Know what a key can reach
- shipments covers shipments and containers.
- carriers, customs and documents cover their own areas.
- warehouse covers warehouses, inventory and stock transfers.
- procurement covers purchase orders and suppliers.
- analytics covers analytics and reports (read only).
Each area has read and write permissions, and a write permission also allows reading. An "all" key covers every area above but never billing, users, settings or the integration management screens, so a leaked key cannot create more keys.
4. Respect plan access and limits
- API access depends on your plan: some plans have no API access, some are read-only, and higher plans allow reading and writing. Check the pricing page for the current tiers.
- Each key has a per-minute request limit (60 by default, adjustable from 1 to 1000). Responses include
X-RateLimit-LimitandX-RateLimit-Remaining. Going over returns HTTP 429 with aRetry-Afterheader. - You can also restrict a key to specific IP addresses and give it an expiry date.
5. Handle the error codes
- 401: the token is wrong, disabled or expired.
- 403: the key lacks the permission, your plan does not include it, or the request came from an address that is not allowed. The message says which.
- 429: slow down and retry after the indicated time.
Ready to connect your systems? Create a QueChains account or ask our team about integration support.
Webhooks in five minutes
1. Create a webhook
Under Settings, Integrations, Webhooks, choose Create Webhook. Enter a public HTTPS address on your server (localhost and private network addresses are not allowed), pick the events, and copy the signing secret shown once.
2. Choose your events
There are 14 events across shipments, customs, purchase orders, warehouses, documents and disruptions:
shipment.created,shipment.updated,shipment.status_changedcustoms.created,customs.updated,customs.clearedprocurement.created,procurement.updatedwarehouse.inventory_updated,warehouse.stock_alertdocument.uploaded,document.updateddisruption.created,disruption.resolved
3. Read the delivery
Each delivery is an HTTPS POST with a JSON body containing an id, the event name, a timestamp and the data, plus these headers:
X-QueChains-Event: the event name.X-QueChains-Delivery: a unique id, the same across retries. Use it to ignore duplicates.X-QueChains-Timestamp: when the delivery was signed, in unix seconds.X-QueChains-Signature:sha256=followed by an HMAC-SHA256 of the timestamp, a dot and the raw request body, using your signing secret.
4. Verify the signature before trusting it
Compute the HMAC over the exact bytes you received, compare in constant time, and reject old timestamps to block replays. The in-app API documentation includes a ready-to-copy Node.js example. The two rules that trip people up: verify the raw body (not re-serialized JSON) and use a timing-safe comparison.
5. Answer fast, retry safely
- Return a 2xx status quickly, then process the event asynchronously.
- Failed deliveries are retried after 2, 10 and 60 seconds, up to the retries you configure (0 to 3).
- After 5 failures in a row the webhook shows as failing; after 10 it is switched off automatically. Fix the endpoint and enable it again.
- The Deliveries view on each webhook shows recent results, including the HTTP status and error message.
Reliable integration patterns
- Make handlers idempotent. The same delivery can arrive more than once. Store processed delivery ids and skip repeats.
- Queue first, process second. Write the event to a queue and acknowledge immediately. Slow processing is the most common cause of avoidable retries.
- Use webhooks as a signal, the API as the source of truth. If an event arrives, fetch the current record when you need the full detail. This avoids problems with events arriving out of order.
- Reconcile on a schedule. Run a periodic API sync to catch anything missed during downtime.
- One key per application, with the least permissions it needs, so you can revoke one integration without breaking others.
- Rotate secrets on a schedule and when people with access leave. Rotating a webhook secret invalidates the old one immediately, so update your endpoint at the same time.
- Log carefully. Log delivery ids and outcomes, never tokens or signing secrets.
Example use cases
- ERP updates: when
shipment.status_changedfires, update the expected receipt date on the purchase order. - Warehouse planning: use the shipment ETA to schedule dock doors and labor.
- Customer notifications: send your own branded message when a shipment is cleared.
- Finance dashboards: pull shipments and costs nightly into your BI tool.
- Team alerts: post stock alerts and disruptions into the channel your team already watches.
Exception rules and alerts are described in the shipment exception management guide. For rollout planning, see the implementation checklist, and review our security overview before you connect production systems.
Frequently Asked Questions
What is a logistics API?
A logistics API lets other software read and update shipment, customs, warehouse and purchasing data over HTTPS, so systems can share information without manual exports.
What is the difference between an API and a webhook?
With an API, your system asks for data. With a webhook, the platform sends data to your system when an event happens. Many integrations use both.
How do I authenticate to the QueChains API?
Create an API key in Settings, Integrations, then send the Bearer token in the Authorization header on every request.
How do I know a webhook really came from QueChains?
Verify the X-QueChains-Signature header using your signing secret over the raw request body, and reject deliveries with an old timestamp.
What happens if my endpoint is down?
Deliveries are retried after short delays. Persistent failures mark the webhook as failing and eventually disable it. Use a scheduled API sync to recover anything you missed.
Can I restrict what an API key can do?
Yes. Choose specific permissions, set an expiry date, limit the request rate and allow only certain IP addresses.
Key Takeaways
- Use the API to pull and create data, webhooks to react to changes, and both together for reliability.
- Give each application its own least-privilege key and rotate secrets regularly.
- Always verify webhook signatures on the raw body and make handlers idempotent.
- Acknowledge quickly, process asynchronously and reconcile on a schedule.
Connect your shipment data to the systems that need it. Read the API docs, create an account or talk to our team.
Written by the QueChains Editorial Team
