Documenso

Documents API

Create, manage, and send documents for signing via the API.

Documents and templates are being deprecated and replaced by envelopes. Read the migration guide here.

This guide may not reflect the latest endpoints or parameters. For an always up-to-date reference, see the OpenAPI Reference.

Overview

Documents (called "envelopes" in the API) are the core resource in Documenso. You can:

  1. create documents with recipients and fields
  2. send them for signing
  3. track their status
  4. retrieve the completed PDFs

Each document contains one or more PDF files, a list of recipients, and the fields they need to fill.

Document Object

A document object contains the following properties:

PropertyTypeDescription
idstringUnique identifier (e.g., envelope_abc123)
secondaryIdstringLegacy identifier in prefixed form (document_123 for documents, template_123 for templates)
internalVersionnumberInternal envelope schema version
typestringDOCUMENT or TEMPLATE
statusstringCurrent status: DRAFT, PENDING, COMPLETED, REJECTED, or CANCELLED
titlestringDocument title
sourcestringHow the document was created: DOCUMENT, TEMPLATE, TEMPLATE_DIRECT_LINK
visibilitystringWho can view: EVERYONE, ADMIN, MANAGER_AND_ABOVE
templateTypestringTemplate visibility: PUBLIC, PRIVATE, or ORGANISATION (only meaningful for templates)
externalIdstring | nullYour custom identifier for the document
userIdnumberID of the user who owns the document
teamIdnumberID of the team the document belongs to
folderIdstring | nullID of the folder containing the document
templateIdnumber | nullLegacy ID of the template this document was created from
authOptionsobject | nullAccess and action authentication requirements
formValuesobject | nullPre-filled form values
publicTitlestringPublic title shown on profile and direct-link pages
publicDescriptionstringPublic description shown on profile and direct-link pages
createdAtstringISO 8601 timestamp
updatedAtstringISO 8601 timestamp
completedAtstring | nullTimestamp when all recipients completed signing
deletedAtstring | nullTimestamp if soft-deleted
recipientsarrayList of recipients and their signing status
fieldsarraySignature and form fields on the document
envelopeItemsarrayPDF files attached to the document
directLinkobject | nullDirect-link signing configuration (id, token, enabled, directTemplateRecipientId)
teamobjectOwning team (id, url)
userobjectDocument owner (id, name, email)
documentMetaobjectEmail settings, redirect URL, signing options

Documents created through the API have source: "DOCUMENT" — there is no separate API source value. To tag documents created by your integration, set externalId when creating them.

Example Document Object

{
  "id": "envelope_abc123xyz",
  "secondaryId": "document_123",
  "internalVersion": 2,
  "type": "DOCUMENT",
  "status": "PENDING",
  "source": "DOCUMENT",
  "visibility": "EVERYONE",
  "templateType": "PRIVATE",
  "title": "Service Agreement",
  "externalId": "contract-2025-001",
  "userId": 1,
  "teamId": 1,
  "folderId": null,
  "templateId": null,
  "authOptions": null,
  "formValues": null,
  "publicTitle": "",
  "publicDescription": "",
  "createdAt": "2025-01-15T10:30:00.000Z",
  "updatedAt": "2025-01-15T10:35:00.000Z",
  "completedAt": null,
  "deletedAt": null,
  "recipients": [
    {
      "id": 1,
      "email": "signer@example.com",
      "name": "John Smith",
      "role": "SIGNER",
      "signingStatus": "NOT_SIGNED",
      "signingOrder": 1
    }
  ],
  "fields": [
    {
      "id": 123,
      "secondaryId": "field_abc123",
      "type": "SIGNATURE",
      "recipientId": 1,
      "envelopeId": "envelope_abc123xyz",
      "envelopeItemId": "envelope_item_xyz",
      "page": 1,
      "positionX": "10",
      "positionY": "80",
      "width": "30",
      "height": "5",
      "customText": "",
      "inserted": false,
      "fieldMeta": null
    }
  ],
  "envelopeItems": [
    {
      "id": "envelope_item_xyz",
      "envelopeId": "envelope_abc123xyz",
      "documentDataId": "doc_data_abc123",
      "title": "contract.pdf",
      "order": 1
    }
  ],
  "directLink": null,
  "team": {
    "id": 1,
    "url": "your-team"
  },
  "user": {
    "id": 1,
    "name": "Jane Smith",
    "email": "jane@example.com"
  },
  "documentMeta": {
    "subject": "Please sign this document",
    "message": "Hi, please review and sign this agreement.",
    "timezone": "America/New_York",
    "redirectUrl": "https://example.com/thank-you"
  }
}

