Documenso Templates API

Manage reusable templates and generate documents from them.

OpenAPI Specification

documenso-templates-api-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Documenso Public Documents Templates API
  description: Public REST API (v1) for Documenso, the open-source DocuSign alternative. Programmatically create, upload, send, retrieve, and delete documents, manage recipients (signers) and signature fields, and work with reusable templates. Authentication uses a per-account API token passed in the Authorization header.
  termsOfService: https://documenso.com/legal/terms
  contact:
    name: Documenso Support
    email: support@documenso.com
    url: https://documenso.com
  license:
    name: AGPL-3.0
    url: https://github.com/documenso/documenso/blob/main/LICENSE
  version: '1.0'
servers:
- url: https://app.documenso.com/api/v1
  description: Documenso Cloud (production)
security:
- apiToken: []
tags:
- name: Templates
  description: Manage reusable templates and generate documents from them.
paths:
  /templates:
    get:
      operationId: getTemplates
      tags:
      - Templates
      summary: Get all templates
      parameters:
      - name: page
        in: query
        required: false
        schema:
          type: integer
          default: 1
      - name: perPage
        in: query
        required: false
        schema:
          type: integer
          default: 10
      responses:
        '200':
          description: A paginated list of templates.
          content:
            application/json:
              schema:
                type: object
                properties:
                  templates:
                    type: array
                    items:
                      $ref: '#/components/schemas/Template'
                  totalPages:
                    type: integer
    post:
      operationId: createTemplate
      tags:
      - Templates
      summary: Create a template
      description: Creates a new template and returns a presigned upload URL for its PDF.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
              - title
              properties:
                title:
                  type: string
      responses:
        '200':
          description: Template created with presigned upload URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  templateId:
                    type: integer
                  uploadUrl:
                    type: string
                    format: uri
  /templates/{id}:
    get:
      operationId: getTemplate
      tags:
      - Templates
      summary: Get a single template
      parameters:
      - $ref: '#/components/parameters/TemplateId'
      responses:
        '200':
          description: The requested template.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Template'
    delete:
      operationId: deleteTemplate
      tags:
      - Templates
      summary: Delete a template
      parameters:
      - $ref: '#/components/parameters/TemplateId'
      responses:
        '200':
          description: Template deleted.
  /templates/{templateId}/generate-document:
    post:
      operationId: generateDocumentFromTemplate
      tags:
      - Templates
      summary: Generate a document from a template
      description: Creates a new document from a template, optionally overriding the title, recipient details, and meta options.
      parameters:
      - name: templateId
        in: path
        required: true
        schema:
          type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                title:
                  type: string
                externalId:
                  type: string
                  nullable: true
                recipients:
                  type: array
                  items:
                    $ref: '#/components/schemas/CreateRecipientRequest'
                meta:
                  $ref: '#/components/schemas/DocumentMeta'
      responses:
        '200':
          description: Document generated from template.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
components:
  schemas:
    Field:
      type: object
      properties:
        id:
          type: integer
        documentId:
          type: integer
        recipientId:
          type: integer
        type:
          $ref: '#/components/schemas/FieldType'
        page:
          type: integer
        positionX:
          type: number
        positionY:
          type: number
        width:
          type: number
        height:
          type: number
    DocumentStatus:
      type: string
      enum:
      - DRAFT
      - PENDING
      - COMPLETED
      - REJECTED
      - CANCELLED
    CreateRecipientRequest:
      type: object
      required:
      - name
      - email
      properties:
        name:
          type: string
          minLength: 1
        email:
          type: string
          format: email
        role:
          $ref: '#/components/schemas/RecipientRole'
        signingOrder:
          type: integer
          nullable: true
    FieldType:
      type: string
      enum:
      - SIGNATURE
      - FREE_SIGNATURE
      - INITIALS
      - NAME
      - EMAIL
      - DATE
      - TEXT
      - NUMBER
      - RADIO
      - CHECKBOX
      - DROPDOWN
    DocumentMeta:
      type: object
      properties:
        subject:
          type: string
        message:
          type: string
        timezone:
          type: string
        dateFormat:
          type: string
        redirectUrl:
          type: string
          format: uri
        signingOrder:
          type: string
          enum:
          - PARALLEL
          - SEQUENTIAL
        language:
          type: string
        distributionMethod:
          type: string
          enum:
          - EMAIL
          - NONE
    RecipientRole:
      type: string
      default: SIGNER
      enum:
      - CC
      - SIGNER
      - VIEWER
      - APPROVER
      - ASSISTANT
    Document:
      type: object
      properties:
        id:
          type: integer
        userId:
          type: integer
        teamId:
          type: integer
          nullable: true
        externalId:
          type: string
          nullable: true
        folderId:
          type: string
          nullable: true
        title:
          type: string
        status:
          $ref: '#/components/schemas/DocumentStatus'
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        completedAt:
          type: string
          format: date-time
          nullable: true
        recipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
        fields:
          type: array
          items:
            $ref: '#/components/schemas/Field'
    Recipient:
      type: object
      properties:
        id:
          type: integer
        documentId:
          type: integer
        email:
          type: string
          format: email
        name:
          type: string
        role:
          $ref: '#/components/schemas/RecipientRole'
        signingOrder:
          type: integer
          nullable: true
        token:
          type: string
        signingStatus:
          type: string
          enum:
          - NOT_SIGNED
          - SIGNED
          - REJECTED
        readStatus:
          type: string
          enum:
          - NOT_OPENED
          - OPENED
        sendStatus:
          type: string
          enum:
          - NOT_SENT
          - SENT
  parameters:
    TemplateId:
      name: id
      in: path
      required: true
      schema:
        type: integer
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: Authorization
      description: API token issued from the Documenso dashboard, sent in the Authorization header (format `api_xxxxxxxx`).