> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mobs.ws/llms.txt
> Use this file to discover all available pages before exploring further.

> ## Agent Instructions
> The WebSocket at wss://mobs.ws/v1/ws/metar is the product. The HTTP API is a fallback for backfill only.
> Follow /agents.md for connect, auth, fields, heartbeat, reconnect, and dedupe. Never log MOBS_TOKEN or a URL that includes ?token=.

# Errors

> Socket close codes and HTTP status codes.

## Close codes

| Code | Meaning | Do |
| - | - | - |
| `4000` | Idle: 60 s without a JSON ping or subscription change | Fix the heartbeat, then reconnect |
| `4008` | Connection reached 24 h | Reconnect |
| `4403` | API key revoked or expired | Get a valid API key; do not retry blindly |
| `1013` | Temporary: socket or airport cap overshoot, or a slow reader | Reconnect with backoff |
| `1008` | Reserved: bad path | Check the URL |

See [Close codes](https://docs.mobs.ws/websocket.md#close-codes) on the WebSocket API page.

## On the WebSocket

Errors on an open socket are messages, and the socket stays open. Codes: `invalid_airports`, `bad_request`, `unknown_action`, `too_many_airports`. Other events close the socket with a close code instead, for example `4403` when an API key is revoked or expires. See [Errors on the socket](https://docs.mobs.ws/websocket.md#errors-on-the-socket).

## HTTP

502 and 504 are not used: MOBS answers from memory.

| HTTP | Meaning |
| - | - |
| 400 | `invalid_airports`: an airport is not covered |
| 401 | Invalid or expired API key |
| 403 | API key lacks the scope |
| 422 | Bad query: malformed code, more than 100 codes, bad `mode`, or missing `airports` |
| 429 | Rate limit, with Retry-After |
| 503 | METAR not live yet after a start, or the server-wide cap |

Bodies are JSON with `error`, `message` and, on 429 and a full-server 503, `retry_after_s`.

> [!NOTE]
>
> Placeholder · A11

```json 401 theme={"dark"}
{"error":"unauthorized",
 "message":"a valid API key is required"}
```

```json 403 theme={"dark"}
{"error":"forbidden",
 "message":"this API key does not have the stream scope"}
```

```json 429 · socket limit theme={"dark"}
{"error":"rate_limited",
 "message":"too many connections for this API key",
 "retry_after_s":30}
```

> [!NOTE]
>
> These messages use the "API key" wording that shipped in v0.11.3, which is the current `main`. The 403 message names the missing scope (`stream` or `latest`), so the example above is the `stream` case.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.