apilayer pdflayer API

⭐ Beginner's Pick Documents & Productivity / API Key Intermediate HTTPS
Varies by plan (check documentation)

Overview

The pdflayer API by apilayer converts any HTML snippet or public URL into a high-quality PDF file with a simple GET or POST request. It supports custom page sizes, margins, headers, footers, and CSS styling. It is a practical choice for generating invoices, reports, or printable documents from web content.

💡

Beginner Tip

Use the document_url parameter to convert a live webpage to PDF in one request — no HTML knowledge required. The response is a raw PDF binary, so save it directly to a .pdf file.

Available Data

Use case: Integrate html/url to pdf data into web and mobile applications
apilayer pdflayer data via REST API
JSON-formatted response data
Requires API key authentication

Example Response

JSON Response
{
  "status": "success",
  "data": {
    "result": "Data from apilayer pdflayer",
    "description": "HTML/URL to PDF",
    "timestamp": "2025-01-15T10:00:00Z"
  }
}

Field Reference

(binary) The API returns raw PDF binary data directly in the response body when conversion succeeds.
success Returned in error responses to indicate the request failed.
error.code Numeric error code identifying the type of failure.
error.type Short error category label (e.g., invalid_access_key).
error.info Human-readable explanation of what went wrong.

Implementation Example

const url = "https://pdflayer.com/";
// Replace headers or query params with the values required by this API.
const response = await fetch(url, {
  headers: {
  "X-API-Key": "YOUR_API_KEY"
  }
});
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data);

What Can You Build?

Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.

Common Errors & Troubleshooting

101 Invalid Access Key The access_key query parameter is missing or incorrect.
Copy your access key from the pdflayer dashboard and pass it as access_key in the query string.
301 Invalid URL The document_url provided is malformed or unreachable.
Ensure the URL is fully encoded and publicly accessible from the internet.
Empty or corrupt PDF The target page uses JavaScript rendering that the API's headless engine cannot process.
Try using the document_html parameter with static HTML instead, or add a delay parameter.

Matrix Score Breakdown

🌐 Reachability 30/30
⚡ Speed 5/20
🔒 Security 15/15
🛠 Developer XP 12/20
✓ Reliability 10/15

Partially tested on Apr 5, 2026

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Difficulty Intermediate
Verified: 2026-04-04

Similar APIs

View All →