Skip to content

API Documentation

Copyright IBM Corporation and Maersk GTD Inc. 2018, 2019

Getting Started

TradeLens uses Swagger for its APIs. Swagger is a common framework for documenting REST APIs. Before starting your work with TradeLens, you should familiarize yourself with Swagger (if necessary), at https://swagger.io.

There are 4 sets of APIs: Event Publish, Subscription, Query, and Document Sharing. The steps below will help you understand how to work with Swagger and the APIs.

  • Become familiar with the REST APIs: Start reviewing the documentation by expanding the API definitions in Swagger. You can read the specification and submit test events from the APIs in the Sandbox environment. This will help you understand the APIs prior to writing any code. You can find the different API specifications for the platform by selecting them from the top right area Select a spec.

  • Authenticate in Swagger: Authentication is required for Swagger to use the APIs. If you are not already logged in, click on Login, at the top of the API page in the Swagger, and log in with your TradeLens credentials (ID and password). If you have not been provisioned to TradeLens yet, or if you receive a message that you are not a registered user, contact your TradeLens onboarding lead.

  • Test in Swagger: To test an API in Swagger, click on Try it out, modify the sample event body with your test data, and click on Execute to run the API. Check the response code and response body that is returned.

  • Develop client code for calling the APIs: Once you become familiar with the Swagger REST API specification, you can write your client code using any language. Note that publishing events directly from your client code requires using your system ID and the JSON Web Token (JWT) or "bearer" token. Three headers are required on the HTTPS request: Accept, Content-Type, and Authorization. See the Authentication and Token Generation for API usage section for more details.

Swagger URLs

There is Swagger for the Sandbox and Production zones.

Notes:

  • If you have been onboarded onto a different stack than "platform", replace "platform" with your stack name, for example "maersk", in the URLs below.
  • Before downloading and opening shared documents, ensure that you have antivirus protection per your company policy with the latest virus definitions.

Sandbox Swagger: https://platform-sandbox.tradelens.com/documentation/swagger/ Production Swagger: https://platform.tradelens.com/documentation/swagger/



API Updates

API Release Notes

05/20/2019

API Description Change / Swagger API Notes
POST /api/v1/consignments/consignmentSubcontracted New /
Event Publish
To support consignment hierarchies, this allows a relationship to be established between a consignment and its subconsignment.
POST /api/v1/consignments/transportEquipmentAdded Deprecated /
Event Publish
The POST /api/v2/transportEquipment API should be used instead. The carrier booking number is a required field and establishes the linkage between the consignment and transport equipment.
GET /api/v1/consignments Change /
Query
New response fields have been added to the consignments array.
cutOffs: Cutoff deadline dates for all the transport equipment in this consignment.
bookingData: data from the latest POST /api/v1/consignments.
parentConsignmentId: reference to a parent consignment when part of a consignment hierarchy.
subcontractIds: reference to subconsignment IDs when part of a consignment hierarchy.
GET /api/v1/consignments/events/{id} Change /
Query
New response field "description" is returned as part of the location of an event.
GET /api/v1/transportEquipment/events/{id} Change /
Query
New response field "description" is returned as part of the location of an event.
GET /api/v1/consignments/transportSummaries/{id} Change /
Query
New response field "description" is returned as part of several location objects.
GET /api/v1/transportEquipment/transportSummaries/{id} Change /
Query
New response field "description" is returned as part of several location objects.
PUT /api/v1/actionableDocFlows/billOfLading New /
Actionable Flows
Parse a Bill of Lading JSON document and handle the associated creation and setup of consignments and transport equipment.
PUT /api/v1/actionableDocFlows/shippingInstruction New /
Actionable Flows
Parse a Shipping Instructions JSON document and handle the associated creation and setup of consignments and transport equipment.
GET /api/v1/flowTransactions New /
Actionable Flows
Fetch all actionable flow transactions.
GET /api/v1/flowTransactions/{id} New /
Actionable Flows
Fetch a specific actionable flow transaction.
GET /api/v1/documentSchema Deprecated /
Document Sharing
Deprecated in favor of the new V2 version of the API.
GET /api/v2/documentSchema New /
Document Sharing
Replaces the deprecated V1 version of the API, providing more flexibility to handle documents associated with both consignments or transport equipment.
GET /api/v1/documents/{id}/metadata Deprecated /
Document Sharing
Deprecated in favor of the new V2 version of the API.
GET /api/v2/documents/{id}/metadata New /
Document Sharing
Replaces the deprecated V1 version of the API, providing more flexibility to handle documents associated with both consignments or transport equipment.
POST /api/v1/documents/bulk/documents Deprecated /
Document Sharing
Deprecated in favor of the new V2 version of the API.
POST /api/v2/documents/bulk/documents New /
Document Sharing
Replaces the deprecated V1 version of the API, providing more flexibility to handle documents associated with both consignments or transport equipment.
POST /api/v1/documents/search Deprecated /
Document Sharing
Deprecated in favor of the new V2 version of the API.
POST /api/v2/documents/search New /
Document Sharing
Replaces the deprecated V1 version of the API, providing more flexibility to handle documents associated with both consignments or transport equipment.
PUT /api/v1/documents Deprecated /
Document Sharing
Deprecated in favor of the new V2 version of the API.
PUT /api/v2/documents New /
Document Sharing
Replaces the deprecated V1 version of the API, providing more flexibility to handle documents associated with both consignments or transport equipment.

