> ## Documentation Index
> Fetch the complete documentation index at: https://developer.vetcove.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Generate a PDF

> 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.



## OpenAPI

````yaml post /ext/v2/pdfs/generate-pdfs/
openapi: 3.1.0
info:
  description: ''
  title: NinjaAPI
  version: 2.0.0
servers:
  - url: https://connect.vetcove.com/
security: []
paths:
  /ext/v2/pdfs/generate-pdfs/:
    post:
      tags:
        - PDFs
      summary: Generate a PDF
      description: >-
        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.
      operationId: pdfs_generate
      parameters: []
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/ExternalPDFInvoiceSchema'
                - $ref: '#/components/schemas/ExternalPDFRabiesCertificateSchema'
                - $ref: '#/components/schemas/ExternalPDFPatientTimelineSchema'
              title: Body
        required: true
      responses:
        '201':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ExternalPDFSchema'
          description: Created
      security:
        - ExternalAPIAuth: []
components:
  schemas:
    ExternalPDFInvoiceSchema:
      description: Schema for generating an invoice PDF
      properties:
        clinic_patient_id:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            The ID of the patient to generate the PDF for, leave blank to
            include all patients
          title: Clinic Patient Id
        include_discharge_notes:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          description: Whether to include discharge notes
          title: Include Discharge Notes
        include_upcoming:
          anyOf:
            - type: boolean
            - type: 'null'
          default: false
          description: Whether to include upcoming invoices
          title: Include Upcoming
        invoice_id:
          description: The ID of the invoice to generate the PDF for
          title: Invoice Id
          type: integer
        kind:
          const: INVOICE
          description: The kind of PDF to generate
          title: Kind
          type: string
        patient_id:
          anyOf:
            - type: integer
            - type: 'null'
          deprecated: true
          description: 'Deprecated: Use clinic_patient_id instead.'
          title: Patient Id
      required:
        - kind
        - invoice_id
      title: ExternalPDFInvoiceSchema
      type: object
    ExternalPDFRabiesCertificateSchema:
      description: Schema for generating a rabies certificate PDF
      properties:
        historical_treatment_id:
          anyOf:
            - type: integer
            - type: 'null'
          description: >-
            The ID of the historical rabies vaccine treatment to generate the
            PDF for
          title: Historical Treatment Id
        kind:
          const: RABIES_CERTIFICATE
          description: The kind of PDF to generate
          title: Kind
          type: string
        treatment_id:
          anyOf:
            - type: integer
            - type: 'null'
          description: The ID of the rabies vaccine treatment to generate the PDF for
          title: Treatment Id
      required:
        - kind
      title: ExternalPDFRabiesCertificateSchema
      type: object
    ExternalPDFPatientTimelineSchema:
      description: Schema for generating a patient timeline PDF
      properties:
        clinic_patient_id:
          description: The ID of the patient to generate the timeline PDF for
          title: Clinic Patient Id
          type: integer
        end_date:
          anyOf:
            - format: date
              type: string
            - type: 'null'
          description: Optional end date to filter timeline entries
          title: End Date
        include_alerts:
          default: false
          description: Whether to include patient alerts and alert tags on the PDF
          title: Include Alerts
          type: boolean
        kind:
          const: PATIENT_TIMELINE
          description: The kind of PDF to generate
          title: Kind
          type: string
        start_date:
          anyOf:
            - format: date
              type: string
            - type: 'null'
          description: Optional start date to filter timeline entries
          title: Start Date
      required:
        - kind
        - clinic_patient_id
      title: ExternalPDFPatientTimelineSchema
      type: object
    ExternalPDFSchema:
      description: Schema for the PDF detail view
      properties:
        error:
          anyOf:
            - type: string
            - type: 'null'
          description: An error message if the PDF generation failed. Null on success.
          title: Error
        file_name:
          description: The filename of the generated PDF document.
          title: File Name
          type: string
        file_url:
          anyOf:
            - type: string
            - type: 'null'
          description: >-
            A pre-signed URL to download the generated PDF. Null if the PDF is
            still being generated or generation failed.
          title: File Url
        key:
          description: The unique key used to identify and retrieve this generated PDF.
          title: Key
          type: string
        name:
          description: A human-readable name describing the type of PDF that was generated.
          title: Name
          type: string
        status:
          $ref: '#/components/schemas/APIConnectFileStatus'
          description: The current generation status of the PDF.
      required:
        - key
        - name
        - status
        - file_name
        - file_url
        - error
      title: ExternalPDFSchema
      type: object
    APIConnectFileStatus:
      enum:
        - PENDING
        - SUCCESS
        - ERROR
      title: APIConnectFileStatus
      type: string
  securitySchemes:
    ExternalAPIAuth:
      scheme: bearer
      type: http

````