openapi: 3.1.0 info: title: PDF Monkey Authentication Templates API description: REST API for generating, managing, and retrieving PDF documents using Handlebars/Liquid templates and JSON data payloads. Supports asynchronous and synchronous generation modes, document lifecycle management, template management, and webhook notifications for real-time event handling. version: 1.0.0 contact: url: https://pdfmonkey.io/docs/ termsOfService: https://www.pdfmonkey.io/terms license: name: Proprietary servers: - url: https://api.pdfmonkey.io/api/v1 description: PDF Monkey Production API security: - bearerAuth: [] tags: - name: Templates description: Manage document templates for PDF generation paths: /document_template_cards: get: operationId: listTemplateCards summary: List template cards description: Retrieve a paginated list of lightweight template card objects for a given workspace. tags: - Templates parameters: - name: q[workspace_id] in: query required: true description: Workspace UUID to filter templates by schema: type: string format: uuid - name: q[folders] in: query description: Comma-separated folder IDs; use 'none' for root or 'all' for all folders schema: type: string - name: page in: query description: Page number for pagination schema: type: integer minimum: 1 default: 1 - name: sort in: query description: Sort attribute schema: type: string responses: '200': description: Paginated list of template cards content: application/json: schema: $ref: '#/components/schemas/TemplateCardListResponse' '401': $ref: '#/components/responses/Unauthorized' /document_templates: post: operationId: createTemplate summary: Create a template description: Create a new document template with HTML/Liquid body, SCSS styles, sample data, and generation settings. tags: - Templates requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TemplateCreateRequest' example: document_template: app_id: a1b2c3d4-e5f6-7890-abcd-ef1234567890 identifier: invoice-template body: '
Customer: {{ customer_name }}
' scss_style: 'body { font-family: Arial, sans-serif; }' sample_data: '{"customer_name": "Jane Doe"}' output_type: pdf edition_mode: code responses: '201': description: Template created successfully content: application/json: schema: $ref: '#/components/schemas/TemplateResponse' '401': $ref: '#/components/responses/Unauthorized' '422': $ref: '#/components/responses/UnprocessableEntity' /document_templates/{id}: get: operationId: getTemplate summary: Get a template description: Retrieve the full document template object including body, styles, settings, and test data. tags: - Templates parameters: - $ref: '#/components/parameters/TemplateId' responses: '200': description: Full template object content: application/json: schema: $ref: '#/components/schemas/TemplateResponse' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' put: operationId: updateTemplate summary: Update a template description: Update an existing document template's properties. tags: - Templates parameters: - $ref: '#/components/parameters/TemplateId' requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/TemplateUpdateRequest' responses: '200': description: Updated template object content: application/json: schema: $ref: '#/components/schemas/TemplateResponse' '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' '422': $ref: '#/components/responses/UnprocessableEntity' delete: operationId: deleteTemplate summary: Delete a template description: Permanently delete a document template. tags: - Templates parameters: - $ref: '#/components/parameters/TemplateId' responses: '204': description: Template deleted successfully '401': $ref: '#/components/responses/Unauthorized' '404': $ref: '#/components/responses/NotFound' components: schemas: TemplateCreateRequest: type: object required: - document_template properties: document_template: type: object required: - app_id - identifier properties: app_id: type: string format: uuid description: Workspace UUID this template belongs to identifier: type: string minLength: 1 maxLength: 100 description: Unique human-readable identifier for the template body: type: string description: HTML + Liquid template body (published version) body_draft: type: string description: HTML + Liquid template body (draft version) scss_style: type: string description: CSS/SCSS styles (published version) scss_style_draft: type: string description: CSS/SCSS styles (draft version) sample_data: type: string description: JSON sample data for template preview (published) sample_data_draft: type: string description: JSON sample data (draft) settings: $ref: '#/components/schemas/TemplateSettings' settings_draft: $ref: '#/components/schemas/TemplateSettings' pdf_engine_id: type: string format: uuid pdf_engine_draft_id: type: string format: uuid template_folder_id: type: string format: uuid ttl: type: integer description: Time-to-live in seconds for generated documents edition_mode: type: string enum: - code - builder default: code output_type: type: string enum: - pdf - image default: pdf DocumentTemplate: type: object properties: id: type: string format: uuid description: Template unique identifier app_id: type: string format: uuid description: Workspace (app) identifier identifier: type: string description: Human-readable unique identifier for the template (1-100 chars) edition_mode: type: string enum: - code - builder description: Whether the template uses code editor or visual builder output_type: type: string enum: - pdf - image description: Output format type is_draft: type: boolean description: Whether this template is currently in draft state body: type: string description: Published HTML + Liquid template body body_draft: type: string description: Draft HTML + Liquid template body scss_style: type: string description: Published CSS/SCSS styles scss_style_draft: type: string description: Draft CSS/SCSS styles sample_data: type: string description: Published JSON sample data for template preview sample_data_draft: type: string description: Draft JSON sample data settings: $ref: '#/components/schemas/TemplateSettings' settings_draft: $ref: '#/components/schemas/TemplateSettings' pdf_engine_id: type: - string - 'null' format: uuid description: PDF engine UUID used for generation pdf_engine_draft_id: type: - string - 'null' format: uuid template_folder_id: type: - string - 'null' format: uuid description: Folder this template belongs to ttl: type: - integer - 'null' description: Time-to-live in seconds for generated documents created_at: type: string format: date-time updated_at: type: string format: date-time TemplateCardListResponse: type: object properties: document_template_cards: type: array items: $ref: '#/components/schemas/DocumentTemplateCard' meta: $ref: '#/components/schemas/PaginationMeta' DocumentTemplateCard: type: object description: Lightweight template object for listing properties: id: type: string format: uuid app_id: type: string format: uuid identifier: type: string edition_mode: type: string enum: - code - builder output_type: type: string enum: - pdf - image is_draft: type: boolean created_at: type: string format: date-time updated_at: type: string format: date-time pdf_engine_name: type: - string - 'null' description: Name of the PDF rendering engine pdf_engine_deprecated_on: type: - string - 'null' format: date-time description: Date when this engine will be deprecated, null if not deprecated template_folder_id: type: - string - 'null' format: uuid template_folder_identifier: type: - string - 'null' TemplateResponse: type: object properties: document_template: $ref: '#/components/schemas/DocumentTemplate' TemplateSettings: type: object description: PDF generation settings for the template properties: footer: type: object description: Footer configuration with left, center, right, or content properties header: type: object description: Header configuration with left, center, right, or content properties inject_javascript: type: boolean description: Whether to inject and execute JavaScript during generation margin: type: object description: Page margins in millimeters properties: top: type: number bottom: type: number left: type: number right: type: number orientation: type: string enum: - portrait - landscape description: Page orientation paper_format: type: string enum: - a0 - a1 - a2 - a3 - a4 - a5 - a6 - letter - custom description: Paper size format paper_height: type: number description: Custom paper height in millimeters (used when paper_format is 'custom') paper_width: type: number description: Custom paper width in millimeters (used when paper_format is 'custom') transparent_background: type: boolean description: Whether the PDF background should be transparent use_emojis: type: boolean description: Whether emoji rendering is enabled use_paged: type: boolean description: Whether to use Paged.js for print layout PaginationMeta: type: object properties: current_page: type: integer description: Current page number next_page: type: - integer - 'null' description: Next page number, null if on last page prev_page: type: - integer - 'null' description: Previous page number, null if on first page total_pages: type: integer description: Total number of pages ApiError: type: object properties: status: type: string description: HTTP status code as string title: type: string description: Short error title detail: type: string description: Detailed error description ErrorResponse: type: object properties: errors: type: array items: $ref: '#/components/schemas/ApiError' TemplateUpdateRequest: type: object required: - document_template properties: document_template: type: object properties: identifier: type: string minLength: 1 maxLength: 100 body: type: string body_draft: type: string scss_style: type: string scss_style_draft: type: string sample_data: type: string sample_data_draft: type: string settings: $ref: '#/components/schemas/TemplateSettings' settings_draft: $ref: '#/components/schemas/TemplateSettings' pdf_engine_id: type: string format: uuid pdf_engine_draft_id: type: string format: uuid template_folder_id: type: string format: uuid ttl: type: integer output_type: type: string enum: - pdf - image responses: NotFound: description: The requested resource was not found content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' Unauthorized: description: Authentication failed — missing or invalid API key content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' example: errors: - status: '401' title: Unauthorized detail: We were unable to authenticate you based on the provided API key. UnprocessableEntity: description: Validation errors — the request body is invalid content: application/json: schema: $ref: '#/components/schemas/ErrorResponse' parameters: TemplateId: name: id in: path required: true description: Template UUID schema: type: string format: uuid securitySchemes: bearerAuth: type: http scheme: bearer description: Authenticate using your PDF Monkey API secret key as a Bearer token in the Authorization header.