# Approve or reject a held run

**POST** `/api/runs/{id}/decision`

Approves or rejects the approval a held run waits for, as its own link would.

Needs [an API token](https://docs.gorunner.io/api/authentication#scopes) with the **Cancel and delete** permission for runs (`run:manage`).

## Parameters

### Path

- `id` · Required · UUID: The run’s ID.

### Body

- `decision` · Required · string: `approve` or `reject`, in any case. `approved`, `rejected`, `decline` and `declined` work too.

## Who may answer

Deciding carries a run on, so it needs the same permission as cancelling. A reader without it doesn’t get the approve and reject links in [Get a run](https://docs.gorunner.io/api/runs/get-run) either. The run records who answered.

## Responses

- 200 OK

  The answer is recorded. A worker carries the run on shortly.

- 400 `VALIDATION_ERROR`

  `id` isn’t a UUID, or `decision` isn’t approve or reject.

- 403 `FORBIDDEN`

  The token lacks the **Cancel and delete** permission for runs (`run:manage`), which deciding needs.

- 404 `NOT_FOUND`

  No run with this ID in the token’s workspace.

- 409 `NOT_WAITING`

  The run isn’t waiting for an approval.

- 409 `ALREADY_ANSWERED`

  Someone already answered it.

- 409 `ACCOUNT_SUSPENDED`

  The workspace’s account is suspended.

- 500 `INTERNAL_ERROR`

  The answer couldn’t be recorded. The run is still held.

- 500 `ENQUEUE_FAILED`

  The answer couldn’t be handed to a worker. The run is still held.

Any call can also answer: [`401 UNAUTHORIZED`](https://docs.gorunner.io/errors#UNAUTHORIZED) · [`401 TOKEN_ENDED`](https://docs.gorunner.io/errors#TOKEN_ENDED) · [`403 TOKEN_SURFACE_OFF`](https://docs.gorunner.io/errors#TOKEN_SURFACE_OFF) · [`403 FEATURE_OFF`](https://docs.gorunner.io/errors#FEATURE_OFF) · [`403 EMBED_NOT_ALLOWED`](https://docs.gorunner.io/errors#EMBED_NOT_ALLOWED) · [`403 EMBED_NOT_AVAILABLE`](https://docs.gorunner.io/errors#EMBED_NOT_AVAILABLE) · [`403 ACCOUNT_SUSPENDED`](https://docs.gorunner.io/errors#ACCOUNT_SUSPENDED) · [`413 PAYLOAD_TOO_LARGE`](https://docs.gorunner.io/errors#PAYLOAD_TOO_LARGE) · [`415 INVALID_CONTENT_TYPE`](https://docs.gorunner.io/errors#INVALID_CONTENT_TYPE) · [`429 RATE_LIMITED`](https://docs.gorunner.io/errors#RATE_LIMITED) · [`503 BUSY`](https://docs.gorunner.io/errors#BUSY) · [`503 PAUSED`](https://docs.gorunner.io/errors#PAUSED) · [`503 SERVICE_UNAVAILABLE`](https://docs.gorunner.io/errors#SERVICE_UNAVAILABLE). See [Errors](https://docs.gorunner.io/api/errors#by-status).

Request

**curl**

```bash
GORUNNER="https://api.gorunner.io"
GORUNNER_TOKEN="grt_…"  # needs Cancel and delete for runs
RUN_ID="your-run-id"

curl -X POST "$GORUNNER/api/runs/$RUN_ID/decision" \
  -H "Authorization: Bearer $GORUNNER_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "decision": "approve"
  }'
```

**JavaScript**

```js
const GORUNNER = "https://api.gorunner.io";
const TOKEN = process.env.GORUNNER_TOKEN;
const RUN_ID = process.env.RUN_ID;

const res = await fetch(
  `${GORUNNER}/api/runs/${RUN_ID}/decision`,
  {
    method: "POST",
    headers: {
        Authorization: `Bearer ${TOKEN}`,
        "Content-Type": "application/json",
      },
    body: JSON.stringify({ decision: "approve" }),
  },
);
const { data } = await res.json();
```

**Python**

```python
import os, requests

GORUNNER = "https://api.gorunner.io"
TOKEN = os.environ["GORUNNER_TOKEN"]
RUN_ID = os.environ["RUN_ID"]

res = requests.post(
    f"{GORUNNER}/api/runs/{RUN_ID}/decision",
    headers={"Authorization": f"Bearer {TOKEN}"},
    json={"decision": "approve"},
)
data = res.json()["data"]
```

Response · 200 OK

```json
{
  "data": {
    "runId": "8f0c41d2-6b7e-4c1a-9d3f-2a5b7c9e1f04",
    "status": "resuming",
    "waitStep": "manager_ok",
    "decision": "approved"
  }
}
```

**Every field**

### Body

- `decision` · Required · string: `approved`/`rejected`, and `decline`/`declined` for a rejection, are accepted too, in any case. One of `approve`, `reject`.

### Response · 200 OK

- `data` · object
  - `runId` · UUID
  - `status` · string: One of `resuming`.
  - `waitStep` · string
  - `decision` · string: One of `approved`, `rejected`.

Related: [Ask for approval](https://docs.gorunner.io/build/ask-for-approval) · [List runs](https://docs.gorunner.io/api/runs/list-runs) · [Get a run](https://docs.gorunner.io/api/runs/get-run)

Source: https://docs.gorunner.io/api/runs/decide-run
