curl --request POST \
--url https://avraapi.com/api/v1/utilities/pdf/generate \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-SECRET: <api-key>' \
--data '
{
"html": "<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>",
"response_type": "base64",
"privacy_mode": true
}
'const options = {
method: 'POST',
headers: {
'X-API-KEY': '<api-key>',
'X-API-SECRET': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
html: '<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>',
response_type: 'base64',
privacy_mode: true
})
};
fetch('https://avraapi.com/api/v1/utilities/pdf/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://avraapi.com/api/v1/utilities/pdf/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'html' => '<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>',
'response_type' => 'base64',
'privacy_mode' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>",
"X-API-SECRET: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}Generate a PDF
Render HTML as a binary PDF or a Base64 JSON response through your configured AvraAPI PDF Generator.
curl --request POST \
--url https://avraapi.com/api/v1/utilities/pdf/generate \
--header 'Content-Type: application/json' \
--header 'X-API-KEY: <api-key>' \
--header 'X-API-SECRET: <api-key>' \
--data '
{
"html": "<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>",
"response_type": "base64",
"privacy_mode": true
}
'const options = {
method: 'POST',
headers: {
'X-API-KEY': '<api-key>',
'X-API-SECRET': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
html: '<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>',
response_type: 'base64',
privacy_mode: true
})
};
fetch('https://avraapi.com/api/v1/utilities/pdf/generate', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://avraapi.com/api/v1/utilities/pdf/generate",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'html' => '<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>',
'response_type' => 'base64',
'privacy_mode' => true
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-API-KEY: <api-key>",
"X-API-SECRET: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}application/pdf; use response_type: "base64" only when your application needs the PDF inside a JSON envelope.
The Playground is deliberately limited to response_type: "base64" and returns the JSON envelope only. For a raw application/pdf response, use Postman or your backend integration.
X-Privacy-Mode: 1 when that privacy guarantee is appropriate for the request. Never place Project Client Secrets in frontend code.API endpoint
https://avraapi.com/api/v1/utilities/pdf/generate
Request fields
| Field | Required | Rules |
|---|---|---|
html | Yes | HTML source; 1–524,288 bytes after decoding when is_base64 is true. |
is_base64 | No | Boolean. When true, send Base64-encoded HTML in html; AvraAPI decodes it before validation and rendering. Default false. |
page_size | No | A4 (default), Letter, or Legal. |
orientation | No | portrait (default) or landscape. |
margins.top | No | Top margin in millimetres, from 0 to 100; default 15. |
margins.right | No | Right margin in millimetres, from 0 to 100; default 15. |
margins.bottom | No | Bottom margin in millimetres, from 0 to 100; default 15. |
margins.left | No | Left margin in millimetres, from 0 to 100; default 15. |
response_type | No | binary (default) for application/pdf, or base64 for a JSON response. |
privacy_mode | No | Boolean request-level privacy setting. X-Privacy-Mode: 1 is the shared universal override. |
Request example
This request receives a real PDF stream. The--output option saves that binary response as a file.
curl --request POST "https://avraapi.com/api/v1/utilities/pdf/generate" \
--header "X-API-KEY: YOUR_PROJECT_CLIENT_ID" \
--header "X-API-SECRET: YOUR_PROJECT_CLIENT_SECRET" \
--header "X-ENV: development" \
--header "X-Privacy-Mode: 1" \
--header "Accept: application/pdf" \
--header "Content-Type: application/json" \
--data '{
"html": "<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>",
"page_size": "A4",
"orientation": "portrait",
"margins": {"top": 15, "right": 15, "bottom": 15, "left": 15},
"response_type": "binary"
}' \
--output receipt.pdf
Binary PDF response
response_type: "binary" is the default. A successful request returns the PDF bytes with Content-Type: application/pdf, Content-Length, Cache-Control: no-store, Content-Disposition: inline; filename="apix-document.pdf", and X-APIX-Request-ID headers.
The PDF is the response body, not a JSON object. Use this mode from your backend, Postman, or another HTTP client that can handle binary media.
Base64 JSON response
Setresponse_type to base64 when a JSON response is required. data.data contains Base64 PDF bytes; it is not a temporary download link and AvraAPI does not store an artifact for later retrieval through this API.
curl --request POST "https://avraapi.com/api/v1/utilities/pdf/generate" \
--header "X-API-KEY: YOUR_PROJECT_CLIENT_ID" \
--header "X-API-SECRET: YOUR_PROJECT_CLIENT_SECRET" \
--header "X-ENV: development" \
--header "X-Privacy-Mode: 1" \
--header "Accept: application/json" \
--header "Content-Type: application/json" \
--data '{
"html": "<html><body><h1>Order receipt</h1><p>ORDER-2026-001</p></body></html>",
"response_type": "base64"
}'
{
"success": true,
"request_id": "abd340d9-2491-4403-b076-51f395048c8d",
"data": {
"format": "base64",
"media_type": "application/pdf",
"data": "JVBERi0xLjcKMSAwIG9iago8PCAvVHlwZSAvQ2F0YWxvZw..."
}
}
Error codes
| HTTP | error.code | When it happens | What to do |
|---|---|---|---|
400 | http_error | PDF rendering could not process the supplied HTML or a permitted external image. | Correct the document content and retry with a small controlled example first. |
401 | unauthorized | Credentials are missing, invalid, inactive, or do not match X-ENV. | Check your backend credential configuration. |
402 | insufficient_funds | The selected PDF Generator integration requires credits that are unavailable. | Check the project balance and service configuration. |
422 | validation_failed | html is missing, malformed Base64 was used with is_base64, or a field is outside its documented range or enum. | Correct the request using the field details in the response. |
422 | provider_selection_failed | No active HTML to PDF integration can be selected for the project environment. | Enable or configure the HTML to PDF Converter integration. |
429 | rate_limit_exceeded | The configured request limit was reached. | Respect Retry-After when present. |
500 | internal_error | The renderer could not complete unexpectedly. | Retain the request ID and retry only when your workflow permits it. |
503 | project_paused | The project is paused. | Reactivate the project before retrying. |
Playground resources
The generated reference below lists this endpoint’s API standard details: request fields, authorizations, and response schema. The complete integration guide, request and response examples, and endpoint-specific error handling are above.Authorizations
Your Development project's Client ID. Enter your own value in the Documentation Playground.
Your Development project's Client Secret. Mintlify does not proxy these requests; the browser sends them directly to AvraAPI. Never enter a Production secret in the Documentation Playground.
Headers
Selects the Development credential environment. The Documentation Playground exposes Development values only; normal backend integrations may use their documented Production credentials outside this tool.
dev, development Requests a JSON response where the selected operation supports JSON.
"application/json"
Optional privacy override. Turn this on to request that AvraAPI suppress request-payload storage in observability logs for this request.
true
Body
Documentation Playground request projection. The released API also supports a binary PDF response for backend and Postman integrations.
HTML source, limited to 512 KB after Base64 decoding when is_base64 is true.
1 - 524288Fixed to Base64 JSON for the Documentation Playground.
base64 Fixed on for the Documentation Playground request body.
true When true, html is Base64-encoded HTML and is decoded before validation and rendering.
A4, Letter, Legal portrait, landscape Page margins in millimetres.
Show child attributes
Show child attributes
Was this page helpful?
