Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Container Shipping Data: A Practical How-To Guide

· 6 min read · Home Tech

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

Container shipping data is the record of where a container is, what is inside it, and when it will arrive. To get useful data, you need the container number or booking reference, a carrier or aggregator that publishes tracking events, and a way to store and refresh those events. The shortest working method is: collect the identifiers, query the carrier's tracking page or API, normalise the event timestamps and locations, and schedule regular refreshes. This guide walks through that process for anyone building a spreadsheet, a small dashboard, or an automated feed.

What You'll Need

  • A container number (four letters plus seven digits, e.g. ABCD1234567) or a booking/bill of lading number from the shipper.
  • The name of the ocean carrier or freight forwarder handling the shipment.
  • A spreadsheet or small database for storing events.
  • Optional: a free or paid tracking API key from a carrier or a data aggregator if you want automation.
  • Optional: a scripting tool such as Python or a no-code automation service for scheduled refreshes.

Step-by-Step

  1. Collect the identifiers. Ask the shipper for the container number, the booking number, and the bill of lading number. The container number is the most reliable key because it travels with the box; booking numbers sometimes change when a shipment is rebooked. Write each identifier in its own column so you can search by any of them later.
  2. Identify the carrier and the tracking source. The carrier named on the bill of lading usually publishes the most authoritative events. If the shipment moves across several carriers, note each leg and its carrier. Aggregators can combine multiple carriers into one feed, but they may lag behind the carrier's own site by hours.
  3. Open the carrier's tracking page and test one container. Enter the container number and confirm that events appear. Check that the page shows a last-updated timestamp. If no events appear, try the booking number instead; some carriers index by booking rather than container until the box is loaded.
  4. Record the event types you see. Typical events include empty pickup, gate in, loaded on vessel, vessel departure, transshipment, vessel arrival, discharge, gate out, and empty return. Write down the exact wording each carrier uses, because labels differ between carriers and between versions of their portals.
  5. Build a simple table. Use columns for container number, carrier, event type, event location (port or terminal), event timestamp, and the time you retrieved the record. Keep the retrieval time separate from the event time; this lets you detect stale data later.
  6. Normalise timestamps and locations. Convert all times to a single time zone, preferably UTC, and keep the original local time in a separate column if you need it for reporting. Standardise port names to UN/LOCODE codes where possible so that "Shanghai" and "CNSHA" do not become two different places in your data.
  7. Set a refresh schedule. For active shipments, check once or twice a day; for long ocean legs, daily is usually enough. If you use an API, respect the rate limits published by the provider. Store each refresh as a new row rather than overwriting the old one, so you keep a history of changes.
  8. Add a simple status field. Derive a human-readable status such as "on water", "at transshipment port", "arrived", or "delivered" from the latest event. This makes the data usable in a dashboard without reading every row.
  9. Review exceptions weekly. Look for containers with no event for several days, events that go backwards in time, or a discharge event with no matching arrival. These usually indicate a missed update or a data entry error rather than a real problem, but they are worth checking.

Common Mistakes

  • Using the booking number as the only key. Booking numbers can change; the container number is more stable once the box is assigned.
  • Mixing local times from different ports without converting them. A departure at 23:00 in one time zone can look like it happened after arrival in another.
  • Overwriting old events instead of appending new ones. You lose the ability to see when a status actually changed.
  • Assuming an aggregator is always current. Aggregators can lag the carrier's own portal, especially around transshipment.
  • Ignoring terminal or port codes. Free-text port names create duplicates and make filtering unreliable.

Tips

  • Keep a small lookup table that maps each carrier's event wording to your own standard event types.
  • Store the raw response from any API alongside the parsed fields, so you can reprocess it if your parsing rules change.
  • Use the container number's check digit to catch typos before you query. Most container numbers follow an ISO check-digit rule that can be validated with a simple formula.
  • If you track many containers, group them by carrier and refresh in batches rather than one request per container.
  • Record the source URL or API endpoint for each event. When two sources disagree, the source tells you which one to trust.

Troubleshooting

If the carrier's tracking page returns no results, first check the container number for typos and confirm the check digit. Then try the booking number. If both fail, the shipment may not have been loaded yet, or the carrier may not publish tracking for that trade lane; contact the forwarder and ask which reference they use.

If events appear but stop updating, compare the last-updated timestamp on the page with the current time. A gap of more than a day on an active leg usually means the carrier has not posted a new event, not that your query is wrong. Try the carrier's own portal before assuming an API problem.

If an API returns an authentication error, check that the key is active and that you are sending it in the header the provider specifies. If you get a rate-limit error, slow down your requests and add a delay between calls. Do not retry immediately in a tight loop.

If your timestamps look wrong, confirm whether the source reports local port time or UTC. Convert everything to one zone before comparing. If locations look duplicated, standardise them to port codes and merge the duplicates.

If you need to reset a tracking integration, note that deleting stored events or clearing a database cannot be undone; export a copy first. Reinstalling an app or regenerating an API key will invalidate the old key, so update your scripts before you revoke it.

Frequently Asked Questions

What is the difference between a container number and a booking number?

A container number identifies the physical box and stays with it. A booking number identifies the reservation with the carrier and can change if the shipment is rebooked.

How often should I refresh container tracking data?

Once or twice a day is enough for most ocean shipments. Refresh more often only around arrival and customs clearance, and respect any rate limits if you use an API.

Can I track a container without an API?

Yes. Most carriers publish a public tracking page where you can enter the container or booking number manually. You can copy the events into a spreadsheet, though this is slower and easier to mistype.

Why do two tracking sites show different statuses?

They update at different times and may use different event definitions. The carrier's own portal is usually the most current; aggregators can lag by hours.

What does a transshipment event mean?

It means the container was discharged from one vessel and will be loaded onto another at an intermediate port. Expect a gap in movement events during the transfer.

Is container tracking data free?

Basic tracking on carrier websites is usually free. API access and aggregated feeds may require a commercial agreement; check the provider's terms rather than assuming a free tier covers your volume.