# demurrage.audit

Audit up to 100 U.S. demurrage or detention invoices against 46 CFR Part 541 (2026-11-20), recalculate charges and draft disputes.

- REST: `POST https://api.kanagu.dev/v1/demurrage/audit`
- MCP tool: `demurrage.audit` at https://api.kanagu.dev/mcp
- Price: $0.50 USD per invoice, on successful calls only. Trial: 10 calls per IP per UTC day without a key, shared by REST and MCP.
- Auth: `Authorization: Bearer <key>` for billed calls. Retries: reuse `Idempotency-Key`.

## Request body

- `invoices` (array of object, required)
- `invoices[].invoice` (object, required): One invoice for one container and charge type. Extract required information from all sections and attachments before omitting an absent field.
- `invoices[].invoice.number` (string (max 400 chars))
- `invoices[].invoice.issuer` (string (max 400 chars))
- `invoices[].invoice.issuerType` ("ocean_common_carrier" | "marine_terminal_operator" | "nvocc" | "other", required)
- `invoices[].invoice.billedParty` (string (max 400 chars))
- `invoices[].invoice.billedPartyType` ("ocean_common_carrier" | "marine_terminal_operator" | "nvocc" | "other", required)
- `invoices[].invoice.liabilityBasis` (string (max 400 chars))
- `invoices[].invoice.direction` ("import" | "export", required)
- `invoices[].invoice.chargeType` ("demurrage" | "detention", required)
- `invoices[].invoice.billsOfLading` (array of string (max 400 chars))
- `invoices[].invoice.container` (string (max 400 chars))
- `invoices[].invoice.dischargePort` (string (max 400 chars))
- `invoices[].invoice.invoiceDate` (string): Local calendar date, year 1000–2999.
- `invoices[].invoice.dueDate` (string): Local calendar date, year 1000–2999.
- `invoices[].invoice.freeDays` (integer (0 to 730))
- `invoices[].invoice.freeTimeStart` (string): Local calendar date, year 1000–2999.
- `invoices[].invoice.freeTimeEnd` (string): Local calendar date, year 1000–2999.
- `invoices[].invoice.availabilityDate` (string): Local calendar date, year 1000–2999.
- `invoices[].invoice.earliestReturnDate` (string): Local calendar date, year 1000–2999.
- `invoices[].invoice.chargedDates` (array of string)
- `invoices[].invoice.billedDays` (integer (0 to 730))
- `invoices[].invoice.ratesCents` (array of integer (0 to 1000000000000)): Daily rates applied to the billed dates, in USD cents.
- `invoices[].invoice.amountCents` (integer (0 to 1000000000000)): USD cents.
- `invoices[].invoice.rateRule` (string (max 400 chars))
- `invoices[].invoice.disputeContact` (string (max 400 chars))
- `invoices[].invoice.disputeInstructions` (string (max 400 chars)): Dispute method shown on the invoice. Include the public website address or the destination of any QR code or digital watermark.
- `invoices[].invoice.disputeRequestDays` (integer (0 to 730))
- `invoices[].invoice.disputeResolutionDays` (integer (0 to 730))
- `invoices[].invoice.certifiesFmcCompliance` (boolean)
- `invoices[].invoice.certifiesIssuerDidNotContribute` (boolean)
- `invoices[].invoice.correctsWrongBilledParty` (boolean)
- `invoices[].invoice.documentText` (string (max 32000 chars)): Text from the invoice and its attachments. Labeled dates in this text are hints for review. Enter structured dates in ISO YYYY-MM-DD format.
- `invoices[].invoice.notes` (string (max 400 chars)): Additional free-text notes about the invoice.
- `invoices[].structuredFieldsComplete` (boolean): Set to true after confirming that the structured fields capture all relevant information from the invoice, its attachments, shipment records, and the applicable tariff. Without this confirmation, any non-empty free text requires review, including invoice identifiers, names, text fields, and evidence references.
- `invoices[].events` (object): Import demurrage runs from discharge or availability to gate-out. Import detention defaults to gate-out through empty return. Export demurrage starts at full gate-in and uses the tariff's exportDemurrage rules. Export detention defaults to empty pickup through full gate-in.
- `invoices[].events.discharge` (string): Local calendar date, year 1000–2999.
- `invoices[].events.availability` (string): Local calendar date, year 1000–2999.
- `invoices[].events.earliestReturn` (string): Published earliest receipt date (ERD) for the export booking, from an independent record. Actual gate-in may precede it.
- `invoices[].events.erdChanges` (array of object): Published terminal ERD changes for this export detention shipment, in announcement order. For a same-day pickup or return, include the change only if announced while the shipper held the container. Use an empty array if records confirm no change.
- `invoices[].events.erdChanges[].announcedOn` (string, required): Facility-local date the terminal publicly announced the change.
- `invoices[].events.erdChanges[].previousErd` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.erdChanges[].newErd` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.gateOut` (string): Local calendar date, year 1000–2999.
- `invoices[].events.emptyReturn` (string): Local calendar date, year 1000–2999.
- `invoices[].events.emptyPickup` (string): Export equipment pickup.
- `invoices[].events.fullGateIn` (string): Delivery of the full export container to the terminal.
- `invoices[].events.vesselLoad` (string): Export container loaded on vessel.
- `invoices[].events.loadedOnOriginalVessel` (boolean): Whether loading records confirm the container loaded on the originally scheduled vessel and voyage. Without this fact, a documented roll indicates a missed original voyage. Departure dates alone do not identify the voyage.
- `invoices[].events.cargoCutoff` (string): Last date for full gate-in on the originally booked export voyage.
- `invoices[].events.scheduledSailDate` (string): Scheduled departure date of the originally booked vessel.
- `invoices[].events.actualSailDate` (string): Actual departure date of the vessel carrying this container.
- `invoices[].events.rolls` (array of object): Documented, non-overlapping periods attributable to an export vessel roll. Start and end dates are inclusive.
- `invoices[].events.rolls[].startDate` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.rolls[].endDate` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.rolls[].responsibility` ("carrier" | "customer" | "unknown", required)
- `invoices[].events.rolls[].resolutionDate` (string | null): Date the customer resolved the cause. Null means the cause was still unresolved at the end of the roll period.
- `invoices[].events.rolls[].newScheduledSailDate` (string): Scheduled departure of the replacement vessel booked on startDate. Supply each replacement schedule when the tariff uses a scheduled sailing cutoff.
- `invoices[].events.lateDocumentation` (array of object): Documented periods when the shipper's late paperwork delayed an export container. Start and end dates are inclusive.
- `invoices[].events.lateDocumentation[].startDate` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.lateDocumentation[].endDate` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.blockedDays` (array of object): Days of verified full-day inability to move this container for this charge, including lack of any authorized alternate facility or appointment.
- `invoices[].events.blockedDays[].date` (string, required): Local calendar date, year 1000–2999.
- `invoices[].events.blockedDays[].reason` ("terminal_closed" | "container_unavailable" | "appointment_unavailable", required)
- `invoices[].events.blockedDays[].reference` (string (max 400 chars))
- `invoices[].terms` (object)
- `invoices[].terms.reference` (string (max 400 chars), required): Applicable tariff, contract or terminal schedule reference.
- `invoices[].terms.freeDays` (integer (0 to 730), required)
- `invoices[].terms.freeDayBasis` ("calendar" | "business", required)
- `invoices[].terms.freeTimeStartsAfter` ("discharge" | "availability" | "gate_in" | "empty_pickup"): Tariff milestone for starting free time. gate_in uses events.fullGateIn and empty_pickup uses events.emptyPickup. If omitted for import demurrage, compare discharge and availability when both are recorded. Other charges use their default milestones.
- `invoices[].terms.countBlockedFreeDays` (boolean): Whether verified blocked days count toward free time. Defaults to true for calendar-day free time and false for business-day free time.
- `invoices[].terms.chargeDayBasis` ("calendar" | "business", required)
- `invoices[].terms.countBlockedChargeDays` (boolean): Whether verified blocked days count after free time under the tariff. Defaults to true for calendar-day charges and false for business-day charges.
- `invoices[].terms.includeStartDay` (boolean, required): True to begin counting on the milestone date, false to begin the following day.
- `invoices[].terms.includeEndDay` (boolean, required): Whether the day the charge period ends can be charged.
- `invoices[].terms.exportDemurrage` (object): Export demurrage rules transcribed from the supplied tariff for the circumstances of this shipment.
- `invoices[].terms.exportDemurrage.chargeableCauses` (array of object): Complete list of causes the tariff permits after free time. An empty array means none apply. Omit if the tariff is unclear. Days with conflicting chargeable causes require review.
- `invoices[].terms.exportDemurrage.endsAt` ("vessel_load" | "scheduled_sail" | "earlier_of_load_and_scheduled_sail" | "actual_sail"): Tariff milestone ending export demurrage. Supply when recording a scheduled or actual departure date. Without either date, the default is vessel load.
- `invoices[].terms.exportDetention` (object)
- `invoices[].terms.exportDetention.extendFreeTimeOnErdChange` (boolean, required): Whether the tariff adds working days from the previous ERD through the day before the new ERD for a postponement announced while the shipper holds the container within free time.
- `invoices[].terms.weekend` (array of integer (1 to 7)): ISO weekday numbers excluded in business-day mode.
- `invoices[].terms.usHolidays` ("US" | string): Include national or state public holidays in business-day mode. Dataset covers 2020–2035.
- `invoices[].terms.holidays` (array of string): Additional holidays excluded in business-day mode.
- `invoices[].terms.tiers` (array of object, required)
- `invoices[].terms.tiers[].fromChargedDay` (integer (1 to 730), required)
- `invoices[].terms.tiers[].rateCents` (integer (0 to 1000000000000), required): USD cents.
- `invoices[].evidence` (object): Independent records for checking stated invoice details. Use the same names, reference and dispute details where they match. Certification booleans describe whether the certified facts are true.
- `invoices[].evidence.billsOfLading` (array of string (max 400 chars))
- `invoices[].evidence.container` (string (max 400 chars))
- `invoices[].evidence.dischargePort` (string (max 400 chars))
- `invoices[].evidence.invoiceDate` (string): Local calendar date, year 1000–2999.
- `invoices[].evidence.dueDate` (string): Local calendar date, year 1000–2999.
- `invoices[].evidence.disputeContact` (string (max 400 chars))
- `invoices[].evidence.disputeInstructions` (string (max 400 chars)): Dispute method shown on the invoice. Include the public website address or the destination of any QR code or digital watermark.
- `invoices[].evidence.certifiesFmcCompliance` (boolean)
- `invoices[].evidence.certifiesIssuerDidNotContribute` (boolean)
- `invoices[].evidence.liableParty` (object): Use the same legal entity names as on the invoice when they match.
- `invoices[].evidence.liableParty.name` (string (max 400 chars), required)
- `invoices[].evidence.liableParty.reference` (string (max 400 chars), required): Independent evidence identifying the sole party liable for this charge.
- `invoices[].evidence.liableParty.basis` (string (max 400 chars)): Liability basis documented by the independent evidence.
- `invoices[].evidence.upstreamInvoiceDate` (string): Issue date of the invoice received by the NVOCC.
- `invoices[].evidence.lastIncurredDate` (string): Independently documented last date this charge was incurred.
- `invoices[].evidence.agreedResolutionDays` (integer (0 to 730)): A longer resolution period agreed by both parties.

