How to Integrate Maersk's Track and Trace API

A step-by-step guide to Maersk's DCSA Track and Trace API: OAuth setup, the tracking endpoint, event mapping, and fixing 401 errors.

Maersk runs one of the few genuinely usable developer portals among ocean carriers, and if you're pulling container milestones into your TMS or ERP by hand right now, it's worth the afternoon it takes to wire up properly. This guide walks through connecting your own system to Maersk's Track and Trace API, from developer portal registration through OAuth2 token exchange to parsing the actual JSON events you'll map into your freight visibility stack. If you ship enough volume on Maersk that a logistics coordinator is still pasting container numbers into maersk.com/tracking every morning, this is the fix.

Before You Start

You need a Maersk.com account, access to developer.maersk.com, and a clear answer to one question before you touch any code: do you need public "neutralized" tracking, or private shipment data tied to your own bookings and contract? Get this wrong and you'll register for the wrong product and have to start over.

Basic tracking, schedules, and reference data are available via developer registration; transactional booking and rated quotes require an active Maersk customer code and B2B contract. In practice that means a developer can sign up, generate keys, and start pulling neutralized container events the same day. High-value transactional capabilities like direct ocean bookings and eBL require verified B2B customer authorization, so if your end goal is also pushing bookings through Maersk's API (not just tracking), budget extra time for that contract verification step separately.

Step 1–2: Register and Create an App

Before you write a line of integration code, you need an application registered in Maersk's developer portal and subscribed to the correct tracking product. Getting the product choice wrong here is the single most common reason people end up re-registering a week into a build.

  1. Create a developer.maersk.com account using your business email, then log in and navigate to the API catalogue.
  2. Register a new application under your account. This generates the client credentials (client ID and secret) you'll need for OAuth2 and a Consumer-Key you'll attach to every request.
  3. Subscribe to the right tracking product. Maersk offers two distinct options here: Track and Trace Plus, which gives detailed milestone history for a container or B/L, and MEC Tracking, which provides event-level data for Maersk, Hamburg Süd, and Sealand containers. If you only ship under the Maersk brand, Track and Trace Plus is usually the right call. If your freight moves under Hamburg Süd or Sealand bookings too, MEC Tracking gives you the broader net.
  4. Enable the sandbox environment for your application so you can test against mock data before pointing anything at production.

Both products run on the same underlying standard: both follow DCSA Track and Trace v2.2 in production. That matters later, when you're parsing the response.

Step 3: Generate Credentials and Request an OAuth Token

Maersk's API gateway doesn't use API keys alone. Authentication uses OAuth 2.0 Client Credentials and Consumer-Key headers. That's two separate things you need to get right: a bearer token from the OAuth flow, and a static Consumer-Key header that identifies your registered application on every call.

The token endpoint is fixed: tokenUrl: https://api.maersk.com/customer-identity/oauth/v2/access_token. A minimal client_credentials request looks like this:

POST https://api.maersk.com/customer-identity/oauth/v2/access_token
Content-Type: application/x-www-form-urlencoded

grant_type=client_credentials
&client_id=YOUR_CLIENT_ID
&client_secret=YOUR_CLIENT_SECRET

You'll get back a bearer token with a standard expiry window. Don't hardcode a token and forget about it, build a refresh routine into your integration layer that requests a new token before the old one lapses, not after a 401 starts failing silently on a cron job nobody's watching. This is the kind of maintenance detail that catches teams off guard when the person who built the original integration leaves the company.

Step 4: Call the Tracking Endpoint

With a valid token in hand, the actual tracking call is straightforward. The endpoint is GET /track-and-trace-private/shipments, and it accepts three different lookup keys depending on what reference you have on file. It retrieves neutralized container and shipment milestones via a RESTful API, supporting lookup by container number, bill-of-lading number, or booking reference.

A sample request:

GET https://api.maersk.com/track-and-trace-private/shipments?carrierBookingReference=ABC123456
Consumer-Key: YOUR_CONSUMER_KEY
Authorization: Bearer YOUR_ACCESS_TOKEN

You can also query by equipmentReference (container number) or bill of lading number directly, which is useful if your WMS or ERP only stores container numbers rather than the booking reference. One thing worth flagging up front: the response returns neutralized container and shipment milestones, not tied to bill-of-lading party affiliation. That's deliberate on Maersk's part, it's a public-facing dataset designed to be usable without proving you're a party to the specific booking, which is also why developer-tier access gets you this far without a signed contract.

