/api/v1/analyze/pdf-inspectPDF Inspection
Analyze the internal structure of a PDF document. Returns detailed information about metadata, fonts, images, security settings, page composition, and optimization recommendations. Choose from three analysis depths depending on your needs.
Content-Type: multipart/form-data
Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
file | file | Required | - | The PDF file to analyze. |
analysis_depth | string | Optional | standard | One of: quick, standard, deep. |
include_page_details | boolean | Optional | true | Include per-page analysis in the response (applicable for standard and deep). |
Analysis Depths
quick< 500msBasic document info, metadata, security settings, and page/font/image counts. Best for quick validation or file triage.
standard< 2sDefaultEverything in quick, plus full font inventory, image inventory, per-page details, and content composition analysis.
deep< 5sEverything in standard, plus optimization analysis and actionable recommendations for reducing file size and improving compatibility.
Code Examples
cURL
curl -X POST "https://app.alternapdf.com/api/v1/analyze/pdf-inspect" \
-H "X-API-Key: YOUR_API_KEY" \
-F "file=@document.pdf" \
-F "analysis_depth=standard" \
-F "include_page_details=true"Python
import requests
import json
url = "https://app.alternapdf.com/api/v1/analyze/pdf-inspect"
headers = {"X-API-Key": "YOUR_API_KEY"}
files = {
"file": ("document.pdf", open("document.pdf", "rb"), "application/pdf"),
}
data = {
"analysis_depth": "standard",
"include_page_details": "true",
}
response = requests.post(url, headers=headers, files=files, data=data)
result = response.json()
print(json.dumps(result, indent=2))
print(f"Pages: {result['basic_info']['page_count']}")
print(f"File size: {result['basic_info']['file_size_bytes']} 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("analysis_depth", "standard");
form.append("include_page_details", "true");
const response = await axios.post(
"https://app.alternapdf.com/api/v1/analyze/pdf-inspect",
form,
{
headers: {
"X-API-Key": "YOUR_API_KEY",
...form.getHeaders(),
},
}
);
console.log(JSON.stringify(response.data, null, 2));
console.log(`Pages: ${response.data.basic_info.page_count}`);
console.log(`File size: ${response.data.basic_info.file_size_bytes} bytes`);Response
{
"analysis_depth": "standard",
"basic_info": {
"page_count": 24,
"pdf_version": "1.7",
"file_size_bytes": 1548290,
"title": "Annual Report 2025",
"author": "Finance Team",
"creator": "Microsoft Word",
"creation_date": "2025-12-15T10:30:00Z"
},
"security": {
"is_encrypted": false,
"has_permissions_password": false,
"permissions": {
"printing": "allowed",
"copying": "allowed",
"modifying": "allowed"
}
},
"fonts": [
{
"name": "Arial",
"type": "TrueType",
"embedded": true,
"subset": true,
"pages_used": [1, 2, 3, 4, 5]
}
],
"images": {
"total_count": 12,
"total_size_bytes": 890400,
"formats": ["JPEG", "PNG"],
"items": [
{
"page": 1,
"width": 1200,
"height": 800,
"format": "JPEG",
"size_bytes": 245000
}
]
},
"pages": [
{
"page_number": 1,
"width_pt": 612,
"height_pt": 792,
"rotation": 0,
"has_text": true,
"has_images": true,
"text_length": 2450
}
],
"composition": {
"text_heavy_pages": 18,
"image_heavy_pages": 4,
"blank_pages": 2
}
}The response structure varies by analysis depth. The quick depth returns basic_info, security, and counts only. The deep depth adds an optimization object and recommendations array.