TimeToCargo

Companies

Find supported carriers, their SCAC codes, and tracking types

GET /v2/companies lists supported carriers, their SCAC codes, and available tracking number types. Use it to choose company and type for single-number and batch requests.

The data field contains an object whose keys are company names and whose values are { scac, cn, bl, bk }. Pass the scac value as company. The cn, bl, and bk flags indicate the tracking types supported by each carrier:

Support flagtype valueTracking number
cncontainerContainer number
blblBill of lading number
bkbkBooking number

A flag set to true means that tracking type is supported. Automatic carrier detection (company=AUTO) is available only for type=container.

The response does not currently include a separate carrier availability status. A tracking request may return LINE_IS_UNDER_MAINTENANCE when work on the data source temporarily prevents tracking. Try again later. There is no need to change the SCAC code because of this status.

Request example

The example retrieves the companies list, selects carriers that support bill of lading tracking (bl: true), and prints their names and SCAC codes.

// Find carriers that support bill of lading tracking.
const res = await fetch("https://tracking.timetocargo.com/v2/companies?api_key=YOUR_TOKEN", {
    headers: { Accept: "application/json" },
});
// Check the HTTP response before using the result.
if (!res.ok) throw new Error(`HTTP ${res.status}`);
// Read JSON; success and status describe the request result.
const body = await res.json();
if (body.success === false) throw new Error("Request failed");

// Select only carriers that support bills of lading.
const typeFlag = { container: "cn", bl: "bl", bk: "bk" };
const carriers = Object.entries(body.data)
    .filter(([, flags]) => flags[typeFlag.bl])
    .map(([name, flags]) => ({ name, scac: flags.scac }));
console.log(carriers);

For HTTP status and API result handling, see Error handling.

Last updated on

On this page