---
title: "Generate a PDF"
method: POST
path: "/ext/v2/pdfs/generate-pdfs/"
tags: ["PDFs"]
---

# Generate a PDF

`POST /ext/v2/pdfs/generate-pdfs/`

## Request

- Base URL: `https://connect.vetcove.com`
- URL: `https://connect.vetcove.com/ext/v2/pdfs/generate-pdfs/`
- Auth: HTTP bearer

This endpoint is available to Group API Keys only.

Triggers the asynchronous generation of a PDF document (e.g., an invoice PDF or a rabies certificate). The response includes a unique key that can be used to poll the fetch endpoint until the PDF is ready for download. Once ready for download, PDFs are only available for download for 24 hours. Beyond that window, the PDF must be regenerated.

## Request body

- union
  - ExternalPDFInvoiceSchema: Schema for generating an invoice PDF
    - `clinic_patient_id` integer, nullable: The ID of the patient to generate the PDF for, leave blank to include all patients
    - `include_discharge_notes` boolean, nullable: Whether to include discharge notes
    - `include_upcoming` boolean, nullable: Whether to include upcoming invoices
    - `invoice_id` integer, required: The ID of the invoice to generate the PDF for
    - `kind` 'INVOICE', required: The kind of PDF to generate
    - `patient_id` integer, nullable: Deprecated: Use clinic_patient_id instead.
  - ExternalPDFRabiesCertificateSchema: Schema for generating a rabies certificate PDF
    - `historical_treatment_id` integer, nullable: The ID of the historical rabies vaccine treatment to generate the PDF for
    - `kind` 'RABIES_CERTIFICATE', required: The kind of PDF to generate
    - `treatment_id` integer, nullable: The ID of the rabies vaccine treatment to generate the PDF for
  - ExternalPDFPatientTimelineSchema: Schema for generating a patient timeline PDF
    - `clinic_patient_id` integer, required: The ID of the patient to generate the timeline PDF for
    - `end_date` string, date, nullable: Optional end date to filter timeline entries
    - `include_alerts` boolean: Whether to include patient alerts and alert tags on the PDF
    - `kind` 'PATIENT_TIMELINE', required: The kind of PDF to generate
    - `start_date` string, date, nullable: Optional start date to filter timeline entries

## Response `201`

Created

- ExternalPDFSchema: Schema for the PDF detail view
  - `error` string, nullable, required: An error message if the PDF generation failed. Null on success.
  - `file_name` string, required: The filename of the generated PDF document.
  - `file_url` string, nullable, required: A pre-signed URL to download the generated PDF. Null if the PDF is still being generated or generation failed.
  - `key` string, required: The unique key used to identify and retrieve this generated PDF.
  - `name` string, required: A human-readable name describing the type of PDF that was generated.
  - `status` 'PENDING' | 'SUCCESS' | 'ERROR', required

---

[API](https://skmtc.dev/vetcove/apis/ninjaapi.md) - [All operations](https://skmtc.dev/vetcove/apis/ninjaapi/llms.txt) - [OpenAPI document](https://skmtc.dev/vetcove/apis/ninjaapi/revisions/4ceaed956e15?raw)
