---
title: "Generate a lease PDF"
method: POST
path: "/leases/{lease_id}/pdf"
tags: ["Leases", "Documents", "PDF"]
---

# Generate a lease PDF

`POST /leases/{lease_id}/pdf`

## Request

- Base URL: `https://api.faireplace.com/api`
- URL: `https://api.faireplace.com/api/leases/{lease_id}/pdf`
- Auth: HTTP bearer

Generates a PDF document from a lease template with the provided data. Returns the PDF directly as binary with performance headers.

## Path parameters

- `lease_id` string, uuid, required

## Request body

- GeneratePdfRequest: Request to generate a lease PDF
  - `template_id` string, uuid, required: Document template ID to use
  - `template_type` 'LeaseContract' | 'Amendment' | 'InventoryReport' | 'RentReceipt' | 'NoticeToVacate' | 'OtherDocument', required: Template type (LeaseContract, Amendment, InventoryReport, etc.)
  - `data` object, required: Data to insert into the template (JSON format)
  - `format_options` PdfFormatOptions: PDF formatting options
    - `paper_size` string, nullable: Paper size (A4, Letter, Legal, etc.)
    - `margins` PdfMargins: PDF document margins in millimeters
      - `top` number, float: Top margin
      - `right` number, float: Right margin
      - `bottom` number, float: Bottom margin
      - `left` number, float: Left margin
    - `font_size` number, double, nullable: Font size in points
    - `add_metadata` boolean, nullable: Add metadata to the PDF
    - `custom_variables` object, nullable: Custom variables for the template
    - `pdf_standard` string, nullable: PDF standard to comply with (PDF/A-1b, PDF/A-2b, etc.)
    - `page_ranges` string[], nullable: Page ranges to include (e.g., ['1-5', '10'])
    - `compress` boolean, nullable: Compress the PDF
    - `add_form_fields` boolean, nullable: Add interactive form fields
    - `custom_form_fields` PdfFormField[], nullable: Custom form fields
      - `field_name` string, required: Form field name
      - `field_type` 'text' | 'signature' | 'checkbox' | 'radio' | 'dropdown' | 'date' | 'number', required: Form field type
      - `position` PdfFormFieldPosition, required: Position of a form field in the PDF
        - `page` integer, required: Page number (starts at 1)
        - `x` number, float, required: X position in millimeters
        - `y` number, float, required: Y position in millimeters
        - `width` number, float, nullable: Field width in millimeters
        - `height` number, float, nullable: Field height in millimeters
      - `label` string, nullable: Field label
      - `placeholder` string, nullable: Help text
      - `required` boolean: Required field
      - `validation_rules` object, nullable: Validation rules
      - `default_value` string, nullable: Default value
      - `options` string[], nullable: Options for dropdown/radio field types

## Response `200`

PDF generated successfully

## Other responses

- `400`: Bad request
- `401`: Unauthorized
- `403`: Forbidden
- `404`: Not found
- `422`: Unprocessable Entity
- `500`: Internal Server Error

---

[API](https://skmtc.dev/faireplace/apis/faireplace-property-management-api.md) · [All operations](https://skmtc.dev/faireplace/apis/faireplace-property-management-api/llms.txt) · [OpenAPI document](https://skmtc.dev/faireplace/apis/faireplace-property-management-api/revisions/69de39762919?raw)