## Response

- `regulation` (object, required)
- `regulation.version` (string (date), required)
- `regulation.part541` (string (uri), required)
- `regulation.incentivePrinciple` (string (uri), required)
- `regulation.removedPartyRestriction` (string (uri), required)
- `invoices` (array of object, required)
- `invoices[].invoiceNumber` (string | null, required)
- `invoices[].container` (string | null, required)
- `invoices[].status` ("no_findings" | "needs_review" | "dispute_identified", required)
- `invoices[].paymentObligation` ("eliminated" | "grounds_for_dispute" | "undetermined", required): Elimination requires a conclusive defect and either an input with only structured values or structuredFieldsComplete set to true. Unconfirmed free text yields grounds_for_dispute with needs_review.
- `invoices[].issuanceDeadline` (object | null, required)
- `invoices[].calculation` (object | null, required): Recalculation of billed dates under the supplied tariff or contract. Unbilled chargeable dates do not affect the calculated amount or overcharge.
- `invoices[].dayLedger` (array of object): Day-by-day tariff attribution for the audited period and any billed dates outside it. A needs_review entry can leave the calculation or issuance deadline unresolved.
- `invoices[].calculationAlternatives` (array of object): Amounts under each possible start event when the tariff milestone is unspecified and the schedules differ.
- `invoices[].calculationAlternatives[].freeTimeStartsAfter` ("discharge" | "availability" | "gate_in" | "empty_pickup", required)
- `invoices[].calculationAlternatives[].amountCents` (integer (-9007199254740991 to 9007199254740991) | null, required): Recalculated amount for billed dates. Null when billed dates were not supplied.
- `invoices[].findings` (array of object, required)
- `invoices[].findings[].code` (string, required)
- `invoices[].findings[].effect` ("no_payment_obligation" | "potential_dispute" | "needs_review", required)
- `invoices[].findings[].location` (string, required): Field path relative to the corresponding invoices array entry.
- `invoices[].findings[].expected` (string, required)
- `invoices[].findings[].actual` (string, required)
- `invoices[].findings[].section` (string, required)
- `invoices[].findings[].source` (string (uri), required)
- `invoices[].disputeLetter` (string | null, required): Requests clarification when paymentObligation is grounds_for_dispute.

