PDF

As the name suggests, pdf are a core part of Pdfless. On this page, we’ll dive into the different properties of pdf endpoint to generate pdf programmatically.

Response model

The response model contains all the information about the pdf file and the status of the generation.

Properties

  • Name
    template_id
    Type
    guid
    Description

    Unique identifier of the template.

  • Name
    download_url
    Type
    string
    Description

    Url of the generated pdf. Link expires after 10 minutes.

  • Name
    expires
    Type
    datetime
    Description

    Timestamp of when the link will expire.

  • Name
    created_at
    Type
    datetime
    Description

    Timestamp of when the pdf was created.


POST/v1/pdfs

Generate PDF

This endpoint allows you to create PDF.

Optional attributes

  • Name
    template_id
    Type
    guid
    Description

    Unique identifier of the template used to generate pdf.

  • Name
    payload
    Type
    json
    Description

    Data in JSON format.

Request

POST
/v1/pdfs
curl https://api.pdfless.com/v1/pdfs \
  -H "apikey: {apikey}" \
  -H "Content-Type: application/json" \
  -d '{"template_id":"1814309a-c198-469e-a583-227a69a6ecb2","payload": { "Company": "Company & co" } }'

Response

{
  "data": {
      "template_id": "1814309a-c198-469e-a583-227a69a6ecb2",
      "download_url": "https://sapdfless001.blob.core.windows.net/temp/1814309a-c198-469e-a583-227a69a6ecb2/04169297-84e7-4460-8c19-a1b87b73e2f0.pdf",
      "expires": "2023-03-21T20:24:36.5524803+00:00",
      "created_at": "2023-03-21T20:14:36.5202642Z"
  },
  "status": "success"
}