Secure your API requests with API keys. Learn how to create, manage, and rotate your keys safely.
SnapshotAI uses API keys to authenticate requests. Your API keys carry many privileges, so be sure to keep them secure!
Keep your API keys secret!
Never expose your API keys in client-side code, GitHub, or public repositories. Use environment variables instead.
sk_live_...All API keys start with sk_live_ followed by 48 random characters.
Example:
sk_live_Ox-hfmB3RGfsQUkYkJ-wHKsmPfnh1ZiePVEjcOL0Yisf4FsjInclude your API key in the Authorization header with the Bearer scheme:
curl https://snapshotai.dev/api/v1/screenshots \
-H "Authorization: Bearer sk_live_YOUR_API_KEY_HERE" \
-H "Content-Type: application/json"Tip: Store your API key in environment variables:
export SNAPSHOTAI_API_KEY="sk_live_..."401 UnauthorizedMissing or invalid API key
{
"success": false,
"error": {
"message": "Invalid API key",
"code": "UNAUTHORIZED"
}
}403 ForbiddenAPI key is inactive or expired
{
"success": false,
"error": {
"message": "API key is inactive",
"code": "FORBIDDEN"
}
}curl -X POST https://snapshotai.dev/api/v1/keys \
-H "Authorization: Bearer YOUR_SESSION_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "Production API Key",
"type": "live",
"expires_at": "2025-12-31T23:59:59Z"
}'⚠️ Save Your Key Immediately
The full API key is only shown once during creation. If you lose it, you'll need to create a new one.
If your API key is compromised, rotate it immediately:
curl -X POST https://snapshotai.dev/api/v1/keys/KEY_ID/rotate \
-H "Authorization: Bearer YOUR_SESSION_TOKEN"This will:
Best Practice: Regular Rotation
Rotate your API keys every 90 days as a security best practice, even if not compromised.
Use environment variables
Never hardcode API keys in your source code
Use separate keys per environment
Create different keys for development, staging, and production
Monitor API key usage
Check the last_used_at field regularly
Set expiration dates
Limit the lifetime of API keys for temporary access
Delete unused keys
Remove keys that are no longer needed
Use HTTPS only
Never send API keys over unencrypted connections
Act immediately if you suspect a key is compromised:
Need help? Contact our security team at security@snapshotai.dev