/api/v1/convert/pdf-to-pdfaPDF/A Conversion
Convert a standard PDF into a PDF/A-compliant document suitable for long-term archival. The conversion embeds all fonts, adds required XMP metadata, and ensures the output meets the specified conformance level.
Content-Type: multipart/form-data
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file | file | Required | - | The PDF file to convert to PDF/A. |
conformance_level | string | Optional | 2b | Target conformance level. One of: 1b, 2b, 3b. |
Conformance Levels
1bPDF/A-1b · PDF 1.4Maximum compatibility. Based on PDF 1.4 specification. No transparency or JPEG2000 support. Best when you need the widest reader compatibility.
2bPDF/A-2b · PDF 1.7RecommendedBased on PDF 1.7. Supports transparency, JPEG2000 compression, and optional content. The recommended choice for most use cases.
3bPDF/A-3b · PDF 1.7Based on PDF 1.7 with support for embedded file attachments of any format. Use when you need to bundle source data (XML, CSV, spreadsheets) inside the PDF.
Code Examples
cURL
curl -X POST "https://app.alternapdf.com/api/v1/convert/pdf-to-pdfa" \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@document.pdf" \
-F "conformance_level=2b" \
--output document-pdfa.pdfPython
import requests
url = "https://app.alternapdf.com/api/v1/convert/pdf-to-pdfa"
headers = {"X-API-Key": "YOUR_API_KEY"}
files = {
"file": ("document.pdf", open("document.pdf", "rb"), "application/pdf"),
}
data = {
"conformance_level": "2b",
}
response = requests.post(url, headers=headers, files=files, data=data)
with open("document-pdfa.pdf", "wb") as f:
f.write(response.content)
print(f"PDF/A-2b saved ({len(response.content)} bytes)")JavaScript
const fs = require("fs");
const FormData = require("form-data");
const axios = require("axios");
const form = new FormData();
form.append("file", fs.createReadStream("document.pdf"));
form.append("conformance_level", "2b");
const response = await axios.post(
"https://app.alternapdf.com/api/v1/convert/pdf-to-pdfa",
form,
{
headers: {
"X-API-Key": "YOUR_API_KEY",
...form.getHeaders(),
},
responseType: "arraybuffer",
}
);
fs.writeFileSync("document-pdfa.pdf", response.data);
console.log(`PDF/A-2b saved (${response.data.byteLength} bytes)`);Response
| Header | Value |
|---|---|
Content-Type | application/pdf |
Content-Disposition | attachment; filename="document-pdfa.pdf" |
The response body contains the PDF/A-compliant PDF binary. The output file will typically be larger than the input because all fonts are fully embedded. On error, a JSON object with a detail field is returned instead.
Tip: Use the PDF/A Validation endpoint to verify the converted output meets the target conformance level.