curl --request POST \
--url https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"landscape": "portrait",
"format": "A4",
"emulatedMediaType": "print",
"margin": {
"top": "20mm",
"right": "15mm",
"bottom": "20mm",
"left": "15mm"
},
"scale": 1,
"preferCssPageSize": false,
"headerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
"footerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>",
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
'import requests
url = "https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf"
payload = {
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"landscape": "portrait",
"format": "A4",
"emulatedMediaType": "print",
"margin": {
"top": "20mm",
"right": "15mm",
"bottom": "20mm",
"left": "15mm"
},
"scale": 1,
"preferCssPageSize": False,
"headerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
"footerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>",
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileId: '550e8400-e29b-41d4-a716-446655440000',
landscape: 'portrait',
format: 'A4',
emulatedMediaType: 'print',
margin: {top: '20mm', right: '15mm', bottom: '20mm', left: '15mm'},
scale: 1,
preferCssPageSize: false,
headerTemplate: '<div style="font-size:10px;text-align:center;width:100%;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>',
footerTemplate: '<div style="font-size:10px;text-align:center;width:100%;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>',
webhook: {
webhookUrl: 'https://example.com/webhook',
webhookAuth: {
headerName: 'X-API-Key',
headerValue: 'my-secret-key',
basicAuthUsername: 'user',
basicAuthPassword: 'pass'
}
}
})
};
fetch('https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf', 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://api.autype.com/api/v1/dev/tools/convert/html-to-pdf",
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([
'fileId' => '550e8400-e29b-41d4-a716-446655440000',
'landscape' => 'portrait',
'format' => 'A4',
'emulatedMediaType' => 'print',
'margin' => [
'top' => '20mm',
'right' => '15mm',
'bottom' => '20mm',
'left' => '15mm'
],
'scale' => 1,
'preferCssPageSize' => false,
'headerTemplate' => '<div style="font-size:10px;text-align:center;width:100%;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>',
'footerTemplate' => '<div style="font-size:10px;text-align:center;width:100%;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>',
'webhook' => [
'webhookUrl' => 'https://example.com/webhook',
'webhookAuth' => [
'headerName' => 'X-API-Key',
'headerValue' => 'my-secret-key',
'basicAuthUsername' => 'user',
'basicAuthPassword' => 'pass'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf"
payload := strings.NewReader("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"landscape\": \"portrait\",\n \"format\": \"A4\",\n \"emulatedMediaType\": \"print\",\n \"margin\": {\n \"top\": \"20mm\",\n \"right\": \"15mm\",\n \"bottom\": \"20mm\",\n \"left\": \"15mm\"\n },\n \"scale\": 1,\n \"preferCssPageSize\": false,\n \"headerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\"><span class=\\\"pageNumber\\\"></span> / <span class=\\\"totalPages\\\"></span></div>\",\n \"footerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\">Page <span class=\\\"pageNumber\\\"></span> of <span class=\\\"totalPages\\\"></span></div>\",\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"landscape\": \"portrait\",\n \"format\": \"A4\",\n \"emulatedMediaType\": \"print\",\n \"margin\": {\n \"top\": \"20mm\",\n \"right\": \"15mm\",\n \"bottom\": \"20mm\",\n \"left\": \"15mm\"\n },\n \"scale\": 1,\n \"preferCssPageSize\": false,\n \"headerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\"><span class=\\\"pageNumber\\\"></span> / <span class=\\\"totalPages\\\"></span></div>\",\n \"footerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\">Page <span class=\\\"pageNumber\\\"></span> of <span class=\\\"totalPages\\\"></span></div>\",\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"landscape\": \"portrait\",\n \"format\": \"A4\",\n \"emulatedMediaType\": \"print\",\n \"margin\": {\n \"top\": \"20mm\",\n \"right\": \"15mm\",\n \"bottom\": \"20mm\",\n \"left\": \"15mm\"\n },\n \"scale\": 1,\n \"preferCssPageSize\": false,\n \"headerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\"><span class=\\\"pageNumber\\\"></span> / <span class=\\\"totalPages\\\"></span></div>\",\n \"footerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\">Page <span class=\\\"pageNumber\\\"></span> of <span class=\\\"totalPages\\\"></span></div>\",\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"action": "pdf.merge",
"status": "PENDING",
"inputFileIds": [
"file-id-1"
],
"outputFileId": null,
"error": null,
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": {},
"completedAt": {},
"result": {},
"metadata": {}
}Convert HTML to PDF
Convert an HTML file to a high-quality PDF. Supports custom page settings, margins, headers, footers with page numbers, and CSS media emulation for framework compatibility.
curl --request POST \
--url https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"landscape": "portrait",
"format": "A4",
"emulatedMediaType": "print",
"margin": {
"top": "20mm",
"right": "15mm",
"bottom": "20mm",
"left": "15mm"
},
"scale": 1,
"preferCssPageSize": false,
"headerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
"footerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>",
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
'import requests
url = "https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf"
payload = {
"fileId": "550e8400-e29b-41d4-a716-446655440000",
"landscape": "portrait",
"format": "A4",
"emulatedMediaType": "print",
"margin": {
"top": "20mm",
"right": "15mm",
"bottom": "20mm",
"left": "15mm"
},
"scale": 1,
"preferCssPageSize": False,
"headerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>",
"footerTemplate": "<div style=\"font-size:10px;text-align:center;width:100%;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>",
"webhook": {
"webhookUrl": "https://example.com/webhook",
"webhookAuth": {
"headerName": "X-API-Key",
"headerValue": "my-secret-key",
"basicAuthUsername": "user",
"basicAuthPassword": "pass"
}
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
fileId: '550e8400-e29b-41d4-a716-446655440000',
landscape: 'portrait',
format: 'A4',
emulatedMediaType: 'print',
margin: {top: '20mm', right: '15mm', bottom: '20mm', left: '15mm'},
scale: 1,
preferCssPageSize: false,
headerTemplate: '<div style="font-size:10px;text-align:center;width:100%;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>',
footerTemplate: '<div style="font-size:10px;text-align:center;width:100%;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>',
webhook: {
webhookUrl: 'https://example.com/webhook',
webhookAuth: {
headerName: 'X-API-Key',
headerValue: 'my-secret-key',
basicAuthUsername: 'user',
basicAuthPassword: 'pass'
}
}
})
};
fetch('https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf', 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://api.autype.com/api/v1/dev/tools/convert/html-to-pdf",
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([
'fileId' => '550e8400-e29b-41d4-a716-446655440000',
'landscape' => 'portrait',
'format' => 'A4',
'emulatedMediaType' => 'print',
'margin' => [
'top' => '20mm',
'right' => '15mm',
'bottom' => '20mm',
'left' => '15mm'
],
'scale' => 1,
'preferCssPageSize' => false,
'headerTemplate' => '<div style="font-size:10px;text-align:center;width:100%;"><span class="pageNumber"></span> / <span class="totalPages"></span></div>',
'footerTemplate' => '<div style="font-size:10px;text-align:center;width:100%;">Page <span class="pageNumber"></span> of <span class="totalPages"></span></div>',
'webhook' => [
'webhookUrl' => 'https://example.com/webhook',
'webhookAuth' => [
'headerName' => 'X-API-Key',
'headerValue' => 'my-secret-key',
'basicAuthUsername' => 'user',
'basicAuthPassword' => 'pass'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf"
payload := strings.NewReader("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"landscape\": \"portrait\",\n \"format\": \"A4\",\n \"emulatedMediaType\": \"print\",\n \"margin\": {\n \"top\": \"20mm\",\n \"right\": \"15mm\",\n \"bottom\": \"20mm\",\n \"left\": \"15mm\"\n },\n \"scale\": 1,\n \"preferCssPageSize\": false,\n \"headerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\"><span class=\\\"pageNumber\\\"></span> / <span class=\\\"totalPages\\\"></span></div>\",\n \"footerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\">Page <span class=\\\"pageNumber\\\"></span> of <span class=\\\"totalPages\\\"></span></div>\",\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"landscape\": \"portrait\",\n \"format\": \"A4\",\n \"emulatedMediaType\": \"print\",\n \"margin\": {\n \"top\": \"20mm\",\n \"right\": \"15mm\",\n \"bottom\": \"20mm\",\n \"left\": \"15mm\"\n },\n \"scale\": 1,\n \"preferCssPageSize\": false,\n \"headerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\"><span class=\\\"pageNumber\\\"></span> / <span class=\\\"totalPages\\\"></span></div>\",\n \"footerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\">Page <span class=\\\"pageNumber\\\"></span> of <span class=\\\"totalPages\\\"></span></div>\",\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.autype.com/api/v1/dev/tools/convert/html-to-pdf")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"fileId\": \"550e8400-e29b-41d4-a716-446655440000\",\n \"landscape\": \"portrait\",\n \"format\": \"A4\",\n \"emulatedMediaType\": \"print\",\n \"margin\": {\n \"top\": \"20mm\",\n \"right\": \"15mm\",\n \"bottom\": \"20mm\",\n \"left\": \"15mm\"\n },\n \"scale\": 1,\n \"preferCssPageSize\": false,\n \"headerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\"><span class=\\\"pageNumber\\\"></span> / <span class=\\\"totalPages\\\"></span></div>\",\n \"footerTemplate\": \"<div style=\\\"font-size:10px;text-align:center;width:100%;\\\">Page <span class=\\\"pageNumber\\\"></span> of <span class=\\\"totalPages\\\"></span></div>\",\n \"webhook\": {\n \"webhookUrl\": \"https://example.com/webhook\",\n \"webhookAuth\": {\n \"headerName\": \"X-API-Key\",\n \"headerValue\": \"my-secret-key\",\n \"basicAuthUsername\": \"user\",\n \"basicAuthPassword\": \"pass\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "550e8400-e29b-41d4-a716-446655440000",
"action": "pdf.merge",
"status": "PENDING",
"inputFileIds": [
"file-id-1"
],
"outputFileId": null,
"error": null,
"createdAt": "2023-11-07T05:31:56Z",
"startedAt": {},
"completedAt": {},
"result": {},
"metadata": {}
}Authorizations
Short-lived, Developer-API-audience token obtained by the trusted MCP service through token exchange (mcp_at_...). Raw MCP resource tokens are rejected.
Body
File ID of the HTML file to convert
"550e8400-e29b-41d4-a716-446655440000"
Page orientation. Default: "portrait"
portrait, landscape "portrait"
Page format. Default: "A4". Ignored when preferCssPageSize is true.
A4, A3, A5, Letter, Legal, Tabloid "A4"
CSS media type emulation. Use "screen" to preserve CSS framework styles (e.g. Tailwind, Bootstrap). Default: "print"
screen, print "print"
Page margins. Defaults: top/bottom 20mm, left/right 15mm.
Show child attributes
Show child attributes
Scale of the webpage rendering. Must be between 0.1 and 2.0. Default: 1.0
0.1 <= x <= 21
Give any CSS @page size declared in the HTML priority over the format option. Default: false
false
HTML template for the page header. Use the following placeholders: for current page, for total pages. Must be valid HTML. Requires a non-zero top margin.
"<div style=\"font-size:10px;text-align:center;width:100%;\"><span class=\"pageNumber\"></span> / <span class=\"totalPages\"></span></div>"
HTML template for the page footer. Use the following placeholders: for current page, for total pages. Must be valid HTML. Requires a non-zero bottom margin.
"<div style=\"font-size:10px;text-align:center;width:100%;\">Page <span class=\"pageNumber\"></span> of <span class=\"totalPages\"></span></div>"
Optional webhook configuration
Show child attributes
Show child attributes
Response
Conversion job created
Job ID
"550e8400-e29b-41d4-a716-446655440000"
Action that was performed
"pdf.merge"
Current job status
PENDING, PROCESSING, COMPLETED, FAILED "PENDING"
Input file IDs used for this job
["file-id-1"]
Output file ID (available when COMPLETED)
null
Error message (available when FAILED)
null
Job creation timestamp
Job start timestamp
Job completion timestamp
Structured job result data (e.g. OCR markdown/JSON, generated filename, PDF metadata, form fields). Available when the job produces a direct result instead of an output file.
Deprecated — use result instead. Additional metadata, duplicated from result for backward compatibility.
