# Health & readiness

Unauthenticated liveness and readiness endpoints for load balancers, uptime checks and orchestrators.


The API exposes two endpoints at the root (not under `/v1`) that need no API key or other headers. They don't count toward your rate limit and don't appear in request logs.

## Liveness

```http
GET https://social-publish-api.onrender.com/health
```

Returns `200` whenever the API process is up and serving requests. It doesn't check any dependency, so use it for liveness probes.

```bash tab="cURL"
curl https://social-publish-api.onrender.com/health
```

```ts tab="Node.js"
const res = await fetch("https://social-publish-api.onrender.com/health");
const { ok } = await res.json();
```

```python tab="Python"
import requests

ok = requests.get("https://social-publish-api.onrender.com/health", timeout=5).json()["ok"]
```

```json title="Response 200"
{ "ok": true }
```

## Readiness

```http
GET https://social-publish-api.onrender.com/ready
```

Checks the database (`select 1`) and the queue (Redis `PING`), each with a 2-second timeout. Returns `200` when both respond, otherwise `503`. Use it for readiness probes and to decide whether to route traffic to an instance.

```bash tab="cURL"
curl -i https://social-publish-api.onrender.com/ready
```

```ts tab="Node.js"
const res = await fetch("https://social-publish-api.onrender.com/ready");
const body = await res.json(); // { ok, database, redis }
if (res.status === 503) console.warn("Not ready:", body);
```

```python tab="Python"
import requests

res = requests.get("https://social-publish-api.onrender.com/ready", timeout=5)
body = res.json()  # {"ok": ..., "database": ..., "redis": ...}
if res.status_code == 503:
    print("Not ready:", body)
```

```json title="Response 200"
{ "ok": true, "database": "ok", "redis": "ok" }
```

```json title="Response 503"
{ "ok": false, "database": "ok", "redis": "timeout" }
```

### Fields

| Field | Type | Description |
| --- | --- | --- |
| `ok` | boolean | `true` only when both checks returned `ok`. |
| `database` | string | `ok`, `timeout`, or the error message from the database. |
| `redis` | string | `ok`, `timeout`, or the error message from Redis. |
