What you’ll learn to do
- Separate technical receipt from commercial acceptance
- Define fields, identifiers and schema versions
- Handle retries and late events without duplication
- Measure exchange success and reconcile business facts
Lesson duration: 70–90
Why carriers and freight forwarders need an API
An API transfers agreed data about requests, statuses, ETA, documents and confirmations between a carrier’s TMS and a freight forwarder’s system. Its purpose is to reduce duplicate entry and information delays, not to make every message automatically true.
Before integration, define business events and responsible parties: who creates the order, who confirms acceptance, who reports actual loading and who confirms POD. Automatic synchronisation does not remove contractual authority requirements or source verification.
Data contract and schema versions
The parties agree fields, types, units, mandatory requirements, status code lists and change rules. Mass must have a unit, a date must have a time zone, and a cargo unit must have a stable identifier. A “status” field without a list of allowed values creates incompatibility.
Schema versioning allows fields to be added without suddenly breaking the receiving system. If a partner starts sending a new status, the unknown value must be handled predictably: as unsupported with diagnostics, not as “delivered”. Retain the specification and test examples.
Identifiers and order matching
The freight forwarder and carrier may use different numbers for the same shipment. Transmit the event sender’s internal ID, the recipient’s ID and agreed external references: order, trip, container and transport leg. Do not use a phone number or company name as the primary key.
One order can contain two containers. A message for container A must not close B. Matching checks the ID combination and event type; an unknown ID sends the record for investigation rather than creating an arbitrary new delivery.
Request, acknowledgement and state
Creating a transport request via an API does not mean the carrier has accepted it. Distinguish “technically received”, “validated”, “commercially accepted”, “rejected” and “in progress”. A technical HTTP response indicating successful processing does not replace contractual confirmation.
If the system returns a successful response for saving a draft but the carrier has not confirmed the rate, the forwarder must not show “vehicle assigned”. Retain separate times for message receipt and acceptance of the obligation, and identify the decision-maker.
Retries, idempotency and ordering
A network may repeat a request after a timeout. Create a stable idempotency key for the operation so that a retry does not create a second order, second delivery or double charge. Receiving the same event again is acceptable; executing the business action again is not.
Events may arrive out of order: POD may precede a delayed “in transit” message. The system stores event and receipt times, checks allowed transitions and does not roll back a confirmed delivery because of an old message. A processing log is required.
Errors, retries and queues
Separate temporary connection failures from permanent data errors. Temporary unavailability may justify bounded retries with increasing intervals; for an incorrect ID or mass unit, repeating the same request indefinitely is pointless. Do not conceal failure behind a green status.
Place unprocessed events in a controlled error queue with a reason, owner and deadline. After correcting the data, reprocess safely while retaining the original ID. It is important to reconstruct which messages were delivered and which were actually accepted.
Security and data minimisation
The integration must verify who may send and read events, protect the transport channel and limit the volume of personal and commercial information. Do not send a complete document set to every contractor when an order number and time are sufficient for the operation.
Access keys must not appear in public files or training examples. Technical error logs must not expose secrets. Specific access, storage and permission implementation depends on the architecture and is checked by specialists; logistics professionals must understand the minimum-necessary-data principle.
Documents and version links
A document is best linked to an order by ID, type, version and a verifiable link or an agreed secure exchange. The filename “CMR_final_final.pdf” is not a version. For a corrected Packing List, retain the connection to the previous revision and recipients.
Receipt of a link does not prove that the document is accessible or correct. Record successful download, content verification and business acknowledgement separately. Do not change an already signed POD without retaining the original evidence.
Observability and event reconciliation
Measure the proportion of successfully processed messages, event delivery latency, duplicate count and proportion of ID-matching errors. If 190 out of 200 messages were processed, the technical rate is 95%; it does not mean that 95% of cargo was delivered.
Periodically reconcile control events with the partner: orders accepted, containers released and PODs received. For discrepancies, retain the ID list and reason, not just an aggregate percentage. Automated integration requires operational accountability.
Workshop: a duplicate and an unrelated container
The API sent a gate-out event for container A twice with the same ID, followed by a “delivered” event for unknown container C. The first two messages must produce one business operation; the third is sent for reconciliation without changing A or B.
Calculate technical success for 190 processed messages out of 200: 95%. Create a table of event fields: ID, container, type, actual event time, receipt time, source and version. Explain why HTTP 200 does not mean commercial acceptance of an order.
Prerequisites and working outcome
Before independent work: 05.111. The outcome of this topic is an integration contract and test scenarios. The overview may be read earlier, but the solution is assessed after the prerequisites. All amounts, dates and rates below are stipulated for the training case and are not a market offer or a universal rule.
Practical package: Integration contract and test scenarios
API-512: a training POST /orders accepts requestId R-12 and returns HTTP 200, body.businessStatus=pending. A retry of the same request has the same key. Event E-12 contains equipmentId UNKNOWN. Of 200 messages, 190 passed technical validation. Describe business decisions and tests without using real secrets.
Analysis. pending does not mean commercial acceptance. Retrying R-12 does not create a second order under the specified idempotency contract. UNKNOWN is sent for reconciliation without changing containers. Technical success is 95%, not the percentage of accepted shipments. Tests: retry, unknown ID, permanent unit error and unsupported version.
Assessment criteria: input data and units — 2 points; reproducible calculation/transition — 3; justification of the decision and limitations — 3; source, version and next responsible person — 2. Self-check benchmark: 8 out of 10 with no critical error: invented fact, unconfirmed authority or double counting. This is a teaching rubric, not professional certification.
Lesson materials
Open worked solution
API-512: a training POST /orders accepts requestId R-12 and returns HTTP 200, body.businessStatus=pending. A retry of the same request has the same key. Event E-12 contains equipmentId UNKNOWN. Of 200 messages, 190 passed technical validation. Describe business decisions and tests without using real secrets.
Analysis. pending does not mean commercial acceptance. Retrying R-12 does not create a second order under the specified idempotency contract. UNKNOWN is sent for reconciliation without changing containers. Technical success is 95%, not the percentage of accepted shipments. Tests: retry, unknown ID, permanent unit error and unsupported version.
Agree the schema, units and versions
Link order, container and leg IDs
Separate technical and commercial acknowledgement
Set up reconciliation of duplicates, errors and documents
Checklist
- Agree the schema, units and versions
- Link order, container and leg IDs
- Separate technical and commercial acknowledgement
- Set up reconciliation of duplicates, errors and documents
Sources
Bibliography
Sources checked on 09.11.2026. Contractual models and standards are not universally mandatory law; check the implementation profile and accepted terms separately. Sources supporting the statements: IETF — RFC 9110 (2022), §§9.2.2 and 15.3.1: idempotency and HTTP 200; GS1 — EPCIS 2.0 (2022), event identification and data exchange; DCSA — Track & Trace, transport event types and sources. Calculations, tariffs, management decisions, KPIs and the rubric are original teaching models. IFRS, where cited, provides accounting context and does not prescribe commercial prices or a mandatory regime for every company. For a live operation, check the current edition, jurisdiction and contract.