API keys authenticate your requests to the Screenshotly API. Manage them from the API settings page in your dashboard.
Generating a new key
- Go to API settings
- Click Generate new API key
- Give the key a descriptive name (e.g., “Production server”, “Staging”)
- Copy the key immediately
The full API key is only shown once. Copy it and store it securely. If you lose it, you’ll need to generate a new one.
Using your key
Include it in the screenshotly-api-key header:
curl -X POST https://api.screenshotly.dev/api/v1/screenshots \
-H "screenshotly-api-key: YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com"}'
Or pass it to the JavaScript SDK constructor:
const client = new Screenshotly(process.env.SCREENSHOTLY_API_KEY);
Revoking a key
- Go to API settings
- Find the key you want to revoke
- Click Revoke
- Confirm the action
Once revoked, the key immediately stops working. Any requests using the revoked key will receive a 401 Unauthorized response.
Best practices
- Use environment variables — never hardcode API keys in source files
- Separate keys per environment — use different keys for development, staging, and production
- Name keys descriptively — so you know which key is used where
- Revoke unused keys — remove keys that are no longer in use
- Rotate keys periodically — generate new keys and phase out old ones
- Never commit keys — add
.env to your .gitignore file
# .env
SCREENSHOTLY_API_KEY=your-api-key-here