# SiteCheck Trade & Energy – Container Demurrage & Detention Calculator

> SiteCheck Trade & Energy – Container Demurrage & Detention Calculator is a paid API for AI agents from api.tradeenergy-api.workers.dev, paid per call via x402, $0.002/call, status unknown (last checked 2026-10-29).

Calculates container demurrage or detention charges given start/end dates, free days, and carrier tiered daily rates, returning chargeable days, tier breakdown, and total cost per container and overall.

## Facts

- Endpoint: GET https://api.tradeenergy-api.workers.dev/api/logistics/demurrage-detention?utm_source=zero.xyz
- Price: $0.002/call
- Payment: x402
- Status: unknown
- Last checked: 2026-10-29
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/sitecheck-trade-energy-container-demurrage-detention-calculator-807048f3
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ASg-0gYuBWSf6nJDmjkHu

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability sitecheck-trade-energy-container-demurrage-detention-calculator-807048f3
```

Example prompt: Can you calculate the demurrage charges for 3 containers that were discharged on 2026-09-24 and returned empty on 2026-10-18, with 7 free days and carrier rates of 1-4:75, 5-8:150, 9+:250 USD per day?

## When to prefer this

Use this endpoint when you have all charge parameters on hand (dates, free days, tiered rates) and need a precise, day-by-day tier breakdown without looking up carrier tariffs. Prefer this over manual spreadsheet calculation when automating invoice validation, freight cost estimation, or multi-container billing in a workflow. It is not suitable if you need the endpoint to fetch carrier tariffs automatically.

## Known failure modes

- Missing required parameters (start, end, freeDays, rates) returns an error
- Invalid date format (not YYYY-MM-DD) causes parsing failure
- Malformed rates string (wrong separators or missing '+' on last tier) returns an error
- End date before start date may return zero or negative chargeable days
- freeDays value outside 0-60 range may be rejected
- Carrier tariff data is not auto-fetched — rates must be supplied manually

## How this service works

Container demurrage or detention calculator: from the start date (discharge or gate-out), end date (gate-out or empty return), free days and the carrier's tiered daily rates you supply (e.g. 1-4:75,5-8:150,9+:250), returns chargeable days, the day-by-day tier split and the total per container and for all containers. Counts calendar days, start day included unless you say otherwise. Carrier tariffs are not looked up.

## Output

Returns a JSON object with: total chargeable days (daysUsed), free days granted, date free time ends (freeTimeEnds), an array of tier objects (tier label, days in that tier, daily rate, tier subtotal), cost per container (perContainer), total cost across all containers (total), number of containers, and currency label.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET"
     ],
     "type": "string"
    },
    "queryParams": {
     "type": "object",
     "required": [
      "start",
      "end",
      "freeDays",
      "rates"
     ],
     "properties": {
      "end": {
       "type": "string",
       "description": "End date YYYY-MM-DD: gate-out full (demurrage) or empty return (detention) (required)"
      },
      "rates": {
       "type": "string",
       "description": "Tiers after free time, 'from-to:rate' comma separated, last open-ended with '+', e.g. 1-4:75,5-8:150,9+:250 (required)"
      },
      "start": {
       "type": "string",
       "description": "Start date YYYY-MM-DD: discharge (demurrage) or gate-out full (detention) (required)"
      },
      "currency": {
       "type": "string",
       "description": "Currency label for the output, default USD"
      },
      "freeDays": {
       "type": "string",
       "description": "Free days granted, 0-60 (required)"
      },
      "containers": {
       "type": "string",
       "description": "Number of containers, default 1"
      },
      "countStartDay": {
       "type": "string",
       "description": "true (default) counts the start date as day 1; false starts on the next day"
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "tiers": [
   {
    "days": 4,
    "rate": 75,
    "tier": "1-4",
    "amount": 300
   },
   {
    "days": 4,
    "rate": 150,
    "tier": "5-8",
    "amount": 600
   }
  ],
  "total": 4300,
  "currency": "USD",
  "daysUsed": 20,
  "freeDays": 7,
  "containers": 2,
  "freeTimeEnds": "2026-10-07",
  "perContainer": 2150,
  "chargeableDays": 13
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/sitecheck-trade-energy-container-demurrage-detention-calculator-807048f3/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.tradeenergy-api.workers.dev](https://www.zero.xyz/host/api.tradeenergy-api.workers.dev/llms.txt)
