Usage
Get your API usage statistics.
Usage
Retrieve your current API usage statistics including PDF generation counts, rate limits, and quota status.
Get Usage Statistics
GET
/v1/usage
Get current usage statistics for your account.
Code Examples
curl https://api.pdfapi.dev/v1/usage \
-H "Authorization: Bearer sk_live_xxx"
const response = await fetch('https://api.pdfapi.dev/v1/usage', {
headers: {
'Authorization': `Bearer ${process.env.PDFAPI_KEY}`,
},
});
const { data } = await response.json();
console.log(`Used ${data.pdfs_generated} of ${data.pdfs_limit} PDFs this month`);
import requests
response = requests.get(
'https://api.pdfapi.dev/v1/usage',
headers={
'Authorization': f'Bearer {os.environ["PDFAPI_KEY"]}',
}
)
data = response.json()['data']
print(f"Used {data['pdfs_generated']} of {data['pdfs_limit']} PDFs this month")
req, _ := http.NewRequest("GET", "https://api.pdfapi.dev/v1/usage", nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("PDFAPI_KEY"))
client := &http.Client{}
resp, _ := client.Do(req)
defer resp.Body.Close()
var result map[string]interface{}
json.NewDecoder(resp.Body).Decode(&result)
Response
{
"data": {
"plan": "pro",
"pdfs_generated": 156,
"pdfs_limit": 3000,
"pdfs_remaining": 2844,
"rate_limit": {
"requests_per_minute": 30,
"current_usage": 5
},
"period": {
"start": "2025-01-01T00:00:00Z",
"end": "2025-01-31T23:59:59Z",
"resets_at": "2025-02-01T00:00:00Z"
}
}
}
Response Fields
| Field | Type | Description |
|---|---|---|
plan | string | Your current plan (free, pro, business, enterprise) |
pdfs_generated | number | PDFs generated this billing period |
pdfs_limit | number | Maximum PDFs allowed per period (null for unlimited) |
pdfs_remaining | number | PDFs remaining this period |
rate_limit.requests_per_minute | number | Your per-minute rate limit |
rate_limit.current_usage | number | Requests made in current minute |
period.start | string | Start of current billing period (ISO 8601) |
period.end | string | End of current billing period (ISO 8601) |
period.resets_at | string | When usage counters reset (ISO 8601) |
Usage Monitoring
Check Before Generation
Monitor your usage to avoid hitting limits:
async function checkUsageAndGenerate(markdown) {
// Check current usage
const usageResponse = await fetch('https://api.pdfapi.dev/v1/usage', {
headers: {
'Authorization': `Bearer ${process.env.PDFAPI_KEY}`,
},
});
const { data: usage } = await usageResponse.json();
if (usage.pdfs_remaining <= 0) {
throw new Error('Monthly PDF limit reached');
}
if (usage.rate_limit.current_usage >= usage.rate_limit.requests_per_minute) {
throw new Error('Rate limit reached, please wait');
}
// Proceed with generation
return generatePDF(markdown);
}
Usage Alerts
Set up alerts in your application when approaching limits:
async function checkUsageAlerts() {
const { data: usage } = await fetchUsage();
const usagePercent = (usage.pdfs_generated / usage.pdfs_limit) * 100;
if (usagePercent >= 90) {
console.warn('⚠️ Warning: 90% of monthly PDF quota used');
// Send notification to admin
} else if (usagePercent >= 75) {
console.log('ℹ️ Notice: 75% of monthly PDF quota used');
}
}
Plan Comparison
| Feature | Free | Pro | Business | Enterprise |
|---|---|---|---|---|
| Monthly PDFs | 10 | 3,000 | 15,000 | Unlimited |
| Requests/Min | 3 | 30 | 60 | 120 |
| Concurrent | 1 | 5 | 10 | 25 |
| Premium Themes | ❌ | ✅ | ✅ | ✅ |
| Premium Templates | ❌ | ❌ | ✅ | ✅ |
| Priority Support | ❌ | ❌ | ✅ | ✅ |