POST/api/v1/convert/pdf-to-pdfa

PDF/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

ParameterTypeRequiredDefaultDescription
filefileRequired-The PDF file to convert to PDF/A.
conformance_levelstringOptional2bTarget conformance level. One of: 1b, 2b, 3b.

Conformance Levels

1bPDF/A-1b · PDF 1.4

Maximum 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.7Recommended

Based on PDF 1.7. Supports transparency, JPEG2000 compression, and optional content. The recommended choice for most use cases.

3bPDF/A-3b · PDF 1.7

Based 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

bash
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.pdf

Python

python
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

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

200PDF/A-compliant PDF binary
HeaderValue
Content-Typeapplication/pdf
Content-Dispositionattachment; 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.