Documenso Documents API

Create, upload, retrieve, download, send, re-send, and delete documents. Upload returns a presigned URL for the document PDF, and documents move through a DRAFT, PENDING, COMPLETED, REJECTED, or CANCELLED lifecycle.

OpenAPI Specification

documenso-openapi.yml Raw ↑
openapi: 3.0.1
info:
  title: Documenso Public 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: Documents
    description: Create, upload, send, retrieve, download, and delete documents.
  - name: Recipients
    description: Manage the recipients (signers, approvers, viewers) of a document.
  - name: Fields
    description: Add and configure signature and form fields on a document.
  - name: Templates
    description: Manage reusable templates and generate documents from them.
paths:
  /documents:
    get:
      operationId: getDocuments
      tags:
        - Documents
      summary: Get all documents
      description: Returns a paginated list of documents visible to the API token.
      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 documents.
          content:
            application/json:
              schema:
                type: object
                properties:
                  documents:
                    type: array
                    items:
                      $ref: '#/components/schemas/Document'
                  totalPages:
                    type: integer
    post:
      operationId: createDocument
      tags:
        - Documents
      summary: Upload a new document
      description: >-
        Creates a new draft document and returns a presigned upload URL that
        the PDF must be uploaded to. Recipients and meta options can be set at
        creation time.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateDocumentRequest'
      responses:
        '200':
          description: Document created with presigned upload URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateDocumentResponse'
  /documents/{id}:
    get:
      operationId: getDocument
      tags:
        - Documents
      summary: Get a single document
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      responses:
        '200':
          description: The requested document.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
        '404':
          $ref: '#/components/responses/NotFound'
    delete:
      operationId: deleteDocument
      tags:
        - Documents
      summary: Delete a document
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      responses:
        '200':
          description: Document deleted.
        '404':
          $ref: '#/components/responses/NotFound'
  /documents/{id}/download:
    get:
      operationId: downloadSignedDocument
      tags:
        - Documents
      summary: Download a signed document
      description: Returns a presigned URL to download the signed PDF from storage.
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      responses:
        '200':
          description: Presigned download URL.
          content:
            application/json:
              schema:
                type: object
                properties:
                  downloadUrl:
                    type: string
                    format: uri
  /documents/{id}/send:
    post:
      operationId: sendDocument
      tags:
        - Documents
      summary: Send a document for signing
      description: Distributes the document to its recipients for signature.
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                sendEmail:
                  type: boolean
                  default: true
                sendCompletionEmails:
                  type: boolean
                  default: true
      responses:
        '200':
          description: Document sent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Document'
  /documents/{id}/resend:
    post:
      operationId: resendDocument
      tags:
        - Documents
      summary: Re-send a document for signing
      description: Re-sends the signing request to selected recipients.
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                recipients:
                  type: array
                  items:
                    type: integer
      responses:
        '200':
          description: Document re-sent.
  /documents/{id}/recipients:
    post:
      operationId: createRecipient
      tags:
        - Recipients
      summary: Create a recipient for a document
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecipientRequest'
      responses:
        '200':
          description: Recipient created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recipient'
  /documents/{id}/recipients/{recipientId}:
    patch:
      operationId: updateRecipient
      tags:
        - Recipients
      summary: Update a recipient
      parameters:
        - $ref: '#/components/parameters/DocumentId'
        - $ref: '#/components/parameters/RecipientId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateRecipientRequest'
      responses:
        '200':
          description: Recipient updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Recipient'
    delete:
      operationId: deleteRecipient
      tags:
        - Recipients
      summary: Delete a recipient
      parameters:
        - $ref: '#/components/parameters/DocumentId'
        - $ref: '#/components/parameters/RecipientId'
      responses:
        '200':
          description: Recipient deleted.
  /documents/{id}/fields:
    post:
      operationId: createField
      tags:
        - Fields
      summary: Create a field for a document
      parameters:
        - $ref: '#/components/parameters/DocumentId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFieldRequest'
      responses:
        '200':
          description: Field created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Field'
  /documents/{id}/fields/{fieldId}:
    patch:
      operationId: updateField
      tags:
        - Fields
      summary: Update a field
      parameters:
        - $ref: '#/components/parameters/DocumentId'
        - $ref: '#/components/parameters/FieldId'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateFieldRequest'
      responses:
        '200':
          description: Field updated.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Field'
    delete:
      operationId: deleteField
      tags:
        - Fields
      summary: Delete a field
      parameters:
        - $ref: '#/components/parameters/DocumentId'
        - $ref: '#/components/parameters/FieldId'
      responses:
        '200':
          description: Field deleted.
  /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:
  securitySchemes:
    apiToken:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        API token issued from the Documenso dashboard, sent in the
        Authorization header (format `api_xxxxxxxx`).
  parameters:
    DocumentId:
      name: id
      in: path
      required: true
      schema:
        type: integer
    RecipientId:
      name: recipientId
      in: path
      required: true
      schema:
        type: integer
    FieldId:
      name: fieldId
      in: path
      required: true
      schema:
        type: integer
    TemplateId:
      name: id
      in: path
      required: true
      schema:
        type: integer
  responses:
    NotFound:
      description: Resource not found.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  schemas:
    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'
    CreateDocumentRequest:
      type: object
      required:
        - title
      properties:
        title:
          type: string
          minLength: 1
        externalId:
          type: string
          nullable: true
        folderId:
          type: string
        recipients:
          type: array
          items:
            $ref: '#/components/schemas/CreateRecipientRequest'
        meta:
          $ref: '#/components/schemas/DocumentMeta'
        formValues:
          type: object
          additionalProperties: true
    CreateDocumentResponse:
      type: object
      properties:
        documentId:
          type: integer
        recipients:
          type: array
          items:
            $ref: '#/components/schemas/Recipient'
        uploadUrl:
          type: string
          format: uri
          description: Presigned URL to upload the document PDF to.
    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
    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
    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
    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
    CreateFieldRequest:
      type: object
      required:
        - recipientId
        - type
        - pageNumber
        - pageX
        - pageY
        - pageWidth
        - pageHeight
      properties:
        recipientId:
          type: integer
        type:
          $ref: '#/components/schemas/FieldType'
        pageNumber:
          type: integer
        pageX:
          type: number
          description: X position as a percentage of page width.
        pageY:
          type: number
          description: Y position as a percentage of page height.
        pageWidth:
          type: number
        pageHeight:
          type: number
    DocumentStatus:
      type: string
      enum:
        - DRAFT
        - PENDING
        - COMPLETED
        - REJECTED
        - CANCELLED
    RecipientRole:
      type: string
      default: SIGNER
      enum:
        - CC
        - SIGNER
        - VIEWER
        - APPROVER
        - ASSISTANT
    FieldType:
      type: string
      enum:
        - SIGNATURE
        - FREE_SIGNATURE
        - INITIALS
        - NAME
        - EMAIL
        - DATE
        - TEXT
        - NUMBER
        - RADIO
        - CHECKBOX
        - DROPDOWN
    Error:
      type: object
      properties:
        message:
          type: string
        code:
          type: string