# Ocean Container Tracking Scraper (Multi-Carrier JSON) (`steadfetch/ocean-container-tracking`) Actor

Track ocean containers and bills of lading from Evergreen (ShipmentLink) and COSCO in one normalized JSON schema: events, vessel, voyage, location, ETA and container details. For shipping container tracking, shipment visibility and supply-chain research. Plain HTTP, no browser.

- **URL**: https://apify.com/steadfetch/ocean-container-tracking.md
- **Developed by:** [Steadfetch](https://apify.com/steadfetch) (community)
- **Categories:** Developer tools, Automation
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 tracked reference delivereds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.
Since this Actor supports Apify Store discounts, the price gets lower the higher subscription plan you have.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Ocean Container Tracking Scraper (Multi-Carrier JSON)

Track ocean containers and bills of lading from **Evergreen (ShipmentLink)** and **COSCO** through one normalized JSON schema. Give it a list of container or bill-of-lading numbers; it returns the latest public movement, vessel, voyage, location and ETA for each reference.

### What it does

- Accepts container numbers (`4 letters + 7 digits`, for example `DRYU9684015`) and numeric bill-of-lading numbers (for example `6468636830`).
- `carrier: "auto"` detects the likely carrier from the reference format and falls back to the other validated source.
- Returns one dataset item per reference with public data: normalized `events[]` with ISO 8601 dates, plus `container`/`containers` details for bills of lading. COSCO movement history is added to `history[]` when the source publishes it.
- Plain HTTP, no browser and no proxies. Both sources answer from the platform egress.
- References without public data are logged and saved as run notes; they are **not** pushed to the dataset, so they are never billed.

### Example output

```json
{
  "url": "https://ct.shipmentlink.com/servlet/TDB1_CargoTracking.do",
  "scrapedAt": "2026-10-23T10:15:00.000Z",
  "ref": "DRYU9684015",
  "refType": "container",
  "carrier": "evergreen",
  "retrievedAt": "2026-10-23T10:15:00.000Z",
  "container": { "number": "DRYU9684015", "size": "40'(SH)" },
  "events": [
    {
      "at": "2026-10-13",
      "status": "Loaded (FCL) on vessel",
      "location": "OAKLAND, CA (US)",
      "vessel": "EVER MILD 1471",
      "voyage": "012W",
      "weightKg": 24657,
      "eta": "2026-11-13"
    }
  ]
}
```

A COSCO bill of lading returns `containers[]` (one row per container) plus `history[]` with the movement list the public endpoint publishes.

### Pricing

Pricing is **5 USD per 1,000 results** (tracked references delivered) by pay per event (`apify-default-dataset-item`), plus the Apify-recommended `apify-actor-start` event at 0.00005 USD per run. A reference without data is never pushed and never charged. No proxies and no browser are required for the two v1 sources.

**Works on the Apify free plan**: with the 5 USD monthly credit, about **999 tracked references** can be delivered per month (N = floor((5.00 - 0.00005) / 0.005)).

### Input

```json
{ "refs": ["DRYU9684015", "6468636830"], "carrier": "auto" }
```

- `refs` - container and/or bill-of-lading numbers (max 100 per run). Empty input falls back to the documented example container so the Store test always runs.
- `carrier` - `auto` (default), `evergreen` or `cosco`.

### FAQ

**Which carriers are supported?** Evergreen (ShipmentLink) and COSCO (elines eBusiness) in v1. Matson was dropped from v1 because no live public reference could be verified before the build (the tracking endpoint itself answers, but no public container or B/L was found to prove a result). Sinokor and Yang Ming are not included while their terms of use cannot be read over plain HTTP.

**Does it need an API key or login?** No. Both sources are public and work without authentication.

**Why is a reference missing from the dataset?** Either the carrier has no public tracking data for it, or the format is not recognized. The run log and the `ocean-container-tracking-notes` key-value store list every reference without data and the reason.

**Are dates in UTC?** Evergreen publishes dates only (`YYYY-MM-DD`). COSCO publishes a local date-time without an offset; it is normalized as `YYYY-MM-DDTHH:MM:SSZ` and should be read as source time.

**Can it monitor changes?** Not in v1. A watchlist/monitor mode (only new events) is a separate phase.

### Maintenance

- Sources are validated against robots.txt, terms of use and cost in [`docs/legal-gate.md`](docs/legal-gate.md).
- Evergreen requires a descriptive User-Agent. The Actor never uses a search-engine or AI-bot User-Agent, because ShipmentLink's robots.txt disallows those named groups.
- The Actor is tested daily by Steadfetch QA against a live reference. If a source changes its HTML or JSON contract, the Actor is repaired before any new build.

### Output schema

Dataset items are validated against [`.actor/dataset_schema.json`](.actor/dataset_schema.json) before they are pushed. Unvalidated items never reach the dataset.

# Actor input Schema

## `refs` (type: `array`):

Container numbers (4 letters + 7 digits, for example DRYU9684015) and/or numeric bill-of-lading numbers. When empty, the documented example container DRYU9684015 is used so the Store test always runs.

## `carrier` (type: `string`):

auto detects the likely carrier from the reference format and falls back to the other source. Set a carrier to query only that source.

## Actor input object example

```json
{
  "refs": [
    "DRYU9684015"
  ],
  "carrier": "auto"
}
```

# Actor output Schema

## `results` (type: `string`):

Dataset items validated against the item schema in dataset_schema.json (fields).

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "refs": [
        "DRYU9684015"
    ],
    "carrier": "auto"
};

// Run the Actor and wait for it to finish
const run = await client.actor("steadfetch/ocean-container-tracking").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "refs": ["DRYU9684015"],
    "carrier": "auto",
}

# Run the Actor and wait for it to finish
run = client.actor("steadfetch/ocean-container-tracking").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "refs": [
    "DRYU9684015"
  ],
  "carrier": "auto"
}' |
apify call steadfetch/ocean-container-tracking --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,steadfetch/ocean-container-tracking"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/uKUbaxJjLqREFtoTJ/builds/350IgZaevrFyBdq3w/openapi.json