Field position and size values are stored as decimals and serialized as strings in API responses.

List Documents

Retrieve a paginated list of documents.

GET /envelope

Query Parameters

ParameterTypeDescription
pageintegerPage number (default: 1)
perPageintegerResults per page (default: 10, max: 100)
typestringFilter by DOCUMENT or TEMPLATE
statusstringFilter by status: DRAFT, PENDING, COMPLETED, REJECTED, CANCELLED
sourcestringFilter by creation source
folderIdstringFilter by folder ID
orderByColumnstringSort field (only createdAt supported)
orderByDirectionstringSort direction: asc or desc (default: desc)

Code Examples

# List all documents
curl -X GET "https://app.documenso.com/api/v2/envelope" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx"

# Filter by status and paginate

curl -X GET "https://app.documenso.com/api/v2/envelope?status=PENDING&page=1&perPage=20" \
 -H "Authorization: api_xxxxxxxxxxxxxxxx"

# List only documents (not templates)

curl -X GET "https://app.documenso.com/api/v2/envelope?type=DOCUMENT" \
 -H "Authorization: api_xxxxxxxxxxxxxxxx"

Response

{
  "data": [
    {
      "id": "envelope_abc123",
      "type": "DOCUMENT",
      "status": "PENDING",
      "title": "Service Agreement",
      "createdAt": "2025-01-15T10:30:00.000Z",
      "updatedAt": "2025-01-15T10:35:00.000Z",
      "recipients": [
        {
          "id": 1,
          "email": "signer@example.com",
          "name": "John Smith",
          "role": "SIGNER",
          "signingStatus": "NOT_SIGNED"
        }
      ]
    }
  ],
  "count": 42,
  "currentPage": 1,
  "perPage": 10,
  "totalPages": 5
}

Get Document

Retrieve a single document by ID.

GET /envelope/{envelopeId}

Path Parameters

ParameterTypeDescription
envelopeIdstringThe document ID (e.g., envelope_abc123)

Code Examples

curl -X GET "https://app.documenso.com/api/v2/envelope/envelope_abc123" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx"

Response

Returns the full document object including recipients, fields, and envelope items.

{
  "id": "envelope_abc123",
  "type": "DOCUMENT",
  "status": "PENDING",
  "title": "Service Agreement",
  "recipients": [...],
  "fields": [...],
  "envelopeItems": [...],
  "documentMeta": {...}
}

Create Document

Create a new document with optional recipients and fields in a single request.

This endpoint automatically scans uploaded PDFs for placeholder patterns like {"{{signature, r1}}"} and creates fields at those locations.

POST /envelope/create
Content-Type: multipart/form-data

Request Body

The request uses multipart/form-data with two parts:

PartTypeDescription
payloadJSONDocument configuration
filesFile(s)One or more PDF files

Payload Schema

FieldTypeRequiredDescription
typestringYesMust be DOCUMENT
titlestringYesDocument title
externalIdstringNoYour custom identifier
visibilitystringNoEVERYONE, ADMIN, or MANAGER_AND_ABOVE
folderIdstringNoFolder ID to create the document in
recipientsarrayNoRecipients with optional fields
metaobjectNoEmail subject, message, redirect URL, etc.

Code Examples

