Skip to content

Authentication

All Developer API endpoints require an API key. You can pass your key in one of two ways:

Terminal window
curl https://api.anonpaste.com/api/dev/pastes/get/aB3xYz \
-H "x-api-key: your_api_key_here"
Terminal window
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.

StatusReasonDescription
401API key requiredNo key was provided
401Invalid API keyThe key doesn’t match any account
429Monthly limit reachedFree quota exhausted and no credits available
  • 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:
Terminal window
export ANONPASTE_API_KEY="your_api_key_here"
import { AnonPaste } from 'anonpaste-sdk';
const anonpaste = AnonPaste.init({
apiKey: process.env.ANONPASTE_API_KEY!,
});