|
| 1 | +--- |
| 2 | +title: "Authentication" |
| 3 | +description: "Every Reader API request is authenticated with an API key passed in the x-api-key header." |
| 4 | +--- |
| 5 | + |
| 6 | +Reader uses API key authentication. Every request to `https://api.reader.dev/v1/*` must include a valid key in the `x-api-key` header. |
| 7 | + |
| 8 | +## Get an API key |
| 9 | + |
| 10 | +<Card title="Open Dashboard →" href="https://app.reader.dev" horizontal> |
| 11 | + Sign up free at app.reader.dev. You get **1,000 credits every month** on the free tier - no credit card required. |
| 12 | +</Card> |
| 13 | + |
| 14 | +Inside the dashboard: |
| 15 | + |
| 16 | +1. Click **API Keys** in the sidebar |
| 17 | +2. Click **Create API Key** and give it a name |
| 18 | +3. Copy the key - it starts with `rdr_` and is shown **only once** |
| 19 | + |
| 20 | +<Warning> |
| 21 | +API keys are shown once at creation time. Store them securely (environment variables, a secrets manager) - never commit them to version control or expose them in client-side code. |
| 22 | +</Warning> |
| 23 | + |
| 24 | +## Using your key |
| 25 | + |
| 26 | +Pass the key in the `x-api-key` header on every request: |
| 27 | + |
| 28 | +<CodeGroup> |
| 29 | + |
| 30 | +```bash curl |
| 31 | +curl -X POST https://api.reader.dev/v1/read \ |
| 32 | + -H "Content-Type: application/json" \ |
| 33 | + -H "x-api-key: rdr_your_api_key" \ |
| 34 | + -d '{"url": "https://example.com"}' |
| 35 | +``` |
| 36 | + |
| 37 | +```javascript JavaScript |
| 38 | +import { ReaderClient } from "@vakra-dev/reader-js"; |
| 39 | + |
| 40 | +// The SDK handles the header for you |
| 41 | +const reader = new ReaderClient({ |
| 42 | + apiKey: process.env.READER_API_KEY, |
| 43 | +}); |
| 44 | +``` |
| 45 | + |
| 46 | +```python Python |
| 47 | +from reader_py import ReaderClient |
| 48 | + |
| 49 | +# The SDK handles the header for you |
| 50 | +reader = ReaderClient(api_key=os.environ["READER_API_KEY"]) |
| 51 | +``` |
| 52 | + |
| 53 | +</CodeGroup> |
| 54 | + |
| 55 | +## Managing keys |
| 56 | + |
| 57 | +All key management happens in the dashboard - not through the API. This is intentional: rotating, revoking, and creating keys is a privileged operation that shouldn't be scriptable from a compromised key. |
| 58 | + |
| 59 | +- **List keys** - API Keys page in the dashboard |
| 60 | +- **Create a new key** - Click "Create API Key" |
| 61 | +- **Revoke a key** - Click the trash icon next to any key |
| 62 | +- **Rotate a key** - Create a new one, update your app, then revoke the old one |
| 63 | + |
| 64 | +You can have up to **10 active keys per workspace**. Use separate keys for development, staging, and production so you can rotate them independently. |
| 65 | + |
| 66 | +## Error responses |
| 67 | + |
| 68 | +| Status | Meaning | |
| 69 | +|---|---| |
| 70 | +| `401 Unauthorized` | Missing, invalid, or revoked `x-api-key` header | |
| 71 | +| `402 Payment Required` | Key is valid but the workspace has run out of credits | |
| 72 | +| `403 Forbidden` | Key doesn't have permission for the requested resource | |
| 73 | + |
| 74 | +See the full [Errors](/home/concepts/errors) reference for status code details and retry guidance. |
| 75 | + |
| 76 | +## Where to go next |
| 77 | + |
| 78 | +<CardGroup cols={2}> |
| 79 | + <Card title="Make your first request" icon="bolt" href="/home/quickstart"> |
| 80 | + 60-second walkthrough from key creation to first scrape. |
| 81 | + </Card> |
| 82 | + <Card title="POST /v1/read" icon="code" href="/api-reference/read"> |
| 83 | + Full reference for the unified scrape/crawl/batch endpoint. |
| 84 | + </Card> |
| 85 | +</CardGroup> |
0 commit comments