# Advance a cue without advancing twice

> Send a version-checked stage timer command to a rehearsal room. Learn when to reuse an idempotency key and how to handle stale room state.

- Canonical: https://runofsho.com/developers/playback/
- Last updated: 2026-11-22
- Publisher: runofsho

## Read before you act

Use a [rehearsal room with at least two cues](https://runofsho.com/developers/rundowns/) and an `operate` key authorized for that room. Set `API`, `ROOM` and `RUNOFSHO_KEY` as in the [quickstart](https://runofsho.com/developers/quickstart/). This example changes the selected timer; do not point it at a live show.

```bash
STATE=$(curl -fsS "$API/rooms/$ROOM/state" \
  -H "Authorization: Bearer $RUNOFSHO_KEY") || exit 1
printf '%s' "$STATE" | jq '.data | {version, current_timer, next_timer}'
VERSION=$(jq -er '.data.version' <<< "$STATE") || exit 1
```

## Send one Next command

Confirm that the displayed next timer is the one you intend to cue. Generate one unique key for this button press (`uuidgen` here), then keep that key and payload together until the outcome is known.

```bash
PRESS=$(uuidgen) || exit 1
PAYLOAD=$(jq -n --argjson v "$VERSION" '{expected_version:$v,autostart:false}')
curl -sS --fail-with-body "$API/rooms/$ROOM/playback/next" \
  -H "Authorization: Bearer $RUNOFSHO_KEY" \
  -H "Idempotency-Key: $PRESS" \
  -H 'Content-Type: application/json' --data "$PAYLOAD"
```

Success returns the new room state in `data`. Read `data.current_timer` and `data.version` instead of guessing which row won. When a button means “start” or “pause”, use the explicit `start` or `stop` command rather than `toggle`.

## Decide whether to retry

| Outcome | Correct next action |
|---|---|
| Connection dropped before the reply | Retry the **same cURL call**, not the setup lines. The same key and request can replay the first response for 24 hours. |
| `409 STALE_STATE` | Fetch room state again. Show the operator the current and next cue; only issue a new command if they still intend to advance. |
| `409 IDEMPOTENCY_CONFLICT` | The key was reused for a different request. Do not silently replace it and resend. |
| `422 INVALID_TRANSITION` | Next does not wrap around from the last timer. Inspect the selected cue instead of retrying. |

## Endpoint reference

- [Get everything a display needs](https://api.runofsho.com/docs/#tag/state/GET/v1/rooms/{roomId}/state): `GET /v1/rooms/{roomId}/state` (`getRoomState`).
- [Go to the next timer](https://api.runofsho.com/docs/#tag/playback/POST/v1/rooms/{roomId}/playback/next): `POST /v1/rooms/{roomId}/playback/next` (`playbackNext`).
- [Start or resume a timer](https://api.runofsho.com/docs/#tag/playback/POST/v1/rooms/{roomId}/playback/start): `POST /v1/rooms/{roomId}/playback/start` (`playbackStart`).
- [Pause the running timer](https://api.runofsho.com/docs/#tag/playback/POST/v1/rooms/{roomId}/playback/stop): `POST /v1/rooms/{roomId}/playback/stop` (`playbackStop`).
