Carrier API Integration Guide
Carrier API Integration Guide
[Link] Page 1 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Table of Contents
1. Quick Reference
2. Authentication
3. Environment Variables
4. API #1: Maersk Track & Trace
5. API #2: Maersk Deadlines
6. API #3: Maersk Demurrage & Detention
7. API #4: Hapag-Lloyd Track & Trace
8. API #5: Hapag-Lloyd Point-to-Point Routes
9. API #6: Hapag-Lloyd Vessel Schedules
10. DCSA Event Types Reference
11. Cut-off Code Mapping
12. Document Lifecycle Tracking
13. Data Availability Matrix
14. Fields NOT Available
15. Rate Limits & Best Practices
16. Real Data Examples
17. Integration Gotchas
[Link] Page 2 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
1. Quick Reference
APIs at a Glance
Demurrage
[Link] D&D charges,
3 Maersk & Deten-
charges/import/{DMR\|DET} LFD, free days
tion
Track &
Container/booking
4 Hapag Trace [Link]
tracking events
Events v2
Point-to-
[Link] Route options
5 Hapag Point
to-point-routes with cut-offs
Routes v1
Vessel
[Link] Full port rotation
6 Hapag Schedules
schedules with ETA/ETD
v1
[Link] Page 3 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
2. Authentication
POST [Link]
Content-Type: application/x-www-form-urlencoded
Headers:
Consumer-Key: {MAERSK_CUSTOMER_KEY}
Body:
client_id={MAERSK_CUSTOMER_KEY}
&client_secret={MAERSK_CONSUMER_SECRET}
&grant_type=client_credentials
Response:
{
"access_token": "eyJhbGciOi...",
"token_type": "bearer",
"expires_in": 7200,
"scope": "..."
}
Headers:
Authorization: Bearer {access_token}
Consumer-Key: {MAERSK_CUSTOMER_KEY}
Accept: application/json
Token caching: Token is valid for 7200 seconds (2 hours). Cache it and refresh 5 minutes before expiry. Do NOT re-
quest a new token per API call.
Headers:
X-IBM-Client-Id: {HAPAG_CLIENT_ID}
X-IBM-Client-Secret: {HAPAG_CLIENT_SECRET}
Accept: application/json
[Link] Page 4 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
API-Version: 1
[Link] Page 5 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
3. Environment Variables
# Maersk
MAERSK_CONSUMER_KEY= # OAuth consumer key
MAERSK_CONSUMER_SECRET= # OAuth consumer secret
MAERSK_CUSTOMER_KEY= # API consumer key (goes in header)
MAERSK_CUSTOMER_CODE= # Customer ID (for D&D queries)
MAERSK_API_BASE_URL=[Link]
MAERSK_TOKEN_URL=[Link]
# Hapag-Lloyd
HAPAG_CLIENT_ID= # X-IBM-Client-Id header
HAPAG_CLIENT_SECRET= # X-IBM-Client-Secret header
HAPAG_API_BASE_URL=[Link]
[Link] Page 6 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Endpoint
GET [Link]
Query Parameters
One of 3 re-
carrierBookingReference string Booking number
quired
One of 3 re-
transportDocumentReference string Bill of Lading number
quired
One of 3 re-
equipmentReference string Container number (e.g., MRKU6651831 )
quired
Comma-separated:
eventType No string
SHIPMENT,TRANSPORT,EQUIPMENT
Filter: gte:2026-01-
eventCreatedDateTime No string
01T00:00:00Z
Response Structure
{
"events": [
{
"eventID": "14203378004",
"eventType": "SHIPMENT | TRANSPORT | EQUIPMENT",
"eventDateTime": "2026-01-21T04:12:00+05:30",
"eventCreatedDateTime": "2026-01-21T04:15:00Z",
"eventClassifierCode": "ACT | EST | PLN",
[Link] Page 7 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 8 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 9 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Endpoint
GET [Link]
Pipavav ,
portOfLoad string City name (exact match required) Salalah ,
Shanghai
Response Structure
[
{
"shipmentDeadlines": {
"terminalName": "APM Terminals Pipavav",
"deadlines": [
{
"deadlineName": "Commercial Cargo Cutoff",
"deadlineLocal": "2026-01-20T22:00:00"
},
{
"deadlineName": "Shipping Instructions Deadline",
"deadlineLocal": "2026-01-16T17:00:00"
},
{
"deadlineName": "Commercial Verified Gross Mass Deadline",
"deadlineLocal": "2026-01-16T17:00:00"
},
{
"deadlineName": "Special Cargo Documentation Deadline",
"deadlineLocal": "2026-01-19T19:00:00"
},
[Link] Page 10 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
{
"deadlineName": "Final DGD Submission deadline",
"deadlineLocal": "2026-01-21T00:00:00"
},
{
"deadlineName": "Empty Container Pickup Deadline",
"deadlineLocal": "2026-01-22T17:00:00"
},
{
"deadlineName": "Shipping Instructions Deadline for Advance Manifest
Cargo",
"deadlineLocal": "2026-01-25T16:00:00"
}
]
}
}
]
Shipping Instructions Deadline for Advance Manifest Cargo SI deadline for AMS/ENS cargo
[Link] Page 11 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Endpoints
MAEU , SEAU ,
carrierCode string Carrier code SEJJ , MCPU ,
MAEI
Response Structure
{
"billOfLadingNumber": "262444238",
"carrierCustomerCode": "33104620597",
"carrierCode": "MAEU",
"chargeType": "DMR",
"chargeName": "Demurrage",
"isInvalidFreeTime": false,
"currencyCode": "USD",
"location": {
"countryCode": "US",
"countryName": "United States",
"cityName": "Newark",
"locationName": "Newark - Maher Terminal",
"UNLocationCode": "USEWR",
"UNRegionCode": "NJ",
"UNRegionName": "New Jersey",
"carrierSiteGeoID": "1D0KF47J1OI2N"
},
"equipmentCharges": [
[Link] Page 12 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
{
"equipmentReference": "MRKU9294928",
"isFinalCharge": true,
"chargesCalculatedDateTime": "2026-02-07T07:35:26",
"systemMessage": "Optional system message",
"freePeriod": {
"freeDays": 4,
"estimatedFreeStartDate": "2026-02-06",
"actualFreeStartDate": "2026-02-06",
"originalLastFreeDate": "2026-02-11",
"estimatedLastFreeDate": "2026-02-11",
"actualLastFreeDate": "2026-02-11"
},
"chargeablePeriod": {
"startDate": "2026-02-12",
"endDate": "2026-03-01",
"forceMajeureDaysDetails": [],
"chargesByDates": [
{
"chargesByDate": "2026-02-12",
"amount": 150,
"chargeableDays": 1,
"rateTiers": [
{ "rate": 150, "numberOfDays": 1 }
]
}
]
}
}
]
}
Field Description
Important: D&D data is only available AFTER container is discharged at destination. Queries for in-transit shipments
return 404.
[Link] Page 13 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 14 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Endpoint
GET [Link]
Query Parameters
SHIPMENT ,
TRANSPORT ,
eventType No string
EQUIPMENT (comma-sep-
arated)
Response Structure
Returns a flat array of events (NOT wrapped in {events: []} like Maersk):
[
{
[Link] Page 15 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
"eventID": "uuid-string",
"eventType": "SHIPMENT | TRANSPORT | EQUIPMENT",
"eventDateTime": "2025-09-26T13:49:11Z",
"eventCreatedDateTime": "2025-09-26T13:58:11.936Z",
"eventClassifierCode": "ACT | EST | PLN",
// SHIPMENT events
"shipmentEventTypeCode": "ISSU | CONF | RECE | APPR",
"documentTypeCode": "TRD | BKG",
"documentID": "HLCUDE1250918387",
// TRANSPORT events
"transportEventTypeCode": "ARRI | DEPA",
"transportCall": {
"transportCallId": "uuid",
"exportVoyageNumber": "2533E",
"importVoyageNumber": "2533W",
"UNLocationCode": "INMUN",
"facilityCode": "AMCT",
"facilityCodeListProvider": "SMDG",
"facilityTypeCode": "POTE",
"modeOfTransport": "VESSEL | RAIL | TRUCK",
"location": {
"locationName": "MUNDRA",
"UNLocationCode": "INMUN",
"address": { "name": "ADANI PORT" }
},
"vessel": {
"vesselIMONumber": "9450399",
"vesselName": "TORRENTE"
}
},
// EQUIPMENT events
"equipmentEventTypeCode": "LOAD | DISC | GTIN | GTOT | STUF | STRP",
"equipmentReference": "TCNU1425767",
"ISOEquipmentCode": "45GP",
"emptyIndicatorCode": "EMPTY | LADEN",
"seals": [
{ "sealNumber": "ML-IN2349382", "sealSource": "CAR", "sealType": "BLT" }
],
"eventLocation": {
"locationName": "MUNDRA",
"UNLocationCode": "INMUN",
"address": { "name": "ADANI PORT" }
}
}
]
[Link] Page 16 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
delayReasonCode Yes No
[Link] Page 17 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Endpoint
GET [Link]
Headers (additional)
API-Version: 1
Query Parameters
Response Structure
[
{
"solutionNumber": 1,
"transitTime": 26,
[Link] Page 18 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
"receiptTypeAtOrigin": "CY",
"deliveryTypeAtDestination": "CY",
"placeOfReceipt": {
"facilityTypeCode": "POTE",
"location": {
"locationName": "MUNDRA",
"UNLocationCode": "INMUN"
},
"dateTime": "2026-02-19T01:00:00+05:30"
},
"placeOfDelivery": {
"facilityTypeCode": "POTE",
"location": {
"locationName": "NEW YORK",
"UNLocationCode": "USNYC"
},
"dateTime": "2026-03-17T10:00:00-04:00"
},
"cutOffTimes": [
{ "cutOffDateTimeCode": "DCO", "cutOffDateTime": "2026-02-
15T17:00:00+05:30" },
{ "cutOffDateTimeCode": "FCO", "cutOffDateTime": "2026-02-
17T13:00:00+05:30" },
{ "cutOffDateTimeCode": "DGC", "cutOffDateTime": "2026-02-
17T13:00:00+05:30" },
{ "cutOffDateTimeCode": "OBC", "cutOffDateTime": "2026-02-
17T13:00:00+05:30" },
{ "cutOffDateTimeCode": "RCO", "cutOffDateTime": "2026-02-
17T13:00:00+05:30" },
{ "cutOffDateTimeCode": "TCO", "cutOffDateTime": "2026-02-
17T13:00:00+05:30" },
{ "cutOffDateTimeCode": "VCO", "cutOffDateTime": "2026-02-
17T13:00:00+05:30" }
],
"legs": [
{
"sequenceNumber": 1,
"transport": {
"modeOfTransport": "VESSEL",
"vessel": {
"vesselIMONumber": "9450399",
"name": "TORRENTE",
"flag": "LR",
"callSign": "5LRS5"
},
"universalServiceReference": "SR12345A",
"universalExportVoyageReference": "2533E",
"servicePartners": [
{
"carrierCode": "HLC",
[Link] Page 19 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 20 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Endpoint
GET [Link]
Headers (additional)
API-Version: 1
2026-02-
startDate No string YYYY-MM-DD
01
2026-04-
endDate No string YYYY-MM-DD
01
Response Structure
[Link] Page 21 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
{
"carrierServiceName": "IOS - India Ocean Service",
"carrierServiceCode": "IO1",
"universalServiceReference": "SR12345A",
"vesselSchedules": [
{
"vessel": {
"vesselIMONumber": "9450399",
"name": "TORRENTE",
"flag": "LR",
"callSign": "5LRS5",
"operatorCarrierCode": "HLC",
"MMSINumber": "636092708"
},
"isDummyVessel": false,
"transportCalls": [
{
"portVisitReference": "PVREF123",
"transportCallReference": "6084822",
"carrierImportVoyageNumber": "2533W",
"carrierExportVoyageNumber": "2533E",
"universalImportVoyageReference": "...",
"universalExportVoyageReference": "...",
"location": {
"UNLocationCode": "INMUN",
"locationName": "MUNDRA",
"facilitySMDGCode": "AMCT",
"address": { "city": "MUNDRA", "countryCode": "IN" }
},
"timestamps": [
{
"eventTypeCode": "ARRI",
"eventClassifierCode": "EST",
"eventDateTime": "2026-05-05T14:00:00+05:30"
},
{
"eventTypeCode": "DEPA",
"eventClassifierCode": "EST",
"eventDateTime": "2026-05-07T01:00:00+05:30"
}
],
"cutOffTimes": [
{ "cutOffDateTimeCode": "FCO", "cutOffDateTime": "2026-05-
04T19:00:00+05:30" },
{ "cutOffDateTimeCode": "VCO", "cutOffDateTime": "2026-05-
04T19:00:00+05:30" },
{ "cutOffDateTimeCode": "DOC", "cutOffDateTime": "2026-05-
04T18:00:00+05:30" },
[Link] Page 22 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 23 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Event Types
[Link] Page 24 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 25 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Mode of Transport
Code Meaning
RAIL Railway
[Link] Page 26 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 27 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Commercial Cargo
FCL Cargo Delivery FCO FCO
Cutoff
Commercial Verified
VGM VCO VCO
Gross Mass Deadline
Transhipment TCO – –
Shipping Instructions
Shipping Instructions – SHI
Deadline
[Link] Page 28 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Additional codes exist in Maersk spec but weren’t observed in test data: - SURR + TRD = B/L surrendered - RELS
+ TRD = B/L released - HOLD + TRD = B/L on hold
Maersk Hapag
Booking
confirmation No (no BKG event) Yes ( CONF + BKG with timestamp)
date
Earliest
available SI Received ( RECE + SHI ) Booking Confirmed ( CONF + BKG )
event
Container-level vs Booking-level
Booking
Yes (all document events) Yes (CONF + ISSU only)
number
Container
Yes (same document events) No (only EQUIPMENT + TRANSPORT)
number
[Link] Page 29 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 30 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Container tracking
Yes Yes Track & Trace
(LOAD/DISC/GTIN/GTOT)
[Link] Page 31 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
[Link] Page 32 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Spot vs Contract booking Maersk Offers API / Hapag Contract API (separate
No No
type commercial APIs)
Container/cargo gross
No No VGM certificate, packing list
weight
Customs clearance status No No CBP ACE (US), ICEGATE (India), customs broker
No (Maersk
D&D charges at destination No Hapag portal only
has)
[Link] Page 33 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Rate Limits
Maersk Hapag
Best Practices
1. Maersk token caching: Cache the OAuth token for its full TTL (7200s). Refresh 5 min before expiry.
2. Hapag call spacing: Add 1.5s delay between consecutive calls to stay under the Tryout limit. For production, re-
quest a higher-tier plan.
3. Batch container tracking: For N containers, space API calls to stay within rate limits:
5. Error handling:
404 from Maersk = no data yet (booking too new, or container not discharged for D&D)
429 = rate limited, back off exponentially
500 / timeout = transient, retry after 30s
6. Maersk Deadlines port name gotcha: Use exact city names, NOT UN/LOCODEs. “Pipavav” works, “JNPT”
doesn’t, “Nhava Sheva” doesn’t. Test each port name against the API before hardcoding.
7. Hapag cut-off code mapping: P2P routes and Vessel Schedules use DIFFERENT codes for the same concept
(see Section 11). Normalize both to a single internal representation.
[Link] Page 34 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Route: Ludhiana ICD → Pipavav → Salalah → Shanghai → Los Angeles Container: MRKU6651831 (22G1 = 20ft stan-
dard) 20 events total: 5 Shipment + 8 Transport + 7 Equipment
Document lifecycle:
Jan 10 RECE SHI SI Received
Jan 10 DRFT TRD Draft B/L Created
Jan 14 RECE VGM VGM Submitted (1st)
Jan 18 RECE VGM VGM Submitted (2nd)
Feb 13 ISSU TRD B/L Issued
Container journey:
Jan 03 GTOT INSWA EMPTY Empty pickup at Ludhiana ICD
Jan 14 GTIN INLUH LADEN Gate in laden at Ludhiana depot
Jan 14 GTOT INLUH LADEN Gate out laden (rail to Pipavav)
Jan 19 GTIN INPPV LADEN Gate in at Pipavav port
Jan 20 LOAD INPPV LADEN Loaded on CORNELIA MAERSK
Jan 26 DISC OMSLL LADEN Discharged at Salalah (transshipment)
Jan 28 LOAD OMSLL LADEN Loaded on ROTTERDAM EXPRESS
Vessel movements:
Jan 14 EST DEPA INLUH Rail depart Ludhiana
Jan 18 EST ARRI INPPV Rail arrive Pipavav
Jan 21 ACT DEPA INPPV CORNELIA MAERSK departs Pipavav
Jan 26 ACT ARRI OMSLL CORNELIA MAERSK arrives Salalah
Jan 28 ACT DEPA OMSLL ROTTERDAM EXPRESS departs Salalah
Feb 18 EST ARRI CNSHA ROTTERDAM EXPRESS arrives Shanghai
Feb 25 EST DEPA CNSHA GUTHORM MAERSK departs Shanghai
Mar 11 EST ARRI USLAX GUTHORM MAERSK arrives Los Angeles
Route: Gurgaon ICD → Mundra → Salalah → Norfolk → Detroit Container: TCNU1425767 (45GP = 40ft high-cube)
B/L: HLCUDE1250918387 19 events total: 2 Shipment + 2 Transport + 15 Equipment
Document lifecycle:
Sep 19 CONF BKG Booking Confirmed
Sep 26 ISSU TRD B/L Issued (HLCUDE1250918387)
Container journey:
Sep 10 GTOT INGGN EMPTY Empty pickup at Gurgaon
[Link] Page 35 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
Demurrage:
Container: MRKU9294928
Location: Newark - Maher Terminal (USEWR)
Free days: 4
Free period start: 2026-02-06
LFD (original): 2026-02-11
LFD (actual): 2026-02-11
Total charges: $0 (within free time)
Detention:
Free days: 4
LFD: 2026-02-11
Total charges: $0
[Link] Page 36 of 37
Carrier API Integration Guide 18/02/26, 6:23 PM
1. Maersk wraps events in {events: []} , Hapag returns a flat array [] . Normalize this in your parser.
2. Maersk Deadlines API requires exact city names, not UN/LOCODEs. You must maintain a mapping of
UN/LOCODE to Maersk-accepted city names. Test each port before deploying.
3. Hapag P2P and Vessel Schedule cut-off codes differ for the same concept. Map both: DGC / DGD → Danger-
ous Goods, OBC / OOG → OOG Cargo, RCO / REF → Reefer, DCO / DOC → Documentation.
4. Hapag container queries don’t return SHIPMENT events. If you need B/L status for a Hapag container, you
must query by booking number or B/L number instead.
5. Maersk D&D returns 404 for in-transit shipments. D&D data only becomes available after discharge at destina-
tion. Handle 404 gracefully — it doesn’t mean “no B/L found”, it means “not yet available”.
6. Maersk VGM events have timestamps but NOT the weight value. The RECE + VGM event tells you WHEN
VGM was submitted, not HOW MUCH the container weighs.
7. Hapag Tryout plan is limited to 50 calls/hour. For production workloads with 200+ containers, you need to up-
grade or implement aggressive caching.
8. Maersk vessel IMO is returned as a string (e.g., "9245756" not 9245756 ). Always parse/store as string.
9. Hapag [Link] (Schedules) vs [Link] (Track & Trace) — field naming differs be-
tween Hapag APIs. Normalize in your types.
10. Multiple VGM submissions are normal. Maersk booking 265012517 had 4 VGM RECE events — shippers often
resubmit with corrections.
11. Maersk multi-vessel routing: A single booking can use 3+ vessels (feeder → mainline → feeder). Parse ALL
transport events to get the complete route, not just the first vessel.
12. Hapag B/L number format: HLCUDE1250918387 (carrier prefix + country + sequential). Maersk B/L number =
booking number (e.g., 262444238 ).
13. Carrier codes for Maersk D&D: MAEU (Maersk), SEAU (Sealand), SEJJ (Sealand Asia), MCPU (MCC
Transport), MAEI (Maersk Line India). Use the correct code for the specific carrier entity.
Document maintained by: API Integration Team Last verified against live APIs: February 18, 2026
[Link] Page 37 of 37