The PDFGate API provides a set of HTTP endpoints for working with PDF documents, with a focus on digital signatures. You can sign documents and manage document workflows, along with generating PDFs from HTML or URLs and processing existing files.
All requests are authenticated using an API key and return JSON responses using standard HTTP status codes.
PDFGate offers a sandbox environment for testing your integration without affecting production data. The environment is determined by the request URL, and your API key must match the selected environment.
Each request operates on a single document or resource.
All API requests must be authenticated using an API key. Authentication is handled via the Authorization header in your HTTP requests.
To get started, log in to your PDFGate account and create an API key from the Settings page in the dashboard. Ensure the key is active before using it in your code.
Include the API key in your request headers like this:
PDFGate supports two types of API keys:
Use sandbox keys for testing purposes and production keys in your live environment.
The PDFGate API uses different rate limits for each account type in the production environment. In the sandbox environment, the rate limits are the same for all account types.
| Endpoint | Production | Sandbox |
|---|---|---|
POST /v1/generate/pdf POST /forms/flatten POST /forms/extract-data POST /forms/fields POST /watermark/pdf POST /protect/pdf POST /compress/pdf POST /envelope POST /envelope/:id/send POST /upload POST /webhook | Per account type requests:
| Per account type requests:
|
GET /document/:id DELETE /document/:id GET /file/:id GET /envelope/:id GET /webhook/:id DELETE /webhook/:id | Per account type requests:
| 30 concurrent requests |
| Code | Error |
|---|---|
| 400 | Bad request |
| 401 | Unauthorized |
| 404 | Not found |
| 422 | Unprocessable entity |
| 429 | Too many requests |
| 500 | Internal server error |
The Generate PDF endpoint converts HTML content into a PDF document. You can provide the content either as a publicly accessible URL or as raw HTML in the request body.
By default, the endpoint returns the generated PDF as a binary file. If you prefer a JSON response, you can include the jsonResponse field in your request.
Endpoint
Examples
Request body fields
clickSelector field is ignored."1-5" or "1,3,5". If not specified, all pages are included.Available responses
The Flatten PDF endpoint converts an interactive PDF (with fillable form fields or annotations) into a static, non-editable version.
documentId referencing an existing file already stored in our database.If a documentId is provided, the API will always create a new flattened file in the database, rather than overwriting the existing one.
In this case, the response includes a derivedFrom parameter (when jsonResponse is set to true), it indicates the original document ID from which the flattened file was created.
Endpoint
Examples
Request body fields
.pdfAvailable responses
The Extract PDF Form Data endpoint lets you read data from a fillable PDF. It extracts all form fields in the document along with their current values and returns them as a JSON object.
You can either upload a new PDF file directly or provide the documentId of an existing file stored on the server.
Endpoint
Examples
Request body fields
.pdfAvailable responses
This endpoint adds interactive form fields to any existing PDF using placeholder tags.
Tags are written as plain text, so you can add them in any PDF editor or document editor that can export files as PDFs. They look like regular text. For example, the tag {signature;n:sign_here;r:signer}, when processed, will be replaced in the PDF with a digital signature field named "sign_here" and assigned to the role "signer".
Our API automatically removes placeholder tags from the PDF after processing. However, in some cases, the original tag text may remain. To ensure the tags are not visible, we recommend setting their text color to match the background color.
Note: Tags must be written on a single line. If they are split across multiple lines, they will not be detected.
Tag syntax
Each tag starts with the field type. Additional properties are optional and use a key:value format separated by semicolons.
| Key | Description | Required | Applies to |
|---|---|---|---|
type | The field type. Must always be defined first. Supported field types are listed below. | Yes | All |
n: | The field name. Radio buttons with the same name are grouped together. The name also links the field to a fieldOverrides entry. | No | All |
r: | Associates the field with a signing role. Only users assigned to that role can interact with the field. | No | All |
h: | The field height in points. By default, the height is automatically detected from the placeholder tag, but you can override it using this tag or through the fieldOverrides option if needed. | No | All |
w: | The field width in points. By default, the width is automatically detected from the placeholder tag, but you can override it using this tag or through the fieldOverrides option if needed. | No | All |
fs: | Sets the field font size. By default, the font size is automatically calculated based on the field height, but you can override it using this tag if needed. | No | text, number, textarea, date, time, datetime, select |
o: | A comma-separated list of options for the select field. | No | select only |
c: | Specifies the value represented by this radio button within the group. | No | radio only |
Example tags:
Tags are case-sensitive. Keys and field types must be written exactly as shown below.
Supported field types
| Type | Description |
|---|---|
text | Creates a standard text input field. |
number | A text field that only accepts numbers. |
textarea | Creates a text input field that supports multiple lines. |
date | Stored as a text field in the PDF. In our signing UI is presented as a date picker. |
time | Stored as a text field in the PDF. In our signing UI is presented as a time picker. |
datetime | Stored as a text field in the PDF. In our signing UI is presented as a date and time picker. You can automatically populate this field when the document is signed by setting autoFill in fieldOverrides. |
checkbox | Creates a standard checkbox field. |
radio | Creates a radio button field. Radio buttons that share the same name behave as a group. |
select | Creates a dropdown field. Options can be provided inline using the tag o: or through fieldOverrides. |
signature | Defines a field where a recipient can provide their signature. It is primarily used with the digital signatures feature to collect signatures in the signing UI. |
Endpoint
Examples
Request body fields
.pdfAvailable responses
The Watermark PDF endpoint adds a watermark to an existing PDF document. You can apply either a text watermark or an image watermark, depending on your needs.
Endpoint
Examples
Request body fields
.pdf.png .jpeg .jpg.ttf .otffontFile is provided, this parameter will be ignored.Available responses
The Protect PDF endpoint secures a PDF document by applying password protection and permission restrictions.
You can encrypt the PDF using AES-128 or AES-256, set user and owner passwords, and control which actions are allowed, such as printing, copying, or editing.
Endpoint
Examples
Request body fields
.pdfAvailable responses
The Compress PDF endpoint reduces the file size of a PDF without changing its visual appearance. You can also enable linearization so the first page loads faster when the PDF is opened over a network.
Note: In the sandbox environment, the compression result may be limited because our watermark image is automatically added to the document. As a result, the file size will be increased. We recommend testing this endpoint in the production environment.
Endpoint
Examples
Request body fields
.pdfAvailable responses
Retrieves a generated document object containing metadata and file details.
Endpoint
Examples
Request query fields
Response
Deleting a document performs a soft delete to preserve internal records and maintain audit integrity.
Note: Documents used as a source in an envelope with in_progress status cannot be deleted. A document can only be deleted once all associated envelopes are in created, completed, or expired status.
Endpoint
Examples
Response
Retrieves a raw PDF file previously generated.
Note: To access a generated file, you must enable file storage in your PDFGate dashboard under Settings → Storage. Files are retained only for the configured storage duration. By default, file storage is disabled.
Endpoint
Examples
Response
Upload a PDF document. The document can be provided either as a file upload or by specifying a publicly accessible URL where the PDF is hosted.
Endpoint
Examples
Request body fields
.pdf500 mbAvailable responses