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

# API Overview

> Base URL, format conventions, limits, request IDs, and error model.

## Base URL and versioning

* Production base URL: `https://api.safefetch.dev`
* Local self-host default: `http://localhost:3000`
* Versioned API prefix: `/v1`

## Request and response format

* Content type: JSON
* Field naming: `snake_case`
* Authenticated routes: `/v1/*`

## Rate limiting

`/v1/*` routes are rate-limited per API key.

<ParamField path="limit" type="integer" required>
  Default server limit is `100` requests/second per key (`RATE_LIMIT_PER_SECOND`).
</ParamField>

<ParamField path="Retry-After" type="string">
  Returned on `429`, value is `1` second.
</ParamField>

## Request IDs

Every response includes `X-Request-Id`.

* Send your own `X-Request-Id` to correlate client and server logs.
* If omitted, SafeFetch generates one.

## Error format

```json theme={null}
{
  "error": {
    "code": "validation_error",
    "message": "Validation failed",
    "details": [],
    "request_id": "req_..."
  }
}
```

## Error codes

* `missing_body`
* `validation_error`
* `missing_field`
* `invalid_request`
* `invalid_query`
* `invalid_content_type`
* `unauthorized`
* `rate_limited`
* `payload_too_large`
* `method_not_allowed`
* `not_found`
* `not_cancellable`
* `not_approvable`
* `not_retryable`

## Content-Type requirements

<Warning>
  `POST` and `PUT` endpoints require `Content-Type: application/json`.
</Warning>

## Payload size limit

<Warning>
  Request bodies above `1MB` are rejected with `413 payload_too_large`.
</Warning>
