PHP PDF API

A lightweight, high-performance REST API for PDF manipulation. No system dependencies required.

Manage API Keys

Authentication

All API requests require an API key sent via the x-api-key header. You can generate and manage your keys in the Admin Panel.

curl -X POST https://api.yourdomain.com/pdf/endpoint \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{ ... }'

POST /pdf/extract-first-page

Extracts only the first page of a PDF document.

Request Body

{ "file": "base64_encoded_pdf_string" }

POST /pdf/extract-pages

Extracts specific pages from a PDF.

Request Body

{ 
  "file": "base64_encoded_pdf_string",
  "pages": [1, 3, 5] 
}

POST /pdf/merge

Merges multiple PDF files into one.

Request Body

{ 
  "files": [
    "base64_pdf_1",
    "base64_pdf_2"
  ] 
}

POST /pdf/split

Splits a PDF into multiple documents.

Request Body

{ 
  "file": "base64_encoded_pdf_string",
  "interval": 1 
}

Note: interval is optional (default: 1 page per file).

POST /pdf/delete-blank-pages

Detects and removes empty pages from a document.

Request Body

{ "file": "base64_encoded_pdf_string" }

Error Handling

Errors follow a consistent format with appropriate HTTP status codes.

{ 
  "success": false, 
  "error": "Descriptive error message" 
}