# Usual run times

**GET** `/api/runs/usual`

Returns each workflow’s usual run time: the median of its recent runs that worked.

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

## Parameters

### Query

- `workflowId` · Optional · UUID: A workflow’s ID. Repeat it for more, up to 200. Left out: every workflow.

## Which runs count

The newest 200 production runs of the last 30 days that worked and never waited for a person. `p50Ms` is their median, `runs` how many there were. A workflow with fewer than 5 such runs is left out.

## Responses

- 200 OK

  The times, by workflow ID.

- 400 `VALIDATION_ERROR`

  A `workflowId` isn’t a UUID, or there are more than 200.

- 403 `FORBIDDEN`

  The token lacks the **Read** permission for runs.

- 500 `INTERNAL_ERROR`

  The times couldn’t be read. Try again.

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) · [`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 Read for runs

URL="$GORUNNER/api/runs/"
URL="${URL}usual?workflowId=3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31"
curl "$URL" \
  -H "Authorization: Bearer $GORUNNER_TOKEN"
```

**JavaScript**

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

const res = await fetch(
  `${GORUNNER}/api/runs/` +
    `usual?workflowId=3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31`,
  {
    headers: { Authorization: `Bearer ${TOKEN}` },
  },
);
const { data } = await res.json();
```

**Python**

```python
import os, requests

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

res = requests.get(
    f"{GORUNNER}/api/runs/usual",
    params={
      "workflowId": "3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31",
    },
    headers={"Authorization": f"Bearer {TOKEN}"},
)
data = res.json()["data"]
```

Response · 200 OK

```json
{
  "data": {
    "3b1e5c2a-7d4f-4e8b-a1c6-5f2d9b0e7a31": {
      "p50Ms": 1720,
      "runs": 64
    }
  }
}
```

**Every field**

It takes no body.

### Response · 200 OK

- `data` · object
  - `{key}` · object: Each key’s value.
    - `p50Ms` · integer
    - `runs` · integer

Related: [Summarize a range of runs](https://docs.gorunner.io/api/stats/summarize-run-range) · [List runs](https://docs.gorunner.io/api/runs/list-runs)

Source: https://docs.gorunner.io/api/stats/get-usual-run-times
