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

The kind of data this API exposes, based on its documentation. We could not call the endpoint to confirm the exact field names.

Use case: Integrate html/url to pdf data into web and mobile applications
apilayer pdflayer data via REST API

Example Response

Illustrative shape only — we were not able to call this endpoint (it requires credentials or exposes no public sample URL), so the fields below show the kind of data this API returns rather than a recorded response.

JSON Response · Illustrative
{
  "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

Calls a real endpoint of this API. Replace any placeholder credentials with your own key.

Request
const url = "https://api.pdflayer.com/api/convert?access_key=YOUR_API_KEY&document_url=https://example.com&page_size=A4";
// 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

Generated guidance based on this API's documentation, not observed by us. Treat it as a starting point and check against the provider's own error reference.

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.

Metadata Score Breakdown

Estimated from metadata — endpoint not independently tested

This score is estimated from observable metadata — HTTPS support, authentication model, declared CORS, and documentation reachability — because the API requires authentication or exposes no publicly testable endpoint. The five-signal breakdown is only shown for live-tested APIs.

Metadata estimate · endpoint not independently tested

Technical Specifications

Auth API Key
HTTPS REQUIRED
CORS UNKNOWN
Difficulty Intermediate
Listing details not endpoint-verified

Similar APIs

View All →