Monitor your credit consumption

Monitor your credit consumption

Your API key comes with credits, grouped into periods (for example, one period per month of your subscription). Use the /consumption endpoints to:

  • see how many credits you have left,
  • list your periods,
  • for shipment credits, list the shipments that used a credit in a period.

Endpoints

MethodPathReturns
GET/consumption/current-periodThe current period
GET/consumption/current-period/shipmentsThe shipments consumed in the current period
GET/consumption/periodsAll your periods
GET/consumption/periods/{periodId}One period
GET/consumption/periods/{periodId}/shipmentsThe shipments consumed in one period

Add these paths to the base URL of the API:

APIBase URLCredit type/shipments
Container Trackinghttps://api.sinay.ai/container-tracking/api/v2ShipmentYes
Webhookhttps://api.sinay.ai/webhook/api/v1ShipmentYes
Safecubehttps://api.sinay.ai/safecube/api/v1ShipmentYes
Congestionhttps://api.sinay.ai/congestion/api/v1CongestionNo

Container Tracking, Webhook and Safecube use the same shipment credits. Their /consumption endpoints return the same periods and the same shipments.

Authentication

Authenticate with your API key in the API_KEY header, as for any other call.

API_KEY: <your_api_key>

You only see the credits of the key you send.


Current period

Returns the period that is active now.

curl "https://api.sinay.ai/container-tracking/api/v2/consumption/current-period" \
  -H "API_KEY: <your_api_key>"
{
  "id": "3f6c1b2e-8a4d-4c7e-9f21-5b0d6a7e9c13",
  "credits": 412,
  "creditsInitial": 500,
  "validityDateBegin": "2026-10-01T00:00:00Z",
  "validityDateEnd": "2026-10-31T23:59:59Z",
  "expired": false
}

All periods

Returns all the periods of your key: past, current, and upcoming.

curl "https://api.sinay.ai/container-tracking/api/v2/consumption/periods" \
  -H "API_KEY: <your_api_key>"
{
  "periods": [
    {
      "id": "3f6c1b2e-8a4d-4c7e-9f21-5b0d6a7e9c13",
      "credits": 412,
      "creditsInitial": 500,
      "validityDateBegin": "2026-10-01T00:00:00Z",
      "validityDateEnd": "2026-10-31T23:59:59Z",
      "expired": false
    },
    {
      "id": "a91d0c47-2e3b-4f58-b6a0-7c2e4d1f8b95",
      "credits": 0,
      "creditsInitial": 500,
      "validityDateBegin": "2026-09-01T00:00:00Z",
      "validityDateEnd": "2026-09-30T23:59:59Z",
      "expired": true
    }
  ]
}

One period

Returns one period, using an id from /consumption/periods. The response has the same format as /consumption/current-period.

curl "https://api.sinay.ai/container-tracking/api/v2/consumption/periods/a91d0c47-2e3b-4f58-b6a0-7c2e4d1f8b95" \
  -H "API_KEY: <your_api_key>"

Period fields

FieldTypeDescription
idUUIDID of the period
creditsintegerCredits left in the period
creditsInitialintegerCredits available at the start of the period
validityDateBegindate-time (UTC)Start of the period
validityDateEnddate-time (UTC)End of the period
expiredbooleantrue if the period is over or was ended early

Credits used in the period = creditsInitial − credits.


Shipments consumed in a period

Returns the shipments that used a credit in a period, with the date each one was first tracked in that period. Only available for shipment credits (Container Tracking, Webhook, Safecube).

Current period

curl "https://api.sinay.ai/container-tracking/api/v2/consumption/current-period/shipments" \
  -H "API_KEY: <your_api_key>"

A given period, page 2 with 50 results per page

curl -G "https://api.sinay.ai/container-tracking/api/v2/consumption/periods/a91d0c47-2e3b-4f58-b6a0-7c2e4d1f8b95/shipments" \
  -H "API_KEY: <your_api_key>" \
  --data-urlencode "page=1" \
  --data-urlencode "size=50"

Query parameters

NameTypeDescriptionDefault
pageinteger ≥ 0Page number, starting at 00
sizeinteger from 1 to 500Number of results per page. Values above 500 are reduced to 500100

An invalid page or size (not a number, or below the minimum) returns 400.

Response

{
  "consumedShipments": [
    {
      "purchaseObject": "EMCU1686335",
      "createdAt": "2026-10-07T13:13:44Z"
    },
    {
      "purchaseObject": "WBPU7087049",
      "createdAt": "2026-10-06T14:43:57Z"
    }
  ],
  "page": 0,
  "size": 100,
  "totalElements": 2
}
FieldTypeDescription
consumedShipments[].purchaseObjectstringShipment that used a credit (container number, booking or B/L number)
consumedShipments[].createdAtdate-time (UTC)When the shipment used its credit in this period
pageintegerCurrent page number
sizeintegerPage size
totalElementsintegerTotal number of shipments consumed in the period

Errors

StatusWhen
400page or size is invalid
401API_KEY is missing or invalid
404Unknown path, unknown periodId for your key, no current period, or /shipments called on an API without shipment credits
429Rate limit reached

How credits are consumed

  • Shipment credits (Container Tracking, Webhook, Safecube): a credit is used the first time a shipment is tracked in a period. Tracking the same shipment again in the same period uses no extra credit. Calls that return 2xx, 404 or 503 count; other errors don't.
  • Congestion and Schedule credits: only successful calls (2xx) use credits.
  • On an unlimited plan, credits can go below zero. It then shows how much you used beyond the initial amount.

Good to know

  • Rate limit: up to 10 calls every 10 seconds on /consumption.
  • Calls to /consumption are free: they use no credits and don't appear in your /logs.
  • Calls per day or month: use /shipment-usage (Container Tracking, Webhook, Safecube) to get the shipments called per day or per month, independently of your credit periods.