Authentication
All Developer API endpoints require an API key. You can pass your key in one of two ways:
x-api-key header (recommended)
Section titled “x-api-key header (recommended)”curl https://api.anonpaste.com/api/dev/pastes/get/aB3xYz \ -H "x-api-key: your_api_key_here"Authorization: Bearer header
Section titled “Authorization: Bearer header”curl https://api.anonpaste.com/api/dev/pastes/get/aB3xYz \ -H "Authorization: Bearer your_api_key_here"The SDK always uses x-api-key internally.
Error responses
Section titled “Error responses”| Status | Reason | Description |
|---|---|---|
401 | API key required | No key was provided |
401 | Invalid API key | The key doesn’t match any account |
429 | Monthly limit reached | Free quota exhausted and no credits available |
Keeping your key safe
Section titled “Keeping your key safe”- Never expose your API key in client-side JavaScript or public repositories
- If a key is compromised, regenerate it from Settings → Developer — the old key is immediately invalidated
- For server-side applications, store the key in an environment variable:
export ANONPASTE_API_KEY="your_api_key_here"import { AnonPaste } from 'anonpaste-sdk';
const anonpaste = AnonPaste.init({ apiKey: process.env.ANONPASTE_API_KEY!,});