> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cedarai.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Train Departure Webhook

> Event payload sent when a train departs from a station

## Event Overview

The **Train Departure** webhook fires when a train departs from a station, customer location, or serving location in your network.⁠‌​​​​‌​‌‌​‌‌‌‌‌‌​​​‌‌​‌‌⁠ It delivers equipment details, the departure station, customer and serving location (when applicable), loaded/empty status, the train number, and the associated work order (if any).

This webhook supports the "early departure" scenario where a train leaves directly from a customer location rather than the main yard. In that case, `customer_location` and `serving_location` are populated so your integration can distinguish between a normal yard departure and a customer-site departure.

> [!NOTE]
>
> This webhook is triggered through ARMS workflow automation. Configure it in your workflow rules to notify external
> systems when trains depart from specific locations.

***

## Payload Schema

```json theme={null}
{
  "event_type": "TrainDeparture",
  "event_timestamp": "2026-06-17T09:30:00+00:00",
  "work_order_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "linked_resources": {
    "equipment": [
      {
        "resource_id": 100001,
        "car_number": "GCGO 995823",
        "is_loaded": true
      },
      {
        "resource_id": 100002,
        "car_number": "GCGO 726451",
        "is_loaded": false
      }
    ],
    "event_station": {
      "resource_id": 1001,
      "name": "Göteborg Hamn",
      "grouping_type": "station"
    },
    "customer_location": {
      "resource_type": "CustomerLocation",
      "resource_id": 7777,
      "name": "Volvo Torslanda",
      "customer_identification_numbers": ["VOL-001"],
      "general_ledger_number": "GL-12345"
    },
    "serving_location": {
      "resource_id": 5050,
      "name": "Torslanda Plant",
      "grouping_type": "customer_location"
    }
  },
  "attributes": {
    "is_loaded": null,
    "train_number": "T-8800"
  },
  "actor": {
    "resource_type": "User",
    "resource_id": 12345,
    "display_name": "ops@customer.com"
  }
}
```

***

## Field Reference

### Top-level Fields

