> ## 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 Set Webhook

> Event payload sent when a train consist is defined with wagons and route stations

## Event Overview

The **Train Set** webhook fires when a train consist is defined in ARMS -- typically when wagons are assigned to a train with departure and arrival stations. It delivers the wagon list, station details (including names), train identifier, and the associated work order (if any).

<Info>
  This webhook is triggered through ARMS workflow automation. Configure it in your workflow rules to notify external
  systems when a train consist is set up.
</Info>

***

## Payload Schema

```json theme={null}
{
  "event_type": "train_set",
  "event_timestamp": "2026-03-09T14:30:00+00:00",
  "work_order_id": "12345",
  "linked_resources": {
    "equipment": [
      {
        "resource_id": 2001,
        "car_number": "GCGO 11111"
      },
      {
        "resource_id": 2002,
        "car_number": "GCGO 22222"
      },
      {
        "resource_id": 2003,
        "car_number": "GCGO 33333"
      }
    ],
    "departure_station": {
      "resource_id": 6001,
      "name": "Hallsberg",
      "grouping_type": "station"
    },
    "arrival_station": {
      "resource_id": 6002,
      "name": "Gothenburg",
      "grouping_type": "station"
    }
  },
  "attributes": {
    "train_id": "T-9876"
  },
  "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 `"train_set"` for this event.                                                                                                                |
| `event_timestamp`  | string (ISO 8601) | No       | When the event occurred. `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, departure station, and arrival station for the train.                                                                                    |
| `attributes`       | object            | Yes      | Event-specific attributes (train identifier).                                                                                                       |
| `actor`            | object or null    | Yes      | Who caused the triggering event. `null` for system-initiated events. See [Shared Payload Fields -> actor](/user-docs/arms/webhooks/overview#actor). |

### linked\_resources.equipment

An array of wagons assigned to the train. Always an array, even for a single wagon.

| Field         | Type           | Description                                      |
| ------------- | -------------- | ------------------------------------------------ |
| `resource_id` | integer        | Internal equipment identifier.                   |
| `car_number`  | string or null | Railroad car/wagon number (e.g. `"GCGO 11111"`). |

### linked\_resources.departure\_station

The station where the train departs from. `null` if no departure station is associated.

| 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.arrival\_station

The station where the train arrives. `null` if no arrival station is associated.

| 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"`). |

### attributes

| Field      | Type   | Description                                   |
| ---------- | ------ | --------------------------------------------- |
| `train_id` | string | Train identifier (e.g. train number or code). |

***

## 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: 1709651400
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":{"train_id":"T-9876"},"event_timestamp":"2026-03-09T14:30:00+00:00","event_type":"train_set","linked_resources":{"arrival_station":{"grouping_type":"station","name":"Gothenburg","resource_id":6002},"departure_station":{"grouping_type":"station","name":"Hallsberg","resource_id":6001},"equipment":[{"car_number":"GCGO 11111","resource_id":2001},{"car_number":"GCGO 22222","resource_id":2002},{"car_number":"GCGO 33333","resource_id":2003}]},"work_order_id":"12345"}
```

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

***

## Setting Up This Webhook

<Steps>
  <Step title="Configure Workflow">In ARMS, create or edit a workflow rule that triggers on train set events.</Step>

  <Step title="Add Webhook Effect">
    Add the **Train Set Webhook** effect to the workflow. Provide your endpoint URL.
  </Step>

  <Step title="Map Inputs">
    Wire the departure station, arrival station, equipment (wagons), and train ID from the trigger event to the effect inputs.
  </Step>

  <Step title="Implement Your Endpoint">
    Build an HTTPS endpoint that receives the POST, verifies the signature, and processes the event.
  </Step>

  <Step title="Test">Trigger a test event and confirm your endpoint receives and verifies the payload correctly.</Step>
</Steps>

***

## Related

<CardGroup cols={2}>
  <Card title="Webhook Overview" icon="webhook" href="/user-docs/arms/webhooks/overview">
    Signing, verification, public key, and shared HTTP headers.
  </Card>

  <Card title="Car Actually Placed" icon="train" href="/user-docs/arms/webhooks/car-actually-placed">
    Fires when a car is placed at a station or track.
  </Card>

  <Card title="Train Departure" icon="train" href="/user-docs/arms/webhooks/train-departure">
    Fires when a train departs from a station or customer location.
  </Card>
</CardGroup>
