PDF API Security: API Keys, IP Whitelisting & SSRF Guide
PDF generation APIs handle sensitive business documents — invoices, contracts, reports, and certificates. When you send confidential data to an external API, security must be a top priority in your evaluation.
This guide covers the essential security practices for safely integrating a PDF generation API into your production systems, with implementation examples. Where it describes how FUNBREW PDF behaves, it only states what can be confirmed in the implementation.
Who This Guide Is For
- Developers and architects adding a PDF generation API to company systems
- Backend engineers on SaaS products with security requirements
- IT and security teams reviewing a PDF API for procurement or security assessment
Implementing everything at once is rarely realistic, so prioritize and harden step by step. This guide marks items as "Required" or "Recommended".
Why PDF API Security Matters
Data sent to PDF generation APIs often includes:
- Invoices: Customer names, addresses, transaction amounts, bank details
- Contracts: Terms, signatures, personally identifiable information
- Reports: Revenue data, KPIs, internal metrics
- Certificates: Full names, credentials, ID numbers
A breach of this data can result in legal liability and loss of customer trust. When choosing a PDF API, evaluate security alongside features and pricing.
Simple mistakes — committing an API key to GitHub, sharing one key between development and production — happen far more often than sophisticated attacks. Get the basic operating rules right first.
1. Secure API Key Management
Your API key is the access credential to the PDF generation service. If it leaks, anyone can generate PDFs on your behalf and use up your monthly generation quota.
FUNBREW PDF API keys start with sk- and are issued on the "API Keys" page of the dashboard (only users with the owner role can issue or delete keys). The full key is shown only once, right after it is issued; the server stores only its SHA-256 hash. If you lose a key it cannot be shown again — issue a new one.
Do This
# Store in environment variables (recommended)
export FUNBREW_PDF_API_KEY="sk-your-api-key"
// Read from environment at runtime (run this on the server side)
const apiKey = process.env.FUNBREW_PDF_API_KEY;
const response = await fetch('https://pdf.funbrew.cloud/api/pdf/generate-from-html', {
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
'Accept': 'application/json',
},
body: JSON.stringify({ html: '<h1>Invoice</h1>' }),
});
const { data } = await response.json();
console.log(data.download_url);
Besides Authorization: Bearer <API key>, you can also send the key in an X-API-Key: <API key> header.
Never Do This
// BAD: Hardcoded in source code
const apiKey = "sk-abc123def456"; // Never do this
// BAD: Embedded in frontend JavaScript
// Anyone can see it in browser DevTools
API Key Best Practices
| Practice | Description |
|---|---|
| Environment variables | Store keys in .env files or environment variables, never in code |
.gitignore |
Never commit .env files to your repository |
| Key rotation | Replace keys at the interval your internal policy sets (FUNBREW PDF keys do not expire, so rotation is up to you) |
| Separate by environment | Use different keys for development, staging, and production |
| Secret managers | Use AWS Secrets Manager, HashiCorp Vault, or similar tools |
2. Transport Encryption (TLS)
All communication with the PDF generation API must be encrypted via TLS (HTTPS).
import os
import requests
api_key = os.environ["FUNBREW_PDF_API_KEY"]
# Always use HTTPS (TLS encryption)
response = requests.post(
"https://pdf.funbrew.cloud/api/pdf/generate-from-html", # HTTPS required
headers={"Authorization": f"Bearer {api_key}"},
json={"html": "<h1>Confidential Document</h1>"},
timeout=30, # Always set a timeout
)
response.raise_for_status()
download_url = response.json()["data"]["download_url"]
What to Verify
- Protocol versions: Older protocols (SSL 3.0, TLS 1.0/1.1) are disabled
- Certificate validation: Never disable SSL verification (
verify=Falseis prohibited) - HSTS: The Strict-Transport-Security header is set (it tells browsers to use only HTTPS for the host from then on)
3. Generated File Data Protection
How generated PDFs are stored and delivered requires careful consideration.
Retention and Deletion
PDFs stored indefinitely increase your attack surface. In FUNBREW PDF you can control this as follows.
| Item | Behavior |
|---|---|
expiration_hours |
How long the file can be downloaded. 0–168 (7 days); if omitted, the dashboard default (24 hours if unset). 0 means no expiration |
max_downloads |
How many times the file can be downloaded. 0–100; 0 means unlimited |
| After expiration | Downloads stop working. File bodies are deleted by a daily job once they pass a grace period (7 days by default) |
| Immediate deletion | DELETE /api/pdf/delete/{filename} deletes the file body |
# Generate with a 1-hour expiration and a single download
curl -X POST https://pdf.funbrew.cloud/api/pdf/generate-from-html \
-H "Authorization: Bearer $FUNBREW_PDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{"html": "<h1>Confidential Document</h1>", "expiration_hours": 1, "max_downloads": 1}'
# Delete right after you have retrieved it (filename is data.filename in the response)
curl -X DELETE https://pdf.funbrew.cloud/api/pdf/delete/<filename> \
-H "Authorization: Bearer $FUNBREW_PDF_API_KEY"
For highly sensitive documents, keep expiration_hours short and delete the file as soon as you have it. Files with expiration_hours: 0 (no expiration) remain until you delete them explicitly.
Secure Download URLs
The generation response contains two kinds of URLs.
const { data } = await response.json();
// download_url: https://pdf.funbrew.cloud/api/pdf/download/<uuid>.pdf
// Requires an API key; keys from another company get 403
// public_url: https://pdf.funbrew.cloud/dl/<32-character random token>
// No API key needed; anyone who knows the URL can fetch the file
console.log(data.download_url, data.public_url, data.expires_at);
Both URLs are subject to the expiration and download-count limits. The public_url token is hard to guess, but the URL itself is the credential, so be careful how widely you share it by email or chat. If the file never leaves your organization, it is safer to fetch download_url on the server side and serve the file behind your own access control.
4. Access Control and IP Restrictions
Limit API access to only what's necessary to reduce the risk of misuse. For network-level access controls in containerized environments, see the Docker/Kubernetes PDF API guide.
IP Allowlisting
In FUNBREW PDF you can register the source IPs allowed to call the API on the "IP Restrictions" page of the dashboard (Business plan, owner role).
# Register allowed IP addresses in the dashboard (example)
# 203.0.113.10 Production web server
# 203.0.113.0/28 Production batch servers (IPv4 CIDR notation also works)
Once at least one entry is registered, API calls from any other source get 403 (IP address is not allowed). With no entries, no restriction applies.
Rate Limiting
FUNBREW PDF has its own per-minute limit per plan (counted per company and shared across keys), but you should also limit requests per user in your application.
// Laravel: Rate limiting example (define in AppServiceProvider::boot or similar)
// 10 requests per minute per user
RateLimiter::for('pdf-generation', function (Request $request) {
return Limit::perMinute(10)->by($request->user()->id);
});
This minimizes damage in case of account compromise. For plan limits and how to handle 429s, see the rate limiting guide.
5. Input Validation
Always validate data on the server side before sending it to the PDF generation API.
XSS and Injection Prevention
// Escape user input before embedding in HTML
function escapeHtml(value) {
return String(value)
.replace(/&/g, '&')
.replace(/</g, '<')
.replace(/>/g, '>')
.replace(/"/g, '"')
.replace(/'/g, ''');
}
const html = `
<h1>Invoice</h1>
<p>Bill to: ${escapeHtml(customerName)}</p>
<p>Amount: ${escapeHtml(amount)}</p>
`;
Use Templates Instead
With a template engine, the HTML structure is fixed and only data variables are injected. This is safer than accepting arbitrary HTML input.
curl -X POST https://pdf.funbrew.cloud/api/pdf/generate-from-template \
-H "Authorization: Bearer $FUNBREW_PDF_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"template": "invoice",
"variables": {
"customer_name": "Acme Corp",
"total": "1,650.00"
}
}'
FUNBREW PDF templates are registered beforehand in the dashboard (or via the template API), and template takes the template's slug. Values passed into variables such as {{customer_name}} are HTML-escaped before they are inserted, so tags or scripts cannot be injected through variables.
6. SSRF (Server-Side Request Forgery) Prevention
HTML sent to a PDF generation API can contain arbitrary URLs. The rendering engine fetches those URLs, so attackers can abuse this to make it reach internal network resources. This is known as SSRF.
SSRF Attack Examples
<!-- Attacker-submitted HTML -->
<img src="http://169.254.169.254/latest/meta-data/iam/security-credentials/">
<!-- Attempts to read temporary credentials from the AWS instance metadata -->
<iframe src="http://192.168.1.1/admin"></iframe>
<!-- Attempts to access an internal admin panel -->
Mitigation
Blocking a list of internal addresses (a denylist) is easy to bypass — a hostname can resolve to an internal IP, or the address can be written in decimal or IPv6 — so allow only the hosts that may be fetched (an allowlist).
// Check URLs in the HTML on the server side before sending it to the API
const ALLOWED_HOSTS = [
'fonts.googleapis.com',
'fonts.gstatic.com',
'cdn.example.com',
];
function assertSafeResourceUrls(html) {
// Extract URLs from src / href attributes (CSS url() and @import need the same check)
const attrPattern = /\b(?:src|href)\s*=\s*["']?([^"'\s>]+)/gi;
for (const [, raw] of html.matchAll(attrPattern)) {
if (raw.startsWith('data:') || raw.startsWith('#')) {
continue;
}
let url;
try {
url = new URL(raw);
} catch {
throw new Error(`Relative or invalid URL is not allowed: ${raw}`);
}
if (url.protocol !== 'https:' || !ALLOWED_HOSTS.includes(url.hostname)) {
throw new Error(`URL is not allowed: ${raw}`);
}
}
return html;
}
Even with a managed API, check how the provider handles access to internal addresses during rendering, and run a check like the one above on the HTML you send.
7. Web Application Firewall (WAF) Integration
Putting the endpoints of your own application that trigger PDF generation behind a WAF blocks some common web attacks (SQL injection, XSS, DDoS, and so on) before they reach your app. CloudFront + AWS WAF and Cloudflare WAF are common setups.
User request → WAF → App server → FUNBREW PDF API
↓
Block malicious traffic
A WAF does not stop every attack, though, so combine it with input validation in your application.
8. Compliance and Data Residency
Sending business data to an external API triggers regulatory requirements depending on your jurisdiction.
GDPR (EU General Data Protection Regulation)
If you process EU personal data, verify:
- Data Processing Agreement (DPA): The GDPR requires processing by a processor (the API provider) to be governed by a contract or similar. Check whether you can sign one with the provider
- Data residency: Where personal data is processed and stored
- Data minimization: Only send the minimum data needed for PDF generation
- Deletion: Whether you can delete generated data (in FUNBREW PDF, via the deletion API and expiration described above)
Japan's Act on the Protection of Personal Information (APPI)
Sending personal data to an external API to generate PDFs is generally treated as "entrustment" of its handling, so consent for third-party provision is not required (Article 27(5)(i)). Still, check:
- Necessary and appropriate supervision of the entrusted party (Article 25)
- If the entrusted party is in a foreign country, the rules on provision to a third party in a foreign country (Article 28; consent or information to the individual may be required)
- Your own security control measures (Article 23)
Implementation: Sensitive Data Masking
import re
def mask_sensitive_data(html: str) -> str:
"""Mask sensitive data that does not need to appear in the PDF"""
# Credit card numbers (show last 4 digits only) — process these first
html = re.sub(
r"\b\d{4}[\s-]?\d{4}[\s-]?\d{4}[\s-]?(\d{4})\b",
r"****-****-****-\1",
html,
)
# Japan's My Number (12 digits, hyphenated 4-4-4)
html = re.sub(r"\b\d{4}-\d{4}-\d{4}\b", "****-****-****", html)
# US Social Security Number (SSN)
html = re.sub(r"\b\d{3}-\d{2}-\d{4}\b", "***-**-****", html)
return html
If you don't process card numbers first, the first 12 digits of a 16-digit card number match the My Number pattern and get mangled.
9. OWASP Top 10 Relevance
The items that matter most for PDF generation API usage, organized by the OWASP Top 10 (2021 edition). The 2025 edition changes the categories and numbering (for example, Security Misconfiguration is A02 and Software Supply Chain Failures is A03), so check which edition your internal standard uses.
| OWASP item (2021) | PDF API Risk | Mitigation |
|---|---|---|
| A01: Broken Access Control | Unauthorized access to other users' PDFs | URLs that check the key and owner + expiration and download limits |
| A02: Cryptographic Failures | Data interception in transit | TLS required; never disable certificate validation |
| A03: Injection | HTML/CSS injection | Input escaping + templates |
| A05: Security Misconfiguration | API key exposure | Environment variables + secret managers |
| A06: Vulnerable and Outdated Components | Vulnerabilities in old PDF libraries | Regular updates + managed API |
| A07: Identification and Authentication Failures | API key reuse across environments | Environment separation + rotation |
| A08: Software and Data Integrity Failures | Using a tampered SDK | Install only from official sources; pin with lock files |
| A09: Security Logging and Monitoring Failures | Delayed incident detection | Audit logs + alerts |
| A10: SSRF | Accessing internal network resources | URL allowlist + confirm the provider's protections |
Also check against the API-specific OWASP API Security Top 10 (2023 edition). Like any web API, the main weaknesses of a PDF API are flaws in authentication, authorization, and input validation.
PDF-Specific Security Risks
PDF generation introduces attack vectors of its own.
// JavaScript in the HTML may run during rendering
// → Use templates so user input is never interpreted as script
// Malicious font files loaded via @font-face
// → Restrict allowed font sources (the allowlist in section 6)
// Oversized HTML payloads for DoS
// → Set a request size limit on your side too
// (FUNBREW PDF accepts up to 5,000,000 characters of html by default; beyond that it returns 422)
const MAX_HTML_SIZE = 5 * 1024 * 1024; // 5MB
function validatePdfRequest(html) {
if (Buffer.byteLength(html, 'utf-8') > MAX_HTML_SIZE) {
throw new Error('HTML size exceeds the maximum allowed size');
}
// Strip script tags (a stopgap; prefer escaping and templates)
const sanitized = html.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, '');
return sanitized;
}
Removing tags with regular expressions is easy to bypass, so make escaping user input before embedding it your baseline.
10. Supply Chain Risk Management
Update PDF generation libraries and SDKs regularly and track versions that fix known vulnerabilities (CVEs).
# Check Node.js dependencies with npm audit
npm audit
# Check Python dependencies with pip-audit
pip install pip-audit
pip-audit
# Check PHP dependencies with Composer
composer audit
With a managed API, updating the rendering engine is the provider's job, which saves your team effort. See the "Self-hosted vs cloud API" section of the HTML to PDF complete guide for details.
11. Audit Logging and Monitoring
Logging is essential for early detection of security incidents and post-incident investigation. For serverless environments such as AWS Lambda, see the serverless PDF API guide.
What to Log
- API call timestamps, IP addresses, user IDs
- Generated PDF filenames and sizes
- Errors and anomalous request patterns
- API key usage statistics
The "API request history" page of the FUNBREW PDF dashboard records, for each successfully authenticated API call, the time, method, endpoint, status, response time, source IP, and the key used, and you can filter by key. It can also be downloaded as CSV (up to the latest 10,000 rows). Requests that fail authentication (401) are not recorded there, so detect repeated authentication errors in your own logs.
Alert Configuration
- High request volume in a short period (possible abuse)
- Access from unknown IP addresses
- Consecutive authentication failures
Monitoring with Prometheus / Grafana
This example assumes your application exports the number of PDF API calls and errors as metrics (the metric names are ones you define).
# pdf_api_rules.yml (a rule file loaded via rule_files in prometheus.yml)
groups:
- name: pdf_api_security
rules:
- alert: PdfApiHighErrorRate
expr: rate(pdf_api_errors_total[5m]) > 0.1
for: 2m
labels:
severity: warning
annotations:
summary: "PDF API error rate is high"
- alert: PdfApiSuspiciousVolume
expr: rate(pdf_api_requests_total[1m]) > 100
for: 1m
labels:
severity: critical
annotations:
summary: "Unusually high PDF generation volume detected"
For the full picture of monitoring and production operations, see the PDF API production checklist.
12. Incident Response
What to do when an API key leaks or you suspect misuse.
Step 1: Immediate Response
- Delete the API key: Delete it on the "API Keys" page of the dashboard (owner role). Keys are checked on every request, so calls with that key return 401 from the moment it is deleted
- Issue a new key: Issue a new API key and update your environment variables and secret manager
- Scope the impact: Check calls for that key and period in the "API request history"
Step 2: Investigation
# Count requests by source IP in the CSV downloaded from "API request history"
# Columns: timestamp,method,endpoint,status_code,response_time_ms,ip_address,api_key,client_label
tail -n +2 api-logs-2026-11-14.csv | \
awk -F, '{print $6}' | \
sort | uniq -c | sort -rn | head -20
- Requests from suspicious IP addresses
- Unusually high PDF generation volume
- Access outside business hours
Step 3: Prevent Recurrence
- Turn regular API key rotation into a written procedure
- Add secret scanning for Git repositories to CI
- Send anomaly alerts to Slack/PagerDuty
FUNBREW PDF has no API for issuing or deleting API keys, so rotation is done in the dashboard. To rotate without downtime:
- Issue a new key and update the value in your secret manager
- Redeploy (or reload) the app so it switches to the new key
- On the "API Keys" page, confirm the old key's last-used time has stopped updating
- Delete the old key
Security Checklist
A summary of what to verify when adopting a PDF generation API in an enterprise setting.
| Category | Check Item | Priority |
|---|---|---|
| Auth | API keys stored in environment variables | Required |
| Auth | Separate keys for production and development | Required |
| Auth | API keys rotated regularly | Recommended |
| Transport | HTTPS for all communication | Required |
| Transport | SSL certificate validation not disabled | Required |
| Data | Expiration and deletion policy for generated files | Required |
| Data | Decided how widely download URLs may be shared | Recommended |
| Access | IP allowlisting configured | Recommended |
| Access | Rate limiting implemented | Recommended |
| Input | User input is escaped | Required |
| Input | Templates used to fix HTML structure | Recommended |
| Input | SSRF protection (URL allowlist) in place | Required |
| Audit | API calls are logged | Recommended |
| Audit | Anomaly detection alerts configured | Recommended |
| Dependencies | Library vulnerabilities checked regularly | Recommended |
| Incident | Response procedure for leaked API keys documented | Recommended |
13. Considerations for Finance, Healthcare, and Government
The standards and guidelines to consult differ by industry.
Financial Institutions (FISC Security Guidelines and Similar)
Financial institutions may be asked to record generation operations and check permissions, with reference to standards such as FISC's "金融機関等コンピュータシステムの安全対策基準・解説書" (Japan's security standards for financial institutions' computer systems).
import os
from datetime import datetime, timezone
import requests
API_KEY = os.environ["FUNBREW_PDF_API_KEY"]
BASE_URL = "https://pdf.funbrew.cloud"
def generate_financial_pdf(data, audit_context):
"""Generate a financial PDF with audit logging.
validate_financial_data and AuditLog are assumed to be your own code."""
# 1. Validate input data
validate_financial_data(data)
# 2. Check permissions before generating
if not audit_context.user.has_permission("generate_financial_pdf"):
raise PermissionError("Permission denied")
# 3. Audit log (start)
log_entry = AuditLog.create(
action="pdf_generate_start",
user_id=audit_context.user.id,
document_type="financial_report",
timestamp=datetime.now(timezone.utc),
ip_address=audit_context.ip,
)
headers = {"Authorization": f"Bearer {API_KEY}"}
try:
# 4. Generate the PDF (short expiration, single download)
response = requests.post(
f"{BASE_URL}/api/pdf/generate-from-html",
headers=headers,
json={
"html": data["html"],
"options": {"page-size": "A4"},
"expiration_hours": 1,
"max_downloads": 1,
},
timeout=60,
)
response.raise_for_status()
download_url = response.json()["data"]["download_url"]
# 5. Fetch the PDF itself
pdf = requests.get(download_url, headers=headers, timeout=60)
pdf.raise_for_status()
# 6. Audit log (complete)
log_entry.update(action="pdf_generate_complete", file_size=len(pdf.content))
return pdf.content
except Exception as e:
log_entry.update(action="pdf_generate_failed", error=str(e))
raise
Healthcare (MHLW Medical Information System Security Guidelines)
When generating PDFs that contain medical information, also consult guidelines such as the Japanese Ministry of Health, Labour and Welfare's "医療情報システムの安全管理に関するガイドライン" (guidelines on the security management of medical information systems), and design for points like these:
- Inject patient IDs and clinical information just before generation, and keep them out of logs
- Keep
expiration_hoursshort to match your retention policy, and delete files with the deletion API once retrieved - Record who generated and viewed what (who generated which patient's PDF, and when)
// Medical document example (buildTemplate and MedicalAuditLog are assumed to be your own code)
use Illuminate\Support\Facades\Http;
class MedicalPdfGenerator
{
public function generate(Patient $patient, User $doctor): string
{
// Keep personal data in function scope only
$html = $this->buildTemplate([
'patient_name' => $patient->name,
'birth_date' => $patient->birth_date->format('Y-m-d'),
'diagnosis' => $patient->current_diagnosis,
]);
$client = Http::withToken(config('services.funbrew.api_key'))->acceptJson();
$result = $client->post('https://pdf.funbrew.cloud/api/pdf/generate-from-html', [
'html' => $html,
'options' => ['page-size' => 'A4'],
'expiration_hours' => 1,
'max_downloads' => 1,
])->throw()->json('data');
$pdf = $client->get($result['download_url'])->throw()->body();
// Delete the file on the server once retrieved
$client->delete('https://pdf.funbrew.cloud/api/pdf/delete/'.$result['filename'])->throw();
// Medical record audit log
MedicalAuditLog::create([
'doctor_id' => $doctor->id,
'patient_id' => $patient->id,
'action' => 'pdf_generated',
'document_type' => 'diagnosis_report',
]);
return $pdf;
}
}
Government and Municipalities
Government and municipal projects may require, as a procurement condition, compliance with the CRYPTREC Ciphers List (the e-Government Recommended Ciphers List) or specific TLS configuration standards. Confirm the requirements for each project.
14. Applying Zero Trust Principles
You can apply zero trust to PDF API usage too: verify each connection instead of trusting anything just because it is inside your network.
Micro-segmentation
Place the servers that call PDF generation in a dedicated network segment and block all unnecessary inbound traffic. Restrict outbound traffic as well, with a proxy or egress firewall, to only the destinations you need such as pdf.funbrew.cloud.
Principle of Least Privilege
Separate keys by purpose so that a leak affects only one system and only that key needs to be deleted and replaced.
// Separate keys by purpose and manage them as environment variables
const WEB_KEY = process.env.FUNBREW_WEB_KEY; // Generation from the web app
const BATCH_KEY = process.env.FUNBREW_BATCH_KEY; // Nightly batch
Note that keys issued from the dashboard currently have permission for every operation (generating, downloading, deleting PDFs, configuring webhooks and external storage, and so on). Keys restricted to specific operations cannot be issued, so separate by key.
15. Security FAQ
Q: Do generated PDFs remain on FUNBREW PDF's servers?
After the time set by expiration_hours (if omitted, the dashboard default, or 24 hours if unset), the file can no longer be downloaded, and files past the grace period (7 days by default) are deleted by a daily job. Files created with expiration_hours: 0 (no expiration) remain until you delete them. To remove a file right away, call DELETE /api/pdf/delete/{filename}.
Q: If an API key leaks, how far can a third party abuse it?
Keys issued from the dashboard have full permissions, so with that key someone can generate PDFs (consuming your monthly quota), download and delete your company's PDFs, and change webhook or S3 integration settings. They cannot log in to the dashboard (or change account settings). Delete the key as soon as you notice.
Q: Do you offer a GDPR Data Processing Agreement (DPA)?
Please contact support about the availability of contract documents.
Q: Do you have SOC 2 or ISO 27001 certification?
Please contact support about certification status.
Q: Can we run a penetration test?
Please consult support in advance. Note that heavy request volumes return 429 once they hit your plan's per-minute or monthly limit.
Conclusion
PDF API security requires both technical controls and operational processes.
- API key management: Environment variables with regular rotation
- Transport encryption: HTTPS required; never disable certificate validation
- Data protection: Short expirations, download limits, and deletion after retrieval
- Access control: IP restrictions and rate limiting
- Input validation: Templates and HTML escaping
- Audit logging: Log API calls and detect anomalies
- Incident response: Prepare immediate key deletion and investigation steps in advance
- Compliance: Check industry standards and guidelines (finance, healthcare, government)
- Supply chain: Regular vulnerability checks and updates for your libraries
- Zero trust: Segment separation and per-purpose keys
As a first step, move your API keys into environment variables today and scan your Git repositories for keys. git log --all -p | grep "sk-" also checks past commit history. Security is not a one-time task; review this guide's checklist regularly. For handling errors properly, see the PDF API error handling guide; for designing bulk generation, see the batch processing guide.
FUNBREW PDF provides hashed API key storage, IP restrictions, expiration and download-count limits, a deletion API, and API request history. Start with the free plan, review the API documentation for details, and test safely in the Playground.
Implementation Priorities
For a new integration, we recommend implementing in this order.
| Priority | Item |
|---|---|
| 1 (Required) | API keys in environment variables |
| 2 (Required) | HTTPS only |
| 3 (Required) | Escaping user input |
| 4 (Recommended) | IP restrictions |
| 5 (Recommended) | Rate limiting |
| 6 (Recommended) | Audit logging |
| 7 (Industry-specific) | Compliance work |
Start with priorities 1–3 and add 4 onward once you are in production. Hardening step by step is more practical than delaying adoption in pursuit of perfection.
Related
- PDF API Production Checklist — API key management, monitoring, and scaling overview
- PDF API Error Handling Guide — Best practices for error handling including security errors
- PDF API Batch Processing Guide — Security considerations for bulk generation
- HTML to PDF API Comparison 2026 — Compare services including security posture
- Automate Invoice PDF Generation — Secure invoice automation implementation
- PDF Template Engine Guide — Safer PDF generation with templates
- Docker/Kubernetes PDF API Guide — Secure container deployments
- Serverless PDF API Guide — Security in Lambda and Cloudflare Workers
- PDF API Quickstart — Basic implementation across languages
- Puppeteer to PDF API Migration — Moving to a managed API
- API Documentation — Authentication and endpoint details