## Example

```sh
curl https://api.kanagu.dev/v1/demurrage/audit \
  -H "Authorization: Bearer $KANAGU_KEY" \
  -H "Content-Type: application/json" \
  -d '{"invoices":[{"structuredFieldsComplete":true,"invoice":{"number":"DD-260529","issuer":"Harbor Shipping","issuerType":"ocean_common_carrier","billedParty":"Atlas Imports","billedPartyType":"other","liabilityBasis":"Consignee under service contract SC-208","direction":"import","chargeType":"demurrage","billsOfLading":["HSUS00814"],"container":"MSCU1234566","dischargePort":"USLAX","invoiceDate":"2026-05-29","dueDate":"2026-06-28","freeDays":2,"freeTimeStart":"2026-05-20","freeTimeEnd":"2026-05-21","availabilityDate":"2026-05-20","chargedDates":["2026-05-22","2026-05-23","2026-05-24","2026-05-25"],"billedDays":4,"ratesCents":[15000,25000],"amountCents":80000,"rateRule":"SC-208 section 12","disputeContact":"billing@example.com","disputeInstructions":"https://example.com/disputes","disputeRequestDays":30,"disputeResolutionDays":30,"certifiesFmcCompliance":true,"certifiesIssuerDidNotContribute":true},"events":{"discharge":"2026-05-19","availability":"2026-05-20","gateOut":"2026-05-25","blockedDays":[{"date":"2026-05-24","reason":"terminal_closed","reference":"Gate schedule"}]},"terms":{"reference":"SC-208 section 12","freeDays":2,"freeDayBasis":"calendar","freeTimeStartsAfter":"availability","chargeDayBasis":"calendar","includeStartDay":true,"includeEndDay":true,"tiers":[{"fromChargedDay":1,"rateCents":15000},{"fromChargedDay":3,"rateCents":25000}]},"evidence":{"liableParty":{"name":"Atlas Imports","reference":"SC-208"}}}]}'
```

