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

# Station safety

> Make sure a panel only takes output scenes and sets variables of the station it was set up for, on studios that several stations share.

A Core belongs to one studio. Automations, outputs and variables belong to the **station** that is on that studio at the moment. When several stations share a studio, their variables and output scenes can have the same names. A Stream Deck key set up to take Radio 1's `weather` scene must not take Radio 2's `weather` scene after the studio switched station.

The Core API has two tools for this: pinning a device to a station and the `?station=` parameter. Together they are the station guard.

## Which routes are station-scoped

| Feature | Routes |
| - | - |
| Automations | `/api/v2/automations`, `/api/v2/automations/{id}`, `/api/v2/automations/{id}/state` |
| Outputs | `/api/v2/outputs` and every route under `/api/v2/outputs/{slot}` |
| Variables | `/api/v2/variables` and every route under `/api/v2/variables/{name}` |

Every other route, macros, signals and cameras included, acts on the studio and works whatever station is on it. Macros are the macros the Core has loaded for the station on the studio, but a pin does not hold them back. Every successful answer of a station-scoped route carries the station it acted on:

```json theme={null}
{"id":"v-01…","name":"title","value":"Morning Show","confirmed":true,"ok":true,"station":{"id":"4c2a…","name":"Radio 1"}}
```

## Pin a device to a station

Set **Station** on the device in **Studio settings → Core API → Devices**. While another station holds the studio, the device's station-scoped calls answer `409 station_mismatch`. Its studio calls, like `/api/v2/studio/onair`, keep working.

This is the simplest option: the panel needs no extra parameter and cannot act on the wrong station. The pin is always enforced; a `?station=` on the call is checked in addition to it, so a pinned device cannot talk itself onto another station.

## Name the station on the call

Add `?station=` with the station id or name to any route. Names are matched case-insensitively, ids exactly. When another station holds the studio, the call answers `409 station_mismatch` and does nothing.

```bash theme={null}
curl -H "Authorization: Bearer vra_examp1etoken…" \
  "http://192.168.1.50:3002/api/v2/outputs/main/scenes/weather/take?station=Radio%201"
```

`?station=` works on studio routes too. `/api/v2/studio/onair?station=Radio%201` only puts the studio on air while Radio 1 is on it.

A refused call names the expected and the actual station:

```json theme={null}
{"expected":"Radio 2","station":{"id":"4c2a…","name":"Radio 1"},"ok":false,"error":"station_mismatch","message":"this Core is on station 'Radio 1', not 'Radio 2'"}
```

The plain twin answers `ERR station_mismatch`.

## Calls that name no station

There are no guard modes. The studio owns the station that is on it, so a station-scoped call from a device without a pin and without `?station=` acts on that station. The guard only stops a key that is fixed on another station: a pin or `?station=` that does not match the station on the studio answers `409 station_mismatch`.

Fix the key whenever the studio rotates between stations. A Stream Deck page built for Radio 1 must not fire on the studio after it rotates to Radio 2: pin the device to Radio 1, or add `?station=Radio%201` to its calls.

## While the studio switches station

The Core follows the station on its studio live. When the studio switches station in VRA Cloud, the Core hears of it at once and asks the cloud which station is on the studio now. Until that answer is in, a call that names a station, by pin or by `?station=`, answers `409 station_changing`. Handle it like `503`: retry after a moment. A call that names no station is not held up; it acts on the station the Core knew last.

The station in the answers, in `GET /api/v2/station` and in the guard follows the swap straight away.

## Variables

Variables are written through VRA Cloud. Besides the checks above, the Core sends the station it is on with every write, and the cloud refuses the write with `409 station_mismatch` when another station holds the studio by then. A write can therefore not land on the wrong station, even in the moment before the Core has seen a swap.

For outputs, `?station=` is also held against the station of the output itself. An output that still plays another station's show answers `409 station_mismatch` with `expected` and `output_station_id`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.