# Control the board's timer

`POST https://evohub.io/api/v1/retro/boards/{boardID}/timer`

Part of the [Retro API](https://docs.evohub.io/retro.md) reference · operationId `controlRetroTimer`.

Runs the board's shared countdown, which everyone on the board sees:

| `action` | What it does |
| --- | --- |
| `start` | Starts a countdown of `minutes` (1–120), replacing any timer. |
| `pause` | Pauses a running countdown that has time left. |
| `resume` | Resumes a paused countdown. |
| `add_minute` | Adds a minute to a running or paused countdown; one that reached zero restarts from now. |
| `stop` | Clears the timer. |

An action the timer is not in a state for answers **409**
`TIMER_STATE`. The board must be active. The answer is the timer
afterwards; count down against `server_time` rather than your own
clock.

Requires the `retro:board:write` scope.

## Authorization

Any one of:

- `bearerKey`
- `headerKey`

Where:

- `bearerKey`: HTTP Bearer — An EvoHub API key (`evohub_…`) as a bearer token.
- `headerKey`: API key in the header `X-API-Key` — An EvoHub API key (`evohub_…`).

## Path parameters

- `boardID` (string, required, example `brd_3f9a1c7e2b8d4a60`): The board's ID.

## Request body (required)

Content type: `application/json`

Type: `object`

- `action` (string, required, one of `start`, `pause`, `resume`, `add_minute`, `stop`)
- `minutes` (integer, min 1, max 120): The countdown's length; required for `start`, ignored otherwise.

## Responses

### 200 — The timer.

Content type: `application/json`

Type: `object`

- `success` (boolean)
- `data` (Timer)
  - `state` (string, one of `idle`, `running`, `paused`): A running timer whose end has passed stays `running` with `remaining_ms` 0 until it is stopped.
  - `ends_at` (string (date-time)): When a running countdown ends; left out otherwise.
  - `remaining_ms` (integer (int64)): Time left, in milliseconds.
  - `server_time` (string (date-time)): The server's clock when the timer was read.

### 400 — The body is not JSON (`INVALID_BODY`), `action` is unknown (`INVALID_ACTION`), or `start` has `minutes` outside 1–120 (`INVALID_MINUTES`).

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

### 401 — No API key was sent, or it is unknown, revoked or expired (`UNAUTHORIZED`).

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

### 403 — The key lacks the scope this endpoint needs (`FORBIDDEN`).

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

### 404 — The board does not exist, or the caller cannot see it (`NOT_FOUND`).

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

### 409 — The board is closed (`BOARD_CLOSED`), or the timer cannot take this action now (`TIMER_STATE`).

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

### 429 — Too many requests (`RATE_LIMITED`). Wait for `Retry-After` seconds.

Headers:

- `Retry-After` (integer): Seconds to wait before retrying.

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

### 500 — Something went wrong on EvoHub's side (`INTERNAL_ERROR`). Retry later.

Content type: `application/json`

Type: `Error`

- `success` (boolean, value `false`): Sent by Retro itself; refusals before the request reaches Retro (401, 429) carry only `error`.
- `error` (object, required)
  - `code` (string, required, example `NOT_FOUND`)
  - `message` (string, required, example `board not found`)
  - `request_id` (string)

## Example request

```bash
curl -X POST 'https://evohub.io/api/v1/retro/boards/brd_3f9a1c7e2b8d4a60/timer' \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer <TOKEN>' \
  -d '{
  "action": "start",
  "minutes": 5
}'
```