| Field | Type | Required | Description |
| - | - | - | - |
| `event_type` | string | Yes | Always `"TrainDeparture"` for this event. |
| `event_timestamp` | string (ISO 8601) | No | When the train departed. `null` if unavailable. |
| `work_order_id` | string | No | ID of the associated work order. `null` if the event has no work order. |
| `linked_resources` | object | Yes | Equipment, station, and locations involved in the event. |
| `attributes` | object | Yes | Event-specific attributes. |
| `actor` | object or null | Yes | Who caused the triggering event. `null` for system-initiated events. See [Shared Payload Fields -> actor](https://docs.cedarai.com/user-docs/arms/webhooks/overview.md#actor). |

### linked\_resources.equipment

An array of equipment items on the departing train. Each item includes per-car loaded/empty status. Always an array, even for a single car.

| Field | Type | Description |
| - | - | - |
| `resource_id` | integer | Internal equipment identifier. |
| `car_number` | string or null | Railroad car number (e.g. `"GCGO 995823"`). |
| `is_loaded` | boolean or null | `true` if this car was loaded, `false` if empty. `null` if unknown. |

### linked\_resources.event\_station

The station where the train departed from. `null` if no station could be resolved.

| Field | Type | Description |
| - | - | - |
| `resource_id` | integer | Internal station identifier. |
| `name` | string | Human-readable station name. |
| `grouping_type` | string | Type of location (e.g. `"station"`, `"track"`). |

### linked\_resources.customer\_location

The customer location associated with the departure, if any. The entire object is `null` for departures not associated with a customer location (normal yard departures).

| Field | Type | Description |
| - | - | - |
| `resource_type` | string | Always `"CustomerLocation"` when present. |
| `resource_id` | integer | Internal customer location identifier. |
| `name` | string | Human-readable customer location name. |
| `customer_identification_numbers` | array of strings | Carrier-side identifiers for this customer (may be an empty array). |
| `general_ledger_number` | string or null | General ledger number associated with this customer. `null` if not configured. |

### linked\_resources.serving\_location

The serving location associated with the departure, if any.⁠‌​​​​‌​‌‌​‌‌‌‌‌‌​​​‌‌​‌‌⁠ The entire object is `null` when the departure is not tied to a serving location.

| Field | Type | Description |
| - | - | - |
| `resource_id` | integer | Internal serving location identifier. |
| `name` | string | Human-readable serving location name. |
| `grouping_type` | string | Type of location (e.g. `"customer_location"`). |

### attributes

| Field | Type | Description |
| - | - | - |
| `is_loaded` | boolean or null | `true` if cars were loaded, `false` if empty. `null` when status is mixed or unknown. |
| `train_number` | string or null | Train identifier (e.g. `"T-8800"`). `null` if no train ID is set. |

***

## Example HTTP Request

This is the full HTTP request your endpoint receives:

```http theme={null}
POST /your-webhook-endpoint HTTP/1.1
Content-Type: application/json
X-Webhook-Timestamp: 1718614200
X-Webhook-Signature: <base64-encoded-ed25519-signature>
X-Webhook-KeyId: cedar-webhooks-2026
X-Webhook-Id: 550e8400-e29b-41d4-a716-446655440000

{"actor":{"display_name":"ops@customer.com","resource_id":12345,"resource_type":"User"},"attributes":{"is_loaded":null,"train_number":"T-8800"},"event_timestamp":"2026-06-17T09:30:00+00:00","event_type":"TrainDeparture","linked_resources":{"customer_location":{"customer_identification_numbers":["VOL-001"],"general_ledger_number":"GL-12345","name":"Volvo Torslanda","resource_id":7777,"resource_type":"CustomerLocation"},"equipment":[{"car_number":"GCGO 995823","is_loaded":true,"resource_id":100001},{"car_number":"GCGO 726451","is_loaded":false,"resource_id":100002}],"event_station":{"grouping_type":"station","name":"G\u00f6teborg Hamn","resource_id":1001},"serving_location":{"grouping_type":"customer_location","name":"Torslanda Plant","resource_id":5050}},"work_order_id":"a1b2c3d4-e5f6-7890-abcd-ef1234567890"}
```

> [!NOTE]
>
> The JSON body is **canonically serialized** (sorted keys, no extra whitespace) so the signature can be verified
> deterministically. See the [Webhook Overview](https://docs.cedarai.com/user-docs/arms/webhooks/overview.md#signature-verification) for verification
> instructions.

***

## Differences from Train Arrival

| Aspect | Train Arrival | Train Departure |
| - | - | - |
| `event_type` | `"TrainArrival"` | `"TrainDeparture"` |
| `customer_location` | Not included in payload | Included (with `name`, identifiers, GL number) |
| `serving_location` | Not included in payload | Included (with `name`, `grouping_type`) |
| `linked_resources.track` | Included (arrival track) | Not included |
| `is_final_location` | Included in attributes (arrival-only) | Not included |
| Per-car `is_loaded` | Not included per equipment item | Included per equipment item |
| Trigger | Train arrives at a station | Train departs from a station or customer location |

> [!NOTE]
>
> The Train Arrival webhook does not currently include `customer_location` or `serving_location`, even though the underlying event carries them. This asymmetry is intentional -- if your integration needs location context on both arrival and departure, use the Train Departure webhook for location-aware routing.

***

## Setting Up This Webhook

**1. Configure Workflow**

In ARMS, create or edit a workflow rule that triggers on train departure events.

**2. Add Webhook Effect**

Add the **Train Departure Webhook** effect to the workflow.⁠‌​​​​‌​‌‌​‌‌‌‌‌‌​​​‌‌​‌‌⁠ Provide your endpoint URL.

**3. Implement Your Endpoint**

Build an HTTPS endpoint that receives the POST, verifies the signature, and processes the event.

**4. Test**

Trigger a test event and confirm your endpoint receives and verifies the payload correctly.

***

## Related

> [card] [Webhook Overview](https://docs.cedarai.com/user-docs/arms/webhooks/overview.md)
>
> Signing, verification, public key, and shared HTTP headers.

> [card] [Train Arrival](https://docs.cedarai.com/user-docs/arms/webhooks/train-arrival.md)
>
> Webhook for train arrival events at stations.


## Related topics

- [Train Arrival Webhook](https://docs.cedarai.com/user-docs/arms/webhooks/train-arrival.md)
- [Train Set Webhook](https://docs.cedarai.com/user-docs/arms/webhooks/train-set.md)
- [Workflow Effect Webhooks](https://docs.cedarai.com/user-docs/arms/webhooks/overview.md)
- [Trains & Jobs](https://docs.cedarai.com/user-docs/mobile/trains.md)
- [Train ID template](https://docs.cedarai.com/user-docs/train_job/id.md)