curl -X POST "https://app.documenso.com/api/v2/envelope/create" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: multipart/form-data" \
  -F 'payload={
    "type": "DOCUMENT",
    "title": "Service Agreement",
    "externalId": "contract-2025-001",
    "recipients": [
      {
        "email": "signer@example.com",
        "name": "John Smith",
        "role": "SIGNER",
        "fields": [
          {
            "identifier": 0,
            "type": "SIGNATURE",
            "page": 1,
            "positionX": 10,
            "positionY": 80,
            "width": 30,
            "height": 5
          },
          {
            "identifier": 0,
            "type": "DATE",
            "page": 1,
            "positionX": 50,
            "positionY": 80,
            "width": 20,
            "height": 3
          }
        ]
      }
    ],
    "meta": {
      "subject": "Please sign this agreement",
      "message": "Hi John, please review and sign the attached agreement.",
      "redirectUrl": "https://example.com/thank-you"
    }
  }' \
  -F "files=@./contract.pdf;type=application/pdf"

Response

{
  "id": "envelope_abc123xyz"
}

Field Positioning

Field positions use percentage values (0-100) relative to the PDF page:

ParameterDescription
positionXHorizontal position from left edge (0 = left, 100 = right)
positionYVertical position from top edge (0 = top, 100 = bottom)
widthField width as percentage of page width
heightField height as percentage of page height
pagePage number (1-indexed)
identifierFile index (0 for first file) or filename

Field Types

TypeDescription
SIGNATURESignature field
INITIALSInitials field
NAMEAuto-filled recipient name
EMAILAuto-filled recipient email
DATESigning date
TEXTFree text input
NUMBERNumeric input
CHECKBOXCheckbox selection
RADIORadio button group
DROPDOWNDropdown selection

Recipient Roles

RoleDescription
SIGNERMust sign the document
APPROVERMust approve before signers can sign
CCReceives a copy but doesn't sign
VIEWERCan view the document but takes no action

Update Document

Update a document's properties. Only works on documents in DRAFT status.

POST /envelope/update

Request Body

FieldTypeRequiredDescription
envelopeIdstringYesDocument ID
dataobjectNoDocument properties to update
metaobjectNoEmail and signing settings to update

Code Examples

curl -X POST "https://app.documenso.com/api/v2/envelope/update" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "envelopeId": "envelope_abc123",
    "data": {
      "title": "Updated Service Agreement",
      "externalId": "contract-2025-001-v2"
    },
    "meta": {
      "subject": "Updated: Please sign this agreement",
      "redirectUrl": "https://example.com/signed"
    }
  }'

Send Document

Send a document to recipients for signing. This changes the status from DRAFT to PENDING.


POST /envelope/distribute

Request Body

FieldTypeRequiredDescription
envelopeIdstringYesDocument ID
metaobjectNoOverride email settings for this send

Code Examples

# Basic send
curl -X POST "https://app.documenso.com/api/v2/envelope/distribute" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "envelopeId": "envelope_abc123"
  }'

# Send with custom email settings
curl -X POST "https://app.documenso.com/api/v2/envelope/distribute" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "envelopeId": "envelope_abc123",
    "meta": {
      "subject": "Action Required: Sign Agreement",
      "message": "Please sign this document by end of day.",
      "timezone": "America/New_York"
    }
  }'

Response

The response includes signing URLs for each recipient:

{
  "success": true,
  "id": "envelope_abc123",
  "recipients": [
    {
      "id": 1,
      "name": "John Smith",
      "email": "signer@example.com",
      "token": "abc123xyz",
      "role": "SIGNER",
      "signingOrder": 1,
      "signingUrl": "https://app.documenso.com/sign/abc123xyz"
    }
  ]
}

Use the signingUrl to redirect recipients directly to the signing page, or let them use the email link.


Cancel Document

Cancel a pending document. This changes its status from PENDING to CANCELLED.

POST /envelope/cancel

Request Body

FieldTypeRequiredDescription
envelopeIdstringYesDocument ID
reasonstringNoReason for cancelling the document

Code Examples

