Quickstart
Make your first request to the Documents API.
1. Get access
Subscribe to the listing for your endpoint. Your marketplace provides credentials and billing.
2. Set your credentials
Set RAPIDAPI_KEY or APY_TOKEN on your server. Python examples require httpx; Node.js examples use built-in fetch.
python -m pip install httpx
export RAPIDAPI_KEY="YOUR_RAPIDAPI_KEY"
# or
export APY_TOKEN="YOUR_APYHUB_TOKEN"3. Send a request
Start with the sample values, then change the input.
import os
import httpx
base_url = "https://document-generation-api-docx-html-pdf.p.rapidapi.com"
headers = {
"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"],
"X-RapidAPI-Host": "document-generation-api-docx-html-pdf.p.rapidapi.com",
}
payload = {
"data": {
"number": "INV-2026-0042",
"date": "2026-10-16",
"currency": "$",
"seller": {
"name": "Studio North",
"address": ["1 Example Street"],
},
"buyer": {
"name": "Acme Design",
},
"items": [{
"description": "Design consultation",
"quantity": 3,
"unit_price": 85,
"tax_rate": 0,
}],
"notes": "Sample invoice. Payment within 30 days.",
},
"format": "pdf",
}
response = httpx.post(
base_url + "/v1/documents/preset/invoice",
headers=headers, json=payload, timeout=120
)
response.raise_for_status()
with open("result.pdf", "wb") as output:
output.write(response.content)4. Check the result
Check the status and Content-Type before saving the returned file.
Live demos support document presets, templates and e-invoices with up to 10 line items and bounded outputs. General invoice PDFs are not structured e-invoices; use the dedicated e-invoice endpoints for supported standards. No Peppol delivery service.
Task tutorialErrors and retries
- 401 / 403: check your credentials, subscription and feature access.
- 422: correct the input before retrying. Application errors include a
detailobject with a code and message. - 429: check your rate limit or plan allowance.
- 502 / 503 / 504: use bounded retries with backoff and honor
Retry-After. Retries may consume allowance.
Marketplace errors may use a different format. Keep the status and request identifier for diagnostics; avoid logging API keys or customer files.