---
updatedAt: 2026-03-16T16:23:19.000Z
agentTools:
  projectIndex: https://developers.opentrack.co/llms.txt
---

# container.demurrage.updated

## Overview

Fired when demurrage-related fields on a container change. This includes updates to demurrage amounts owed, last free day (LFD), line last free day, detention last free day, and demurrage at rail stations.

## When This Event Fires

The system detects a difference in demurrage-related fields between the previous and current container snapshot. Common triggers include:

* Last free day (port or line) is reported or changes
* Demurrage amount owed at the port changes
* Demurrage amount owed at a rail facility changes
* Detention last free day is reported or changes
* Rail last free day changes

## Payload Structure

```json
{
  "event": "container.demurrage.updated",
  "data": { /* IContainerVoyageResponse — full container snapshot */ },
  "changes": {
    "lastFreeDay": {
      "previous": "2025-07-15T00:00:00.000Z",
      "current": "2025-07-18T00:00:00.000Z"
    },
    "demurrageOwedAtPortDecimal": {
      "previous": 0,
      "current": 275.50
    }
  },
  "deliveryAttempt": 1,
  "pendingRetries": 4,
  "sentAt": "2025-07-19T17:00:00.654Z"
}
```

### `data` object

The full current state of the container, identical to the `GET /v1/container/:containerId` response.

### `changes` object

Contains `{ previous, current }` pairs for demurrage fields that changed. Possible fields include:

| Field                            | Description                             |
| -------------------------------- | --------------------------------------- |
| `lastFreeDay`                    | Port last free day                      |
| `lineLastFreeDay`                | Line (carrier) last free day            |
| `detentionLastFreeDay`           | Detention last free day                 |
| `lastFreeDayAtRailStation`       | LFD at the rail facility                |
| `demurrageOwedAtPortDecimal`     | Demurrage owed at the port (in dollars) |
| `demurrageIncurredDecimal`       | Total demurrage incurred (in dollars)   |
| `demurrageOwedAtRailStation`     | Demurrage owed at rail facility         |
| `demurrageIncurredAtRailStation` | Demurrage incurred at rail facility     |

## Common Use Cases

| Use Case                      | How to Implement                                                                                                     |
| ----------------------------- | -------------------------------------------------------------------------------------------------------------------- |
| **LFD alert**                 | When `changes.lastFreeDay` is present, alert operations teams about the new LFD so they can plan pickup accordingly  |
| **Demurrage cost tracking**   | Track changes to `demurrageOwedAtPortDecimal` and `demurrageOwedAtRailStation` to maintain real-time cost visibility |
| **Demurrage risk assessment** | Compare the LFD with the current date and container status to assess demurrage exposure before it accrues            |
| **Accounting integration**    | Push demurrage amounts to your accounting or ERP system when charges are incurred                                    |
| **Drayage prioritization**    | Prioritize containers approaching their LFD to minimize demurrage costs                                              |