Getting Started
API Access Key & Authentication
After signing up, every user is assigned a personal API Access Key—a unique "password" used to make requests to the pdflayer API.
To authenticate with the PDFlayer API, simply attach your access_key to the base endpoint URL:
Get free API Access Key
HTTP GET & POST
The PDFlayer API and its functionality are primarily configured for use via HTTP POST. For customers looking to make API requests via HTTP GET the PDFlayer API is also capable of handling GET API requests using its straightforward URL structure.
However, some API functionalities are not supported using HTTP GET. Throughout this documentation you will occasionally come across HTTP POST only tags, indicating that the respective API feature or parameter is only supported via HTTP POST.
256-bit HTTPS Encryption
All Customers may establish a secure connection (industry-standard SSL) to the PDFlayer API, simply by attaching an s to the HTTP Protocol.
Important: Please be advised that when processing sensitive data through third party services it is highly recommended to always connect securely via
https.
Rate Limits
Requests to the API are rate-limited based on your current subscription plan:
| Subscription Plan | Rate Limit |
| Free | 1 Requests / Minute |
| Basic | 25 Requests / Minute |
| Professional | 40 Requests / Minute |
| Enterprise | 45 Requests / Minute |
Important: In order to ensure maximum API performance, we recommend Basic, Professional and Enterprise Plan users to limit their usage to a maximum of 1 API request per 2 seconds.
If your rate limit for a given minute has been exceeded, the API will return an error carrying the type rate_limit_reached. This error is listed in the API Error Codes section below.
API Error Codes
If your query fails, the PDFlayer API will return "success": false, along with a 3-digit error-code, an internal error type and a plain text "info" object containing suggestions for the user.
Find below an example error - triggered when no URL was specified:
Common API errors:
| Type | Message | Description |
|---|---|---|
404 | "404_not_found" | User requested a resource which does not exist. |
101 | "missing_access_key" | User did not supply an Access Key. |
101 | "invalid_access_key" | User entered an invalid Access Key. |
103 | "invalid_api_function" | User requested a non-existent API endpoint or function. |
311 | "invalid_document_url" | User did not provide a syntactically valid document URL. |
104 | "usage_limit_reached" | User has reached or exceeded his Subscription Plan's monthly API Request Allowance. |
106 | "rate_limit_reached" | User has exceeded the maximum allowed rate limitation and is referred to the "Rate Limits" section of the API Documentation. |
102 | "inactive_user" | The user's account is not active. User will be prompted to get in touch with Customer Support. |
312 | "document_url_not_found" | The specified document URL could not be found [Status: 404]. |
313 | "missing_document_source" | User did not specify a document source. User will be prompted to specify either document_url or document_html. |
311 | "invalid_document_url" | You have specified an invalid document URL. [Make sure to include the HTTP protocol - example: http://example.com/invoice.html] |
325 | "private_ip_not_allowed" | Private IP or internal URLs are not allowed for document_url. |
324 | "mapping_service_not_allowed" | IP-to-domain mapping services are not allowed for document_url. |
312 | "invalid_html" | Private IP or internal URLs are not allowed for document_url. |
310 | "document_name_too_long" | The document name you specified is too long [Maximum: 180 characters]. |
410 | "unsupported_page_size" | The page size you specified is not supported. For a complete list of supported page sizes please navigate to https://pdflayer.com/documentation#size_dimensions. |
411 | "invalid_page_width" | You have specified an invalid page width. [Required format: Numeric, decimals greater than 75]. |
412 | "invalid_page_height" | You have specified an invalid page height. [Required format: Numeric, decimals greater than 75]. |
520 | "invalid_top_margin" | You have specified an invalid top margin. [Required format: Numeric, decimals allowed]. |
521 | "invalid_bottom_margin" | You have specified an invalid bottom margin. [Required format: Numeric, decimals allowed]. |
522 | "invalid_left_margin" | You have specified an invalid left margin. [Required format: Numeric, decimals allowed]. |
523 | "invalid_right_margin" | You have specified an invalid right margin. [Required format: Numeric, decimals allowed]. |
510 | "invalid_header_spacing" | You have specified an invalid header spacing. [Required format: Numeric, decimals allowed]. |
511 | "invalid_footer_spacing" | You have specified an invalid footer spacing. [Required format: Numeric, decimals allowed]. |
412 | "invalid_orientation" | You have specified an invalid document orientation. Please use either "portrait" or "landscape". |
710 | "invalid_unit" | You have specified an invalid unit. Please use "in", "mm", "px" or "pt" instead. |
610 | "title_too_long" | The title you specified is too long. [Maximum: 150 characters]. |
611 | "author_too_long" | The author you specified is too long. [Maximum: 150 characters]. |
612 | "subject_too_long" | The subject you specified is too long. [Maximum: 150 characters]. |
613 | "creator_too_long" | The creator you specified is too long. [Maximum: 150 characters]. |
614 | "auth_user_too_long" | The authentication username you specified is too long. [Maximum: 1000 characters]. |
615 | "auth_pass_too_long" | The authentication password you specified is too long. [Maximum: 1000 characters]. |
711 | "invalid_dpi" | You have specified an invalid DPI value. [Required format: integer between 10 and 192]. |
712 | "invalid_delay" | You have specified an invalid delay time. [Required format: integer in milliseconds - example: 1000]. |
713 | "invalid_zoom_factor" | You have specified an invalid zoom factor. [Required format: integer between 0 and 50]. |
714 | "invalid_css_url" | You have specified an invalid CSS stylesheet URL. [Make sure to include the HTTP protocol - example: http://domain.com/file.css]. |
715 | "css_url_not_accessible" | The CSS URL you specified was not found. [Status: 404]. |
512 | "invalid_header_align" | You have specified an invalid header align. Please use "left", "center" or "right". |
513 | "invalid_header_url" | You have specified an invalid header URL. [Make sure to include the HTTP protocol - example: http://example.com/header.html]. |
514 | "header_url_not_found" | The header URL you specified was not found. [Status: 404]. |
515 | "invalid_footer_align" | You have specified an invalid footer align. Please use "left", "center" or "right". |
516 | "invalid_footer_url" | You have specified an invalid footer URL. [Make sure to include the HTTP protocol - example: http://example.com/footer.html]. |
517 | "footer_url_not_found" | The footer URL you specified was not found. [Status: 404]. |
716 | "invalid_page_numbering_offset" | You have specified an invalid page numbering offset. [Required format: integer - example: 50]. |
720 | "invalid_watermark_url" | You have specified an invalid watermark URL. [Make sure to include the HTTP protocol - example: http://example.com/watermark.png]. |
721 | "watermark_url_not_found" | The watermark URL you specified was not found. [Status: 404]. |
722 | "invalid_watermark_offset_x" | You have specified an invalid horizontal watermark offset. [Required format: Numeric, decimals allowed]. |
723 | "invalid_watermark_offset_y" | You have specified an invalid vertical watermark offset. [Required format: Numeric, decimals allowed]. |
724 | "invalid_watermark_opacity" | You have specified an invalid watermark opacity value. [Required format: Numeric, decimals allowed]. |
810 | "invalid_encryption_level" | You have specified an invalid encryption level. Please use "40", "128", or "256". |
811 | "owner_password_too_long" | The owner password you specified is too long. [Maximum: 32 characters]. |
812 | "user_password_too_long" | The user password you specified is too long. [Maximum: 32 characters]. |
717 | "invalid_viewport_size" | You have specified an invalid viewport size. [Required format: width x height in px - example: 1440x900]. |
718 | "viewport_too_large" | The viewport you specified is too large. [max. dimensions: 5000x5000]. |
820 | "invalid_ttl" | You have specified an invalid TTL. [Required format: integer in seconds - example: 24400]. |
821 | "ttl_too_short" | The TTL you specified is too short. [min. TTL: 300 seconds]. |
822 | "ttl_too_long" | The TTL you specified is too long. [max. TTL: 2592000 seconds]. |
813 | "owner_user_password_required" | You are required to specify both owner_password and user_password. |
814 | "html_params_not_allowed_in_get" | Please use POST request for HTML parameters. |
910 | "failed_generating_pdf" | Our system failed generating your PDF. Please try again or contact support. |
911 | "url_not_accessible" | The provided URL is not accessible. |
Important: This list of errors is not conclusive. If you come across an error message you are not sure about, please contact support at [email protected]
Secret Key
For users who intend to expose API request URLs on their website, it is highly recommended to use the PDFlayer API's URL encryption method, which generates a unique Secret Key for each API request and lets you append it to the respective API request URL.
To prevent your publicly displayed API request URL from being abused, please follow the steps below:
Step 1: Define your document URL
First of all, define the URL of the website you want to generate a PDF from.
In our example, we will use the following URL:
Step 2: Define your Secret Keyword
A Secret Keyword can be any secret word or phrase of your choice. As the next step, please ensure it is defined in your account dashboard. If not, you can simply add a secret keyword here.
In our example, we will use the following Secret Keyword:
Step 3: Combine
Now you will need to combine these two parts (URL & secret keyword) into one, resulting in:
Step 4: Generate your md5 Secret Key
Finally, create an md5 hash of the combined parts. (this will be your secret_key)
Now that you have your Secret Key, you can simply append to your API request URL using the API's secret_key parameter and rest assured that your API access is - as long as you'll keep your Secret Keyword secret - safe from abuse.
Sample API Request:
Important: Please note that as long a Secret Keyword is specified in your Account Dashboard it the use of the
document_htmlparameter is not possible.