curl -X POST "https://app.documenso.com/api/v2/envelope/cancel" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "envelopeId": "envelope_abc123",
    "reason": "The agreement is no longer needed."
  }'

Response

{
  "success": true
}

Behavior

  • Only documents in PENDING status can be cancelled. Other statuses return 400.
  • Cancellation is not idempotent. Cancelling the same document again returns 400.
  • The document owner and team members with MANAGER or higher permissions can cancel it. Requests for documents you cannot view return 404; requests for visible documents without sufficient permissions return 401.
  • A successful cancellation fires the DOCUMENT_CANCELLED webhook.
  • Cancellation emails are sent only to eligible non-CC, non-rejected recipients who were sent or opened the document.

Delete Document

Delete a document. Completed documents cannot be deleted.

POST /envelope/delete

Request Body

FieldTypeRequiredDescription
envelopeIdstringYesDocument ID

Code Examples

curl -X POST "https://app.documenso.com/api/v2/envelope/delete" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "envelopeId": "envelope_abc123"
  }'

Response

{
  "success": true
}

Get Multiple Documents

Retrieve multiple documents by their IDs in a single request.

POST /envelope/get-many

Request Body

FieldTypeRequiredDescription
idsobjectYesID selector containing type and ids
ids.typestringYesenvelopeId, documentId, or templateId
ids.idsarrayYes1-20 IDs: strings for envelopeId; numbers for documentId or templateId

Code Examples

curl -X POST "https://app.documenso.com/api/v2/envelope/get-many" \
  -H "Authorization: api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "ids": {
      "type": "envelopeId",
      "ids": ["envelope_abc123", "envelope_def456", "envelope_ghi789"]
    }
  }'

Response

{
  "data": [
    {
      "id": "envelope_abc123",
      "type": "DOCUMENT",
      "status": "PENDING",
      "title": "Service Agreement"
    }
  ]
}

The endpoint silently omits envelopes you cannot access instead of returning 404. Compare data.length with requestedIds.length to detect omissions.


Document Statuses

StatusDescription
DRAFTDocument is being prepared. Recipients have not been notified.
PENDINGDocument has been sent. Waiting for recipients to sign.
COMPLETEDAll recipients have signed. Document is sealed.
REJECTEDA recipient rejected the document.
CANCELLEDThe document was cancelled by its owner or a team member with MANAGER or higher permissions.

Status Transitions

  • DRAFT to PENDING: Call the distribute endpoint
  • PENDING to COMPLETED: All recipients complete their signing
  • PENDING to REJECTED: A recipient rejects the document
  • PENDING to CANCELLED: The document owner or a team member with MANAGER or higher permissions cancels the document

You cannot modify recipients or fields after a document moves to PENDING status.


Filtering and Pagination

Pagination Parameters

ParameterTypeDefaultDescription
pageinteger1Page number
perPageinteger10Results per page (max: 100)

Filter Parameters

ParameterValuesDescription
typeDOCUMENT, TEMPLATEFilter by envelope type
statusDRAFT, PENDING, COMPLETED, REJECTED, CANCELLEDFilter by status
sourceDOCUMENT, TEMPLATE, TEMPLATE_DIRECT_LINKFilter by creation source
folderIdstringFilter by folder

Sorting

ParameterValuesDescription
orderByColumncreatedAtField to sort by
orderByDirectionasc, descSort direction (default: desc)

Example: Fetch All Pending Documents

async function getAllPendingDocuments() {
  const documents = [];
  let page = 1;
  let hasMore = true;

  while (hasMore) {
    const response = await fetch(
      `https://app.documenso.com/api/v2/envelope?status=PENDING&page=${page}&perPage=100`,
      {
        headers: { Authorization: 'api_xxxxxxxxxxxxxxxx' },
      },
    );

    const { data, currentPage, totalPages } = await response.json();
    documents.push(...data);

    hasMore = currentPage < totalPages;
    page++;
  }

  return documents;
}

See Also

On this page