Create PDF

Using /v1/create API endpoint you can generate PDFs using template_id and update data fields using identifiers

You can get the template ID from any of the templates from PDFgen app. If you don't have any templates, you can create one from the generations list.

You can grab the data idenfiers(which are used as keys in the JSON data request body) from the template page by clicking the respective data items. (Click the highlighted data fields to open a side drawer and there you can see the identifier to copy).

Create PDF

POST https://pdfgen.com/api/v1/create

Create PDFs with customized data using your templates

Headers

Name
Type
Value

Content-Type

string

application/json or application/pdf

X-API-Key

string

<API-Key>

Request body

Name
Type
Description

template_id*

string

Template ID (Get from PDFgen app)

export_type

string

"url" or "file" Default: "file"

file_name

string

Name for the generated PDF

expiry_time

number

Expiry time(in minutes) for the PDF URL. e.g., 1 Default: 5

data

object

key: Identifier, value: Content e.g,

{
  "invoice_title": "Invoice",
  "customer_name": "John",
  "invoice_date": "Date: 2024/08/12"
}

protect_pdf

boolean

To protect the generated PDF with a password Default: false

password

string

Password if protect_pdf is true

self_storage

boolean

To store PDFs in user's AWS S3 storage. Default: false Note: User need to have a "Business" plan to use this feature

Response

If the export_type is set to "url," a successful response will return a JSON object containing a download link in the url parameter, available until the expiry time. If the export_type is set to "file", a successful response will return the binary data of the PDF file.

{
  "url": "URL of the PDF generated"
}

Last updated