Authentication

PDFShot uses API keys to authenticate requests. Include your key in the Authorization header.

Using Your API Key

Send your API key as a Bearer token:

Authorization: Bearer pds_your_api_key_here

Full request example:

const response = await fetch('https://convert.pdfshot.com/convert', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer pds_abc123...',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({ html: '<h1>Hello</h1>' })
})

Key Format

API keys follow this format:

  • Prefix: pds_
  • Length: 40 characters total
  • Characters: lowercase letters and numbers

Example: pds_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6

Managing API Keys

Create a Key

  1. Sign in to your Dashboard
  2. Click "Create API Key"
  3. Give it a descriptive name (e.g., "Production", "Development")
  4. Copy the key immediately - you won't see it again
Important: Copy your API key when it's shown. For security, we only store a hash of the key and cannot retrieve the original.

Revoke a Key

If a key is compromised:

  1. Go to your Dashboard
  2. Find the key by name or prefix
  3. Click "Revoke"
  4. The key stops working immediately

Security Best Practices

Do

  • Store keys in environment variables
  • Use different keys for development and production
  • Rotate keys periodically
  • Revoke unused keys

Don't

  • Commit keys to version control
  • Share keys in chat or email
  • Expose keys in client-side JavaScript
  • Log keys in application logs

Environment Variables

Store your key in an environment variable:

# .env (don't commit this file)
PDFSHOT_API_KEY=pds_your_api_key_here

Access it in your code:

const apiKey = process.env.PDFSHOT_API_KEY

Error Responses

StatusCodeMeaning
401UNAUTHORIZEDMissing or malformed Authorization header
403FORBIDDENInvalid or revoked API key

Example error response:

{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid Authorization header"
  }
}