```ts
const res = await fetch("https://api.kanagu.dev/v1/demurrage/audit", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${process.env.KANAGU_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    "invoices": [
      {
        "structuredFieldsComplete": true,
        "invoice": {
          "number": "DD-260529",
          "issuer": "Harbor Shipping",
          "issuerType": "ocean_common_carrier",
          "billedParty": "Atlas Imports",
          "billedPartyType": "other",
          "liabilityBasis": "Consignee under service contract SC-208",
          "direction": "import",
          "chargeType": "demurrage",
          "billsOfLading": [
            "HSUS00814"
          ],
          "container": "MSCU1234566",
          "dischargePort": "USLAX",
          "invoiceDate": "2026-05-29",
          "dueDate": "2026-06-28",
          "freeDays": 2,
          "freeTimeStart": "2026-05-20",
          "freeTimeEnd": "2026-05-21",
          "availabilityDate": "2026-05-20",
          "chargedDates": [
            "2026-05-22",
            "2026-05-23",
            "2026-05-24",
            "2026-05-25"
          ],
          "billedDays": 4,
          "ratesCents": [
            15000,
            25000
          ],
          "amountCents": 80000,
          "rateRule": "SC-208 section 12",
          "disputeContact": "billing@example.com",
          "disputeInstructions": "https://example.com/disputes",
          "disputeRequestDays": 30,
          "disputeResolutionDays": 30,
          "certifiesFmcCompliance": true,
          "certifiesIssuerDidNotContribute": true
        },
        "events": {
          "discharge": "2026-05-19",
          "availability": "2026-05-20",
          "gateOut": "2026-05-25",
          "blockedDays": [
            {
              "date": "2026-05-24",
              "reason": "terminal_closed",
              "reference": "Gate schedule"
            }
          ]
        },
        "terms": {
          "reference": "SC-208 section 12",
          "freeDays": 2,
          "freeDayBasis": "calendar",
          "freeTimeStartsAfter": "availability",
          "chargeDayBasis": "calendar",
          "includeStartDay": true,
          "includeEndDay": true,
          "tiers": [
            {
              "fromChargedDay": 1,
              "rateCents": 15000
            },
            {
              "fromChargedDay": 3,
              "rateCents": 25000
            }
          ]
        },
        "evidence": {
          "liableParty": {
            "name": "Atlas Imports",
            "reference": "SC-208"
          }
        }
      }
    ]
  }),
});
if (!res.ok) throw new Error((await res.json()).error.message);
const result = await res.json();
```

## Errors

JSON `{"error":{"code","message"}}`.

- 400 `invalid_input`: The body does not match the request schema. The message names each field.
- 400 `invalid_json`: The body is missing or is not valid JSON.
- 400 `invalid_idempotency_key`: Idempotency-Key must be 1–128 visible ASCII characters.
- 401 `invalid_api_key`: The Bearer key is missing, malformed, invalid or inactive.
- 402 `free_allowance_exhausted`: This month's free usage is used up and the account has no subscription. Subscribe from the dashboard, or wait for the next UTC month; Retry-After gives the seconds left.
- 404 `not_found`: No operation at this path.
- 409 `idempotency_conflict`: The Idempotency-Key was already used with a different body.
- 413 `payload_too_large`: JSON bodies may be at most 64 KiB.
- 429 `trial_limit`: The anonymous trial allows 10 calls per IP per UTC day, shared by REST and MCP. Retry-After gives the seconds left.
- 500 `internal_error`: The call failed on our side. It is not billed; retry with the same Idempotency-Key.

## JSON Schema