Step 5: Parse the DCSA Event Model

The response body follows the DCSA Track and Trace schema, which means three object types matter most for mapping into your TMS: shipment events, transport events, and equipment events. The field set you'll spend the most time mapping sits inside the TransportCall object: carrierServiceCode, vesselIMONumber, carrierVoyageNumber, and modeOfTransport, which enumerates as VESSEL, RAIL, TRUCK, BARGE, or MULTIMODAL.

Each event carries planned and actual timestamps, so your parsing logic needs to distinguish between an ETA and a confirmed arrival rather than treating every timestamp field the same way. Build your mapping table once, field by field, rather than guessing at runtime.

DCSA objectKey fieldsMaps to (typical TMS field)
TransportCallcarrierServiceCode, vesselIMONumber, carrierVoyageNumber, modeOfTransportLeg/voyage reference, transport mode
LocationlocationName, UNLocationCode, countryCodePort of loading/discharge
ShipmentTrackingevent timestamps (planned/actual)Milestone status, ETA field

The payoff of working from a DCSA-aligned schema instead of a carrier-proprietary one: Maersk is a DCSA founding member, and its API output maps cleanly to the DCSA event model, so if you're building a multi-carrier integration, Maersk's data is among the easiest to normalize alongside Hapag-Lloyd, CMA CGM, and ONE. If you're already tracking containers from another DCSA-aligned carrier, you can often reuse 70-80% of your parsing logic with only the authentication layer changing.

Step 6: Verify It Worked

Test with a container or booking reference you already know the status of, and cross-check the JSON output against what's showing on Maersk's own public tracking page. If the milestone timestamps and location codes line up, your parsing logic is sound.

What you're confirming the API actually delivers: neutralized container and shipment milestones via a RESTful API, supporting lookup by container number, bill-of-lading number, or booking reference, returning transport, equipment, and shipment events with planned and actual timestamps. If your parsed output includes all three event categories (transport, equipment, shipment) with both planned and actual timestamps populated where expected, you've got a working integration.

Failure Mode: 401s and Empty Responses

The documented error you'll hit most often during setup is straightforward: a bad or missing credential returns a description: Unauthorized — invalid or missing API key. Check that your Consumer-Key header is present on every call (not just the token request) and that your bearer token hasn't expired.

The subtler failure mode shows up later, after authentication is clearly working: you get a 200 response with an empty array where you expected shipment events. This usually means your developer-tier key is registered but not linked to an actual Maersk customer code or contract, so the API has nothing private to return even though your credentials are valid. If this happens, open a ticket with Maersk Developer Support and ask specifically to have your application's production access tied to your organization's customer code. Sandbox credentials won't fix this, since sandbox data is mock data by design.

Also build in rate-limit discipline from day one. Don't poll the same container every sixty seconds hoping for a status change, batch your lookups and space them out. Ocean carrier APIs go down or throttle requests during peak season, and your integration needs retry logic and a fallback to manual lookup so tracking doesn't silently go stale. A container doesn't move fast enough to justify aggressive polling anyway, hourly or even every-few-hours checks are usually plenty for ocean freight.

Where This Fits in a Broader Carrier Connectivity Strategy

If you only move freight on Maersk, this one integration might be enough. Most shippers reading this run road, parcel, and ocean simultaneously, and repeating this OAuth exchange and field-mapping exercise for every carrier doesn't scale past two or three connections before it becomes its own maintenance project. Each major ocean carrier runs its own self-serve developer portal with its own quirks, even when they share the same DCSA foundation underneath.

This is the exact gap that platforms like Cargoson, nShift, MercuryGate, and Descartes exist to absorb, maintaining the carrier-specific authentication flows, field mappings, and version upgrades across parcel, LTL and ocean connections so your internal team isn't the one fielding a support ticket every time Maersk bumps its DCSA schema version. Whether that trade-off makes sense depends on how many carrier connections you're actually maintaining and whether your team has the bandwidth to own this long-term.

Once tracking is flowing reliably, the natural next step on Maersk's platform is the booking and eBL APIs, which follow the same DCSA and OAuth2 pattern but add the B2B contract verification layer mentioned earlier. That's a separate build, and worth its own walkthrough once you've got Track and Trace stable in production.