# GET /api/public/health/ready

> Readiness check

Answers `200` only when the instance has started and its dependencies answer, otherwise `503`. It is meant for
monitoring; an integration does not need to call it.

Up to two checks, listed in `checks`:

1. `startup`: the instance has finished starting.
2. `documentstore`: the document database answers. It is only checked once the instance has started.

The answer says which check failed, never host names, connection strings or exception texts.
`GET /api/public/health` is the plain liveness check and does not look at these.

- Surface: `/api/public` · operationId `getReadiness` · Group: Health
- Authorisation: No token
- Organisation key: no capability: the route needs no token, and the key's token isn't sent on
- The spec: https://developers.rivr.io/openapi/api-public.json
- The spec's introduction: https://developers.rivr.io/reference/api-public.md
- Page in the portal: https://developers.rivr.io/reference/api-public/getReadiness

The examples target the sandbox (`https://api.test.rivr.io`) and need test credentials.

## Responses

### 200

OK

`application/json`

**Response fields**

| Field | Type | Description |
| --- | --- | --- |
| `title` | string | Always `health/ready`. |
| `ready` | boolean | Whether the instance is ready to take traffic. |
| `checks` | ReadinessCheck[] | Every check that was run, with its name, whether it passed and a short note (currently in Swedish, for people to read). The notes never contain host names or exception texts. |
| `checks[].name` | string | What was checked: `startup` or `documentstore`. |
| `checks[].ok` | boolean | Whether the check passed. |
| `checks[].detail` | string | A short note about the outcome, currently in Swedish, never host names, connection strings or tokens. Free text for people to read, not a stable value: do not program against it. |
| `code` | string | `service_not_ready` when the instance is not ready, otherwise left out. (nullable) |
| `type` | string | A link to the documentation for `code`. Left out when there is no `code`. (nullable) |
| `message` | string | What to do about the error. Left out when there is no `code`. (nullable) |

**Example**

```json
{
  "title": "string",
  "ready": false,
  "checks": [
    {
      "name": "string",
      "ok": false,
      "detail": "string"
    }
  ],
  "code": "string",
  "type": "string",
  "message": "string"
}
```

### 503

The instance is not ready to take traffic: `code` `service_not_ready`, with `checks`.

Error codes: [service_not_ready](https://developers.rivr.io/errors/service_not_ready.md)

`application/json`

```json
{
  "title": "health/ready",
  "ready": false,
  "checks": [
    {
      "name": "startup",
      "ok": true,
      "detail": "alla hostade tjänster har startat"
    },
    {
      "name": "documentstore",
      "ok": false,
      "detail": "svarade inte (TimeoutException)"
    }
  ],
  "code": "service_not_ready",
  "type": "https://developers.rivr.io/errors/service_not_ready",
  "message": "The instance is not ready to take traffic. checks says which check failed."
}
```

## Example request

```bash
curl -X GET https://api.test.rivr.io/api/public/health/ready
```
