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

# Create a generation

> Render a published template with the provided variables and produce a PDF.



## OpenAPI

````yaml POST /generations
openapi: 3.1.0
info:
  title: Platendoc API
  version: 1.0.0
  description: Generate PDFs from templates via the Platendoc REST API.
servers:
  - url: https://api.platendoc.com/v1
    description: Production
security: []
paths:
  /generations:
    post:
      summary: Trigger a generation
      description: >-
        Render a published template with the provided variables and produce a
        PDF.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateGenerationRequest'
      responses:
        '201':
          description: Generation created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Generation'
        '401':
          description: Missing or invalid API key.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: Invalid or missing API key.
                    required:
                      - code
                      - message
                required:
                  - error
        '422':
          description: Request body failed validation.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: object
                    properties:
                      code:
                        type: string
                        example: UNAUTHORIZED
                      message:
                        type: string
                        example: Invalid or missing API key.
                    required:
                      - code
                      - message
                required:
                  - error
      security:
        - bearerAuth: []
components:
  schemas:
    CreateGenerationRequest:
      type: object
      properties:
        templateId:
          type: string
          minLength: 1
        variables:
          type: object
          additionalProperties: {}
          default: {}
        format:
          type: string
          enum:
            - pdf
          default: pdf
      required:
        - templateId
    Generation:
      type: object
      properties:
        id:
          type: string
          example: gen_abc123
        workspaceId:
          type: string
          example: ws_xyz
        templateId:
          type: string
          example: tpl_abc
        templateName:
          type: string
          example: Invoice
        format:
          type: string
          enum:
            - PDF
        status:
          type: string
          enum:
            - PENDING
            - PROCESSING
            - COMPLETED
            - FAILED
        data:
          type: object
          additionalProperties: {}
          example:
            customerName: Acme Corp
        outputUrl:
          type:
            - string
            - 'null'
          format: uri
          example: https://cdn.platendoc.com/gen_abc123.pdf
        error:
          type:
            - string
            - 'null'
        createdAt:
          type: string
          format: date-time
          example: '2026-05-07T10:00:00.000Z'
        updatedAt:
          type: string
          format: date-time
          example: '2026-05-07T10:00:05.000Z'
      required:
        - id
        - workspaceId
        - templateId
        - templateName
        - format
        - status
        - data
        - outputUrl
        - error
        - createdAt
        - updatedAt
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        API key with pdc_live_ prefix. Pass as: Authorization: Bearer
        pdc_live_xxx

````