05/08/2019

API Description Change Notes
PATCH /api/v1/documentSchema/{id} New Deprecates a given version of a Document Schema
GET /api/v1/documentSchema Deprecated Replaced by the new /api/v2/documentSchema API that allows a more organized response to show active and inactive versions of the same schema. However, to aid the transition, a couple of changes were applied. A new optional request parameter, "includeInactive", allows the filtering of active vs inactive Document Schemas. Related, a new "status" field is included in the response.
GET /api/v2/documentSchema New This new version of the API supports multiple versions (active and inactive/deprecated) of the same schema whereas the former API only delivered the latest, active version. The response payload is more organized.
GET /api/v1/documentSchema/{id} Changed New optional request parameter, "includeInactive". Set to true to fetch nonactive Document Schema. Related, a new "status" field is included in the response.
POST /api/v1/tradeObjectIds New Query for a TradeLens object id by external references. Note, this is a "POST" because the search criteria is a complex JSON object that cannot be reduced to a fixed set of key/value pairs (typically used as a list of query parameters in a "GET").
GET /api​/v1​/transportEquipment​/transportEquipmentId Deprecated Replaced by the new generic API to search for trade object IDs.
GET ​/api​/v1​/consignments​/consignmentId Deprecated Replaced by the new generic API to search for trade object IDs.
GET /api/v1/consignments/events/{id} Changed New fields in the response, as part of the events array, to support newly named fields in document events. The fields are "action" and "doc". The "doc" field is a JSON object with several fields. In addition, a new field called "senderOrgName" is part of the events array to indicate the name of the organization that sent the event.
GET /api/v1/transportEquipment/events/{id} Changed Same as above, in GET /api/v1/consignments/events/{id}
GET /api/v1/consignments/transportSummaries/{id} Changed A new field called "senderOrgName" is part of the events array to indicate the name of the organization that sent the event.
GET /api/v1/transportEquipment/transportSummaries/{id} Changed A new field called "senderOrgName" is part of the events array to indicate the name of the organization that sent the event.
GET /api/v1/transportEquipment/partyAdded New Add visibility to documents associated with a piece of transport equipment. The feature to associate documents with a piece of transport equipment is coming soon. Note, this API is different from adding a party to a consignment which grants visibility to both events and documents. Once a party has been granted visibility to a consignment, that party is already automatically granted access to events of associated transport equipment.

04/11/2019

API Description Change Notes
GET /api/v1/documents/{id}/metadata Changed Additional fields: "docReferences" and "identifiers" in the document object.
PUT /api/v1/documents Changed Additional fields: "docReferences" and "identifiers" in the document object.

04/04/2019

(last updated on 4/11/2019)

API Description Change Notes
POST /api/v1/consignments Deprecated Being replaced with v2 POST. See below.
POST /api/v2/consignments New Creates or updates a consignment. Does not return the consignment or delegation IDs, but they can be fetched with the new query endpoints described below.
GET /api/v1/consignments/delegationIds New Query the delegation IDs for a consignment given a carrier booking number.
GET /api/v1/consignments/consignmentId New Query the consignment ID for a consignment given a carrier booking number.
GET /api/v1/consignments Changed Additional fields for searching: commodity harmonized code and commodity description.  Related, the response JSON schema has several new fields related to commodities.
GET /api/v1/consignments/events/{id} New Query for consignment events given a delegation ID.
PATCH /api/v1/consignments/*** Deprecated Being replaced to use a POST instead of a PATCH. See below.
POST /api/v1/consignments/*** New Replaces the former PATCH listed above.
POST /api/v1/transportEquipment Deprecated Being replaced with v2 POST. See below.
POST /api/v2/transportEquipment New Creates or updates a transport equipment. Does not return the transport equipment ID or delegation IDs, but they can be fetched with the new query endpoint described below.
GET /api/v1/transportEquipment/delegationIds New Query the delegation IDs for a transport equipment given a carrier booking number and equipment number. 
GET /api/v1/transportEquipment/transportEquipmentId New Query the transport equipment ID for a transport equipment given a carrier booking number and equipment number. 
GET /api/v1/transportEquipment/transportSummaries/{id} Changed Additional booking data fields added in the response JSON schema within the array of related consignments.
PATCH /api/v1/transportEquipment/*** Deprecated Being replaced to use a POST instead of a PATCH. See below.
POST /api/v1/transportEquipment/*** New Replaces the former PATCH listed above, except for "locationsUpdated" that has function replaced by dynamic transport plan functionality.
POST /api/v1/documentEvents/*** Changed No longer deprecated.
PATCH /api/v1/documentSchema/{id} New Similar to the v1 version, but adds support for new docReferences and identifiers fields.
GET /api/v1/documentSchema Changed New request parameter to include inactive schemas and a new response attribute to indicate the status of the schema.
GET /api/v1/documentSchema/{id} Changed New request parameter to include inactive schemas and a new response attribute to indicate the status of the schema.
GET /api/v1/documents/{id}/metadata Changed New response attributes: docReferences, identifiers.
PUT /api/v1/documents Changed New response attribute: docReferences, identifiers.

03/14/2019

API Description Change Notes
GET /api/v1/consignment/delegationIds New Query the delegation IDs for the consignment related to a given carrier booking number.
GET /api/v1/consignment/consignmentId New Query the consignment ID for the consignment related to a given carrier booking number.
GET /api/v1/transportEquipment/delegationIds New Query the delegation IDs for the transport equipment related to a given carrier booking number and equipment number.
GET /api/v1/transportEquipment/transportEquipmentId New Query the transport equipment ID for the transport equipment related to a given carrier booking number and equipment number.
POST/GET /visibility/v2/subscriptions/* Hidden Formerly deprecated subscription APIs have been removed from Swagger, but will continue to function for one more month before being disabled completely.
POST /api/v1/transportEquipment Updated A new equipmentType: 45R0: "REEFER HIGHCUBE (MECHANICALLY REFRIGERATED)" was added to the current list of equipment types.
PATCH /api/v1/transportEquipment/equipmentNumberUpdated Updated A new equipmentType: 45R0: "REEFER HIGHCUBE (MECHANICALLY REFRIGERATED)" was added to the current list of equipment types.

02/28/2019

API Description Change Notes
GET /api/v1/documents/* Update The "fileType" field was added in the response for all document sharing APIs except the bulk download.
POST /api/v1/transportEquipment/equipmentNumberUpdated Update The optional field "equipmentType" was added to the request schema. When present, the UI and query APIs will reflect the newly assigned value.
Event schema JSON for published events that related to documents. Update The "platformDocumentVersion" field was added to the document events published to subscriptions.
POST /visibility/v1/events/E*** (Multiple events removed - see Notes) Hidden Removed from Swagger after being deprecated. Will work for 1 more month. These events are all the old E*** events that are NOT associated with a document based event. The only remaining deprecated events in the Event Publish API swagger are associated with documents.
POST /visibility/v2/events/E468 Hidden Removed from Swagger after being deprecated. Will work for 1 more month.
GET /visibility/v1/shipments Hidden Removed from Swagger after being deprecated. Will work for 1 more month.
GET /visibility/v1/countryCodes Hidden Removed from Swagger after being deprecated. Will work for 1 more month.
GET /visibility/v1/eventTypes Hidden Removed from Swagger after being deprecated. Will work for 1 more month.
GET /visibility/v1/transportSummaries/{delegationId} Hidden Removed from Swagger after being deprecated. Will work for 1 more month.
GET /visibility/v1/events/{delegationId} Hidden Removed from Swagger after being deprecated. Will work for 1 more month.

API Refactoring Reference

If you were using the TradeLens APIs prior to early December 2018, the APIs have been refactored and the endpoints have changed. The information below can help you map the old APIs to the new APIs so you can make any necessary changes to your programs.

You can zoom and scroll to see the full content in the window below. There is also a download link at the bottom of the page for the PDF.
Note: Before downloading and opening documents, ensure that you have antivirus protection per your company policy with the latest virus definitions.

This browser does not support viewing the PDF. Please download the PDF file.

Download the TradeLens_API_Refactoring_mapping.pdf document.