Authentication
Secure your API requests with API keys.
Security Best Practices
Keep your API keys secure. Never expose them in client-side code or public repositories.
How to Authenticate
Include your API key in the x-api-key header of every request:
curl -H "x-api-key: pdfsign_your_api_key_here" \
-H "Content-Type: application/json" \
https://api.pdf-sign.com/functions/v1/generate-pdf-preview
API Key Format
PDF-Sign API keys follow this format:
pdfsign_xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx
The pdfsign_ prefix helps identify the key type and prevents accidental exposure.
Getting Your API Key
- Log in to your PDF-Sign Dashboard
- Navigate to the API Keys page
- Click "Generate New Key"
- Copy and securely store your key
Multiple Keys
You can create multiple API keys for different environments or applications (development, staging, production).
Authentication Examples
cURL
curl -X POST https://api.pdf-sign.com/functions/v1/generate-pdf-preview \
-H "x-api-key: pdfsign_your_api_key" \
-H "Content-Type: application/json" \
-d '{"templateId": "...", "variables": {...}}'
JavaScript (fetch)
const response = await fetch('https://api.pdf-sign.com/functions/v1/generate-pdf-preview', {
method: 'POST',
headers: {
'x-api-key': 'pdfsign_your_api_key',
'Content-Type': 'application/json',
},
body: JSON.stringify({
templateId: 'your-template-id',
variables: {
clientName: 'John Doe',
amount: '1000',
},
}),
});
const data = await response.json();
Python (requests)
import requests
response = requests.post(
'https://api.pdf-sign.com/functions/v1/generate-pdf-preview',
headers={
'x-api-key': 'pdfsign_your_api_key',
'Content-Type': 'application/json',
},
json={
'templateId': 'your-template-id',
'variables': {
'clientName': 'John Doe',
'amount': '1000',
},
}
)
data = response.json()
Node.js (axios)
const axios = require('axios');
const response = await axios.post(
'https://api.pdf-sign.com/functions/v1/generate-pdf-preview',
{
templateId: 'your-template-id',
variables: {
clientName: 'John Doe',
amount: '1000',
},
},
{
headers: {
'x-api-key': 'pdfsign_your_api_key',
'Content-Type': 'application/json',
},
}
);
Authentication Errors
| Status Code | Error | Description |
|---|---|---|
| 401 | Unauthorized | Missing or invalid API key |
| 403 | Forbidden | API key doesn't have access |
Error Response Example
{
"error": "Invalid API key",
"code": "UNAUTHORIZED",
"status": 401
}
Security Recommendations
- Never commit API keys - Use environment variables instead
- Rotate keys regularly - Generate new keys periodically
- Use separate keys - Different keys for development and production
- Monitor usage - Check the dashboard for unusual activity
- Revoke compromised keys - Delete keys immediately if exposed