Logologo-hidden
mobile-nav-icon
Overview
Authentication
Generate
Rate limits

Overview

The PdfGate API provides a simple HTTP endpoint to generate high quality PDF files based on an HTML document or a URL resource. In this page you will find everything you need in order to use the API.

Authentication

To use the API, you need to always authenticate the HTTP requests you initiate. PdfGate is using API keys for the authentication.

Firstly, you need to login to your account and create an API key. Make sure it is active and then you can use it in your source code.

In your HTTP requests you need to provide the Authorization header with the value Bearer YOUR_API_KEY.

There are two types of API keys. Production and Sandbox keys, and they should have the following format.

  • Production: live_xxxxxxxxxxxxxxx
  • Sandbox: test_xxxxxxxxxxxxxxx

Generate

In order to create a PDF document, you need to send a URL or HTML in the request body. The endpoint you should use is the following.

POSThttps://api.pdfgate.com/generate/pdf

In the request headers you should add your API key and the content type as follows.

{"Content-Type": "application/json""Authorization": "Bearer YOUR_API_KEY"}

The request body can accept the following parameters.

Body:
html string required if url field is not provided
url string required if html field is not provided
pageSizeType enum
Default: Ledger
Possible values
A0A1A2A3A4A5A6LedgerTabloidLegalLetter
width string
Custom PDF file width. It needs to be defined with the height field.
height string
Custom PDF file height. It needs to be defined with the width field.
orientation enum
Default: portrait
Possible values
portraitlandscape
header string
footer string
margin object
timeout number
Default: 30000
Maximum wait time to render the HTML content in milliseconds.
security object
javascript string
css string
emulateMediaType enum
Sets the CSS media type of the document.
Possible values
screenprint
waitForSelector string
Waits for specific CSS selector to be loaded. It will timeout in 30 seconds.
clickSelector string
Waits and then clicks a specific CSS selector.
waitForNetworkIdle boolean
Waits until there are no more network connections in the document.
httpHeaders object
Sets custom HTTP headers.
metadata object
Sets custom data to your document record.
Response:
{File stream}

Rate limits

The PdfGate API is using different rate limits for each account type in Production environment. For Sandbox enviroment the rate limit is the same for all account types.

Production rate limits:

  • Starter: 5 concurrent requests
  • Basic: 15 concurrent requests
  • Professional: 20 concurrent requests
  • Professional Plus: 50 concurrent requests

Sandbox rate limits:

Please note for Starter account type the Sandbox environment is not available.
  • In all available account types: 2 concurrent requests