Request:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "invoices": {
      "minItems": 1,
      "maxItems": 100,
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "invoice": {
            "type": "object",
            "properties": {
              "number": {
                "type": "string",
                "maxLength": 400
              },
              "issuer": {
                "type": "string",
                "maxLength": 400
              },
              "issuerType": {
                "type": "string",
                "enum": [
                  "ocean_common_carrier",
                  "marine_terminal_operator",
                  "nvocc",
                  "other"
                ]
              },
              "billedParty": {
                "type": "string",
                "maxLength": 400
              },
              "billedPartyType": {
                "type": "string",
                "enum": [
                  "ocean_common_carrier",
                  "marine_terminal_operator",
                  "nvocc",
                  "other"
                ]
              },
              "liabilityBasis": {
                "type": "string",
                "maxLength": 400
              },
              "direction": {
                "type": "string",
                "enum": [
                  "import",
                  "export"
                ]
              },
              "chargeType": {
                "type": "string",
                "enum": [
                  "demurrage",
                  "detention"
                ]
              },
              "billsOfLading": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 400
                }
              },
              "container": {
                "type": "string",
                "maxLength": 400
              },
              "dischargePort": {
                "type": "string",
                "maxLength": 400
              },
              "invoiceDate": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "dueDate": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "freeDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 730
              },
              "freeTimeStart": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "freeTimeEnd": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "availabilityDate": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "earliestReturnDate": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "chargedDates": {
                "maxItems": 730,
                "type": "array",
                "items": {
                  "type": "string",
                  "allOf": [
                    {
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                    },
                    {
                      "pattern": "^[12]"
                    }
                  ],
                  "description": "Local calendar date, year 1000–2999."
                }
              },
              "billedDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 730
              },
              "ratesCents": {
                "description": "Daily rates applied to the billed dates, in USD cents.",
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 1000000000000,
                  "description": "USD cents."
                }
              },
              "amountCents": {
                "type": "integer",
                "minimum": 0,
                "maximum": 1000000000000,
                "description": "USD cents."
              },
              "rateRule": {
                "type": "string",
                "maxLength": 400
              },
              "disputeContact": {
                "type": "string",
                "maxLength": 400
              },
              "disputeInstructions": {
                "description": "Dispute method shown on the invoice. Include the public website address or the destination of any QR code or digital watermark.",
                "type": "string",
                "maxLength": 400
              },
              "disputeRequestDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 730
              },
              "disputeResolutionDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 730
              },
              "certifiesFmcCompliance": {
                "type": "boolean"
              },
              "certifiesIssuerDidNotContribute": {
                "type": "boolean"
              },
              "correctsWrongBilledParty": {
                "type": "boolean"
              },
              "documentText": {
                "description": "Text from the invoice and its attachments. Labeled dates in this text are hints for review. Enter structured dates in ISO YYYY-MM-DD format.",
                "type": "string",
                "maxLength": 32000
              },
              "notes": {
                "description": "Additional free-text notes about the invoice.",
                "type": "string",
                "maxLength": 400
              }
            },
            "required": [
              "issuerType",
              "billedPartyType",
              "direction",
              "chargeType"
            ],
            "additionalProperties": false,
            "description": "One invoice for one container and charge type. Extract required information from all sections and attachments before omitting an absent field."
          },
          "structuredFieldsComplete": {
            "description": "Set to true after confirming that the structured fields capture all relevant information from the invoice, its attachments, shipment records, and the applicable tariff. Without this confirmation, any non-empty free text requires review, including invoice identifiers, names, text fields, and evidence references.",
            "type": "boolean"
          },
          "events": {
            "description": "Import demurrage runs from discharge or availability to gate-out. Import detention defaults to gate-out through empty return. Export demurrage starts at full gate-in and uses the tariff's exportDemurrage rules. Export detention defaults to empty pickup through full gate-in.",
            "type": "object",
            "properties": {
              "discharge": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "availability": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "earliestReturn": {
                "description": "Published earliest receipt date (ERD) for the export booking, from an independent record. Actual gate-in may precede it.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "erdChanges": {
                "description": "Published terminal ERD changes for this export detention shipment, in announcement order. For a same-day pickup or return, include the change only if announced while the shipper held the container. Use an empty array if records confirm no change.",
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "announcedOn": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Facility-local date the terminal publicly announced the change."
                    },
                    "previousErd": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "newErd": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    }
                  },
                  "required": [
                    "announcedOn",
                    "previousErd",
                    "newErd"
                  ],
                  "additionalProperties": false
                }
              },
              "gateOut": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "emptyReturn": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "emptyPickup": {
                "description": "Export equipment pickup.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "fullGateIn": {
                "description": "Delivery of the full export container to the terminal.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "vesselLoad": {
                "description": "Export container loaded on vessel.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "loadedOnOriginalVessel": {
                "description": "Whether loading records confirm the container loaded on the originally scheduled vessel and voyage. Without this fact, a documented roll indicates a missed original voyage. Departure dates alone do not identify the voyage.",
                "type": "boolean"
              },
              "cargoCutoff": {
                "description": "Last date for full gate-in on the originally booked export voyage.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "scheduledSailDate": {
                "description": "Scheduled departure date of the originally booked vessel.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "actualSailDate": {
                "description": "Actual departure date of the vessel carrying this container.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "rolls": {
                "description": "Documented, non-overlapping periods attributable to an export vessel roll. Start and end dates are inclusive.",
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "startDate": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "endDate": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "responsibility": {
                      "type": "string",
                      "enum": [
                        "carrier",
                        "customer",
                        "unknown"
                      ]
                    },
                    "resolutionDate": {
                      "description": "Date the customer resolved the cause. Null means the cause was still unresolved at the end of the roll period.",
                      "anyOf": [
                        {
                          "type": "string",
                          "allOf": [
                            {
                              "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                            },
                            {
                              "pattern": "^[12]"
                            }
                          ],
                          "description": "Local calendar date, year 1000–2999."
                        },
                        {
                          "type": "null"
                        }
                      ]
                    },
                    "newScheduledSailDate": {
                      "description": "Scheduled departure of the replacement vessel booked on startDate. Supply each replacement schedule when the tariff uses a scheduled sailing cutoff.",
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ]
                    }
                  },
                  "required": [
                    "startDate",
                    "endDate",
                    "responsibility"
                  ],
                  "additionalProperties": false
                }
              },
              "lateDocumentation": {
                "description": "Documented periods when the shipper's late paperwork delayed an export container. Start and end dates are inclusive.",
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "startDate": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "endDate": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    }
                  },
                  "required": [
                    "startDate",
                    "endDate"
                  ],
                  "additionalProperties": false
                }
              },
              "blockedDays": {
                "default": [],
                "description": "Days of verified full-day inability to move this container for this charge, including lack of any authorized alternate facility or appointment.",
                "maxItems": 730,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "reason": {
                      "type": "string",
                      "enum": [
                        "terminal_closed",
                        "container_unavailable",
                        "appointment_unavailable"
                      ]
                    },
                    "reference": {
                      "type": "string",
                      "maxLength": 400
                    }
                  },
                  "required": [
                    "date",
                    "reason"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "additionalProperties": false
          },
          "terms": {
            "type": "object",
            "properties": {
              "reference": {
                "type": "string",
                "minLength": 1,
                "maxLength": 400,
                "description": "Applicable tariff, contract or terminal schedule reference."
              },
              "freeDays": {
                "type": "integer",
                "minimum": 0,
                "maximum": 730
              },
              "freeDayBasis": {
                "type": "string",
                "enum": [
                  "calendar",
                  "business"
                ]
              },
              "freeTimeStartsAfter": {
                "description": "Tariff milestone for starting free time. gate_in uses events.fullGateIn and empty_pickup uses events.emptyPickup. If omitted for import demurrage, compare discharge and availability when both are recorded. Other charges use their default milestones.",
                "type": "string",
                "enum": [
                  "discharge",
                  "availability",
                  "gate_in",
                  "empty_pickup"
                ]
              },
              "countBlockedFreeDays": {
                "description": "Whether verified blocked days count toward free time. Defaults to true for calendar-day free time and false for business-day free time.",
                "type": "boolean"
              },
              "chargeDayBasis": {
                "type": "string",
                "enum": [
                  "calendar",
                  "business"
                ]
              },
              "countBlockedChargeDays": {
                "description": "Whether verified blocked days count after free time under the tariff. Defaults to true for calendar-day charges and false for business-day charges.",
                "type": "boolean"
              },
              "includeStartDay": {
                "type": "boolean",
                "description": "True to begin counting on the milestone date, false to begin the following day."
              },
              "includeEndDay": {
                "type": "boolean",
                "description": "Whether the day the charge period ends can be charged."
              },
              "exportDemurrage": {
                "description": "Export demurrage rules transcribed from the supplied tariff for the circumstances of this shipment.",
                "type": "object",
                "properties": {
                  "chargeableCauses": {
                    "description": "Complete list of causes the tariff permits after free time. An empty array means none apply. Omit if the tariff is unclear. Days with conflicting chargeable causes require review.",
                    "maxItems": 3,
                    "type": "array",
                    "items": {
                      "oneOf": [
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "early_receipt"
                            },
                            "requiresOriginalVessel": {
                              "default": true,
                              "description": "Whether early receipt requires loading on the originally scheduled vessel and voyage. Set to false if the tariff permits the charge regardless of voyage.",
                              "type": "boolean"
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Charge dates before the published ERD when full gate-in preceded that ERD and the original-vessel condition is met."
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "shipper_roll"
                            },
                            "maxDaysAfterResolution": {
                              "description": "Calendar days chargeable after the shipper resolves the cause. Omit for an uncapped rule.",
                              "type": "integer",
                              "minimum": 0,
                              "maximum": 730
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Charge days attributable to a documented customer-caused roll. With a scheduled sailing cutoff, this can include days before the roll, after free time, on the affected booking."
                        },
                        {
                          "type": "object",
                          "properties": {
                            "kind": {
                              "type": "string",
                              "const": "late_documentation"
                            }
                          },
                          "required": [
                            "kind"
                          ],
                          "additionalProperties": false,
                          "description": "Charge dates attributable to the shipper's late documentation."
                        }
                      ]
                    }
                  },
                  "endsAt": {
                    "description": "Tariff milestone ending export demurrage. Supply when recording a scheduled or actual departure date. Without either date, the default is vessel load.",
                    "type": "string",
                    "enum": [
                      "vessel_load",
                      "scheduled_sail",
                      "earlier_of_load_and_scheduled_sail",
                      "actual_sail"
                    ]
                  }
                },
                "additionalProperties": false
              },
              "exportDetention": {
                "type": "object",
                "properties": {
                  "extendFreeTimeOnErdChange": {
                    "type": "boolean",
                    "description": "Whether the tariff adds working days from the previous ERD through the day before the new ERD for a postponement announced while the shipper holds the container within free time."
                  }
                },
                "required": [
                  "extendFreeTimeOnErdChange"
                ],
                "additionalProperties": false
              },
              "weekend": {
                "default": [
                  6,
                  7
                ],
                "description": "ISO weekday numbers excluded in business-day mode.",
                "maxItems": 7,
                "type": "array",
                "items": {
                  "type": "integer",
                  "minimum": 1,
                  "maximum": 7
                }
              },
              "usHolidays": {
                "description": "Include national or state public holidays in business-day mode. Dataset covers 2020–2035.",
                "anyOf": [
                  {
                    "type": "string",
                    "const": "US"
                  },
                  {
                    "type": "string",
                    "pattern": "^US-[A-Z]{2}$"
                  }
                ]
              },
              "holidays": {
                "default": [],
                "description": "Additional holidays excluded in business-day mode.",
                "maxItems": 100,
                "type": "array",
                "items": {
                  "type": "string",
                  "allOf": [
                    {
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                    },
                    {
                      "pattern": "^[12]"
                    }
                  ],
                  "description": "Local calendar date, year 1000–2999."
                }
              },
              "tiers": {
                "minItems": 1,
                "maxItems": 32,
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "fromChargedDay": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 730
                    },
                    "rateCents": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 1000000000000,
                      "description": "USD cents."
                    }
                  },
                  "required": [
                    "fromChargedDay",
                    "rateCents"
                  ],
                  "additionalProperties": false
                }
              }
            },
            "required": [
              "reference",
              "freeDays",
              "freeDayBasis",
              "chargeDayBasis",
              "includeStartDay",
              "includeEndDay",
              "tiers"
            ],
            "additionalProperties": false
          },
          "evidence": {
            "description": "Independent records for checking stated invoice details. Use the same names, reference and dispute details where they match. Certification booleans describe whether the certified facts are true.",
            "type": "object",
            "properties": {
              "billsOfLading": {
                "maxItems": 50,
                "type": "array",
                "items": {
                  "type": "string",
                  "maxLength": 400
                }
              },
              "container": {
                "type": "string",
                "maxLength": 400
              },
              "dischargePort": {
                "type": "string",
                "maxLength": 400
              },
              "invoiceDate": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "dueDate": {
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ],
                "description": "Local calendar date, year 1000–2999."
              },
              "disputeContact": {
                "type": "string",
                "maxLength": 400
              },
              "disputeInstructions": {
                "description": "Dispute method shown on the invoice. Include the public website address or the destination of any QR code or digital watermark.",
                "type": "string",
                "maxLength": 400
              },
              "certifiesFmcCompliance": {
                "type": "boolean"
              },
              "certifiesIssuerDidNotContribute": {
                "type": "boolean"
              },
              "liableParty": {
                "description": "Use the same legal entity names as on the invoice when they match.",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  },
                  "reference": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400,
                    "description": "Independent evidence identifying the sole party liable for this charge."
                  },
                  "basis": {
                    "description": "Liability basis documented by the independent evidence.",
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 400
                  }
                },
                "required": [
                  "name",
                  "reference"
                ],
                "additionalProperties": false
              },
              "upstreamInvoiceDate": {
                "description": "Issue date of the invoice received by the NVOCC.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "lastIncurredDate": {
                "description": "Independently documented last date this charge was incurred.",
                "type": "string",
                "allOf": [
                  {
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  {
                    "pattern": "^[12]"
                  }
                ]
              },
              "agreedResolutionDays": {
                "description": "A longer resolution period agreed by both parties.",
                "type": "integer",
                "minimum": 0,
                "maximum": 730
              }
            },
            "additionalProperties": false
          }
        },
        "required": [
          "invoice"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "invoices"
  ],
  "additionalProperties": false,
  "examples": [
    {
      "invoices": [
        {
          "structuredFieldsComplete": true,
          "invoice": {
            "number": "DD-260529",
            "issuer": "Harbor Shipping",
            "issuerType": "ocean_common_carrier",
            "billedParty": "Atlas Imports",
            "billedPartyType": "other",
            "liabilityBasis": "Consignee under service contract SC-208",
            "direction": "import",
            "chargeType": "demurrage",
            "billsOfLading": [
              "HSUS00814"
            ],
            "container": "MSCU1234566",
            "dischargePort": "USLAX",
            "invoiceDate": "2026-05-29",
            "dueDate": "2026-06-28",
            "freeDays": 2,
            "freeTimeStart": "2026-05-20",
            "freeTimeEnd": "2026-05-21",
            "availabilityDate": "2026-05-20",
            "chargedDates": [
              "2026-05-22",
              "2026-05-23",
              "2026-05-24",
              "2026-05-25"
            ],
            "billedDays": 4,
            "ratesCents": [
              15000,
              25000
            ],
            "amountCents": 80000,
            "rateRule": "SC-208 section 12",
            "disputeContact": "billing@example.com",
            "disputeInstructions": "https://example.com/disputes",
            "disputeRequestDays": 30,
            "disputeResolutionDays": 30,
            "certifiesFmcCompliance": true,
            "certifiesIssuerDidNotContribute": true
          },
          "events": {
            "discharge": "2026-05-19",
            "availability": "2026-05-20",
            "gateOut": "2026-05-25",
            "blockedDays": [
              {
                "date": "2026-05-24",
                "reason": "terminal_closed",
                "reference": "Gate schedule"
              }
            ]
          },
          "terms": {
            "reference": "SC-208 section 12",
            "freeDays": 2,
            "freeDayBasis": "calendar",
            "freeTimeStartsAfter": "availability",
            "chargeDayBasis": "calendar",
            "includeStartDay": true,
            "includeEndDay": true,
            "tiers": [
              {
                "fromChargedDay": 1,
                "rateCents": 15000
              },
              {
                "fromChargedDay": 3,
                "rateCents": 25000
              }
            ]
          },
          "evidence": {
            "liableParty": {
              "name": "Atlas Imports",
              "reference": "SC-208"
            }
          }
        }
      ]
    }
  ]
}
```

Response:
```json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "type": "object",
  "properties": {
    "regulation": {
      "type": "object",
      "properties": {
        "version": {
          "type": "string",
          "format": "date",
          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
        },
        "part541": {
          "type": "string",
          "format": "uri"
        },
        "incentivePrinciple": {
          "type": "string",
          "format": "uri"
        },
        "removedPartyRestriction": {
          "type": "string",
          "format": "uri"
        }
      },
      "required": [
        "version",
        "part541",
        "incentivePrinciple",
        "removedPartyRestriction"
      ],
      "additionalProperties": false
    },
    "invoices": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "invoiceNumber": {
            "type": [
              "string",
              "null"
            ]
          },
          "container": {
            "type": [
              "string",
              "null"
            ]
          },
          "status": {
            "type": "string",
            "enum": [
              "no_findings",
              "needs_review",
              "dispute_identified"
            ]
          },
          "paymentObligation": {
            "type": "string",
            "enum": [
              "eliminated",
              "grounds_for_dispute",
              "undetermined"
            ],
            "description": "Elimination requires a conclusive defect and either an input with only structured values or structuredFieldsComplete set to true. Unconfirmed free text yields grounds_for_dispute with needs_review."
          },
          "issuanceDeadline": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "basis": {
                    "type": "string"
                  },
                  "startDate": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  },
                  "deadline": {
                    "type": "string",
                    "format": "date",
                    "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                  }
                },
                "required": [
                  "basis",
                  "startDate",
                  "deadline"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "calculation": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "chargeableDays": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "charges": {
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "date": {
                          "type": "string",
                          "format": "date",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        "rateCents": {
                          "type": "integer",
                          "minimum": -9007199254740991,
                          "maximum": 9007199254740991
                        },
                        "cause": {
                          "description": "The tariff-authorized cause attributed to this export demurrage day.",
                          "type": "string",
                          "enum": [
                            "early_receipt",
                            "shipper_roll",
                            "late_documentation"
                          ]
                        }
                      },
                      "required": [
                        "date",
                        "rateCents"
                      ],
                      "additionalProperties": false
                    }
                  },
                  "unbilledChargeableDates": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "format": "date",
                      "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                    }
                  },
                  "amountCents": {
                    "type": "integer",
                    "minimum": -9007199254740991,
                    "maximum": 9007199254740991
                  },
                  "overchargeCents": {
                    "anyOf": [
                      {
                        "type": "integer",
                        "minimum": -9007199254740991,
                        "maximum": 9007199254740991
                      },
                      {
                        "type": "null"
                      }
                    ]
                  }
                },
                "required": [
                  "chargeableDays",
                  "charges",
                  "unbilledChargeableDates",
                  "amountCents",
                  "overchargeCents"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ],
            "description": "Recalculation of billed dates under the supplied tariff or contract. Unbilled chargeable dates do not affect the calculated amount or overcharge."
          },
          "dayLedger": {
            "description": "Day-by-day tariff attribution for the audited period and any billed dates outside it. A needs_review entry can leave the calculation or issuance deadline unresolved.",
            "type": "array",
            "items": {
              "oneOf": [
                {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "kind": {
                      "type": "string",
                      "const": "chargeable"
                    },
                    "cause": {
                      "type": "string",
                      "enum": [
                        "early_receipt",
                        "shipper_roll",
                        "late_documentation",
                        "import_demurrage",
                        "import_detention",
                        "export_detention"
                      ]
                    }
                  },
                  "required": [
                    "date",
                    "kind",
                    "cause"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "kind": {
                      "type": "string",
                      "const": "excluded"
                    },
                    "cause": {
                      "type": "string",
                      "enum": [
                        "before_period",
                        "after_period",
                        "start_day_excluded",
                        "free_time",
                        "non_business_day",
                        "blocked_day",
                        "carrier_roll",
                        "no_chargeable_cause"
                      ]
                    }
                  },
                  "required": [
                    "date",
                    "kind",
                    "cause"
                  ],
                  "additionalProperties": false
                },
                {
                  "type": "object",
                  "properties": {
                    "date": {
                      "type": "string",
                      "allOf": [
                        {
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))$"
                        },
                        {
                          "pattern": "^[12]"
                        }
                      ],
                      "description": "Local calendar date, year 1000–2999."
                    },
                    "kind": {
                      "type": "string",
                      "const": "needs_review"
                    },
                    "cause": {
                      "type": "string",
                      "enum": [
                        "missing_sail_date",
                        "multiple_chargeable_causes"
                      ]
                    }
                  },
                  "required": [
                    "date",
                    "kind",
                    "cause"
                  ],
                  "additionalProperties": false
                }
              ]
            }
          },
          "calculationAlternatives": {
            "description": "Amounts under each possible start event when the tariff milestone is unspecified and the schedules differ.",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "freeTimeStartsAfter": {
                  "type": "string",
                  "enum": [
                    "discharge",
                    "availability",
                    "gate_in",
                    "empty_pickup"
                  ]
                },
                "amountCents": {
                  "anyOf": [
                    {
                      "type": "integer",
                      "minimum": -9007199254740991,
                      "maximum": 9007199254740991
                    },
                    {
                      "type": "null"
                    }
                  ],
                  "description": "Recalculated amount for billed dates. Null when billed dates were not supplied."
                }
              },
              "required": [
                "freeTimeStartsAfter",
                "amountCents"
              ],
              "additionalProperties": false
            }
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "code": {
                  "type": "string"
                },
                "effect": {
                  "type": "string",
                  "enum": [
                    "no_payment_obligation",
                    "potential_dispute",
                    "needs_review"
                  ]
                },
                "location": {
                  "type": "string",
                  "description": "Field path relative to the corresponding invoices array entry."
                },
                "expected": {
                  "type": "string"
                },
                "actual": {
                  "type": "string"
                },
                "section": {
                  "type": "string"
                },
                "source": {
                  "type": "string",
                  "format": "uri"
                }
              },
              "required": [
                "code",
                "effect",
                "location",
                "expected",
                "actual",
                "section",
                "source"
              ],
              "additionalProperties": false
            }
          },
          "disputeLetter": {
            "description": "Requests clarification when paymentObligation is grounds_for_dispute.",
            "type": [
              "string",
              "null"
            ]
          }
        },
        "required": [
          "invoiceNumber",
          "container",
          "status",
          "paymentObligation",
          "issuanceDeadline",
          "calculation",
          "findings",
          "disputeLetter"
        ],
        "additionalProperties": false
      }
    }
  },
  "required": [
    "regulation",
    "invoices"
  ],
  "additionalProperties": false
}
```
