Shipment and container data in Terminal49
After you’ve successfully made a tracking request, Terminal49 will begin to track shipments and store relevant information about that shipment on your behalf. The initial tracking request starts this process, collecting available data from carriers and terminals. Terminal49 then periodically checks for new updates and pulls data from carriers and terminals to keep the stored data up to date. You can access data about shipments and containers on your tracked shipments any time. We will introduce the basics of this method below. In practice, you would typically use webhooks (described in the next section) rather than polling for shipment data. A webhook is a callback URL that receives HTTP POST requests from the Terminal49 API whenever tracking data changes.List all your tracked shipments
If your tracking request was successful, you will now be able to list your tracked shipments. Try it below. Click “Headers” and replace YOUR_API_KEY with your API key. Sometimes it may take a while for the tracking request to show up, but usually no more than a few minutes. If you had trouble adding your first shipment, try adding a few more. We suggest copy and pasting the response returned into a text editor so you can examine it while continuing the tutorial.http
Why so much JSON? (A note on JSON:API)
The Terminal49 API is JSON:API compliant. JSON:API libraries can translate the response into a full object model compatible with an ORM, which is powerful but produces larger, more structured payloads. If you parse JSON directly, this can feel verbose. For production use, consider adopting a JSON:API client library to get the most out of the format. For this tutorial, you will work with the data directly.
Authentication
The API uses HTTP Bearer Token authentication. This means you send your API Key as your token in every request. Webhooks are associated with API tokens, which is how Terminal49 identifies which account to send shipment updates to.Anatomy of shipments JSON response
Here’s what you’ll see come back after you get the /shipments endpoint. For clarity, some fields have been replaced with ellipses (…) and key areas are bolded. The data attribute contains an array of objects. Each object is of typeshipment and includes attributes such as bill of lading number and port of lading. Each shipment object also has relationships to structured data objects like ports and terminals, as well as a list of containers on the shipment.
You can access these structured elements through the API. Terminal49 cleans and enhances the data from the shipping line, so you get a pre-defined object for each port, terminal, and other entity.
Sample code: listing tracked shipments in a Google Sheet
Below is code written in Google App Script that lists the current shipments into the current sheet of a spreadsheet. App Script is very similar to Javascript. Because Google App Script does not have native JSON API support, we need to parse the JSON directly, making this example an ideal real world application of the API.List all your tracked containers
You can also list out all of your Containers. Container data includes terminal availability, last free day, holds, fees, and other logistical information that you might use for drayage operations at port. Try it below. Click “Headers” and replace YOUR_API_KEY with your API key. We suggest copy and pasting the response returned into a text editor so you can examine it while continuing the tutorial.http