Authentication
Pdflet supports two authentication methods: API Keys (recommended) and JWT Tokens.API Keys (Recommended)
API keys are the simplest way to authenticate. Include your key in theX-API-Key header:
Creating API Keys
- Log in to your Pdflet Dashboard
- Navigate to API Keys
- Click Create API Key
- Enter a descriptive name (e.g., “Production Server”)
- Copy and securely store your key
API Key Format
API keys follow this format:- Live keys:
pk_live_prefix (32 characters total) - Example:
pk_live_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6
Best Practices
Use environment variables
Use environment variables
Never hardcode API keys in your source code:
Use separate keys per environment
Use separate keys per environment
Create different keys for development, staging, and production
Rotate keys periodically
Rotate keys periodically
Revoke and replace keys every 90 days for security
Limit key permissions
Limit key permissions
Create keys with only the permissions you need
JWT Authentication
For web applications where users interact directly, use JWT (JSON Web Token) authentication.Obtaining Tokens
Using Access Tokens
Include the access token in theAuthorization header:
Refreshing Tokens
Access tokens expire after 5 minutes. Use the refresh token to get a new access token:Token Lifetimes
| Token Type | Lifetime |
|---|---|
| Access Token | 5 minutes |
| Refresh Token | 1 day |
Which Should I Use?
| Use Case | Recommended Method |
|---|---|
| Backend server-to-server | API Key |
| CLI tools or scripts | API Key |
| Web application (frontend) | JWT |
| Mobile application | JWT |
| Microservices | API Key |
API keys are simpler but cannot be revoked per-session. JWT tokens offer more granular control for user-facing applications.