Skip to main content
API v1 is deprecated. For new integrations, please use API v2.

Overview

Fields are interactive elements placed on document pages that recipients need to fill out or sign. Each field is assigned to a specific recipient and positioned using percentage-based coordinates.

Field Object

{
  "id": 1,
  "documentId": 123,
  "recipientId": 456,
  "type": "SIGNATURE",
  "pageNumber": 1,
  "pageX": 10,
  "pageY": 80,
  "pageWidth": 30,
  "pageHeight": 5,
  "customText": "",
  "fieldMeta": {
    "type": "signature",
    "required": true
  },
  "inserted": false
}

Properties

FieldTypeDescription
idnumberUnique field identifier
documentIdnumberID of the parent document
recipientIdnumberID of the recipient assigned to this field
typestringField type (see Field Types)
pageNumbernumberPage number (1-indexed)
pageXnumberX position as percentage (0-100)
pageYnumberY position as percentage (0-100)
pageWidthnumberWidth as percentage of page (0-100)
pageHeightnumberHeight as percentage of page (0-100)
customTextstringValue entered by recipient
fieldMetaobject | nullType-specific configuration
insertedbooleanWhether field has been completed

Field Types

Signature Fields

TypeDescriptionAuto-filled
SIGNATUREFull signature (drawn, typed, or uploaded)No
FREE_SIGNATUREUnrestricted signature fieldNo
INITIALSRecipient’s initialsNo

Auto-filled Fields

TypeDescriptionValue
NAMERecipient’s full nameFrom recipient object
EMAILRecipient’s emailFrom recipient object
DATECurrent date when field is completedAuto-generated

Form Fields

TypeDescriptionValidation
TEXTFree-form text inputOptional
NUMBERNumeric inputOptional min/max
CHECKBOXMultiple selectionsRequired items
RADIOSingle selection from optionsRequired
DROPDOWNDropdown selectionRequired

Add Field

Add one or more fields to a document in DRAFT status.
POST /api/v1/documents/:id/fields

Path Parameters

ParameterTypeDescription
idnumberThe document ID

Request Body

You can add a single field or multiple fields in one request: Single Field:
FieldTypeRequiredDescription
recipientIdnumberYesID of recipient for this field
typestringYesField type
pageNumbernumberYesPage number (1-indexed)
pageXnumberYesX position (0-100)
pageYnumberYesY position (0-100)
pageWidthnumberYesWidth (0-100)
pageHeightnumberYesHeight (0-100)
fieldMetaobjectNoType-specific options
Multiple Fields: Pass an array of field objects with the same schema.

Positioning Guide

Field positions use percentages relative to the PDF page:
  • pageX: Horizontal position from left edge (0 = left, 100 = right)
  • pageY: Vertical position from top edge (0 = top, 100 = bottom)
  • pageWidth: Field width as percentage of page width
  • pageHeight: Field height as percentage of page height
(0,0)                    (100,0)
  ┌─────────────────────────┐
  │                         │
  │    (10,20)              │
  │    ┌────────┐           │
  │    │ Field  │           │
  │    └────────┘           │
  │                         │
  └─────────────────────────┘
(0,100)                  (100,100)

Code Examples

# Add a single signature field
curl -X POST "https://app.documenso.com/api/v1/documents/123/fields" \
  -H "Authorization: Bearer api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "SIGNATURE",
    "recipientId": 1,
    "pageNumber": 1,
    "pageX": 10,
    "pageY": 80,
    "pageWidth": 30,
    "pageHeight": 5,
    "fieldMeta": {}
  }'

# Add multiple fields at once
curl -X POST "https://app.documenso.com/api/v1/documents/123/fields" \
  -H "Authorization: Bearer api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '[
    {
      "type": "SIGNATURE",
      "recipientId": 1,
      "pageNumber": 1,
      "pageX": 10,
      "pageY": 80,
      "pageWidth": 30,
      "pageHeight": 5,
      "fieldMeta": {}
    },
    {
      "type": "DATE",
      "recipientId": 1,
      "pageNumber": 1,
      "pageX": 50,
      "pageY": 80,
      "pageWidth": 20,
      "pageHeight": 3,
      "fieldMeta": {}
    },
    {
      "type": "TEXT",
      "recipientId": 1,
      "pageNumber": 1,
      "pageX": 10,
      "pageY": 70,
      "pageWidth": 40,
      "pageHeight": 4,
      "fieldMeta": {
        "type": "text",
        "label": "Job Title",
        "required": true
      }
    }
  ]'

Response

{
  "fields": {
    "id": 1,
    "documentId": 123,
    "recipientId": 1,
    "type": "SIGNATURE",
    "pageNumber": 1,
    "pageX": 10,
    "pageY": 80,
    "pageWidth": 30,
    "pageHeight": 5,
    "customText": "",
    "fieldMeta": {},
    "inserted": false
  },
  "documentId": 123
}
For multiple fields, the response includes an array in the fields property.
You can only add fields to documents in DRAFT status. Once sent, fields cannot be added or modified.

Update Field

Update a field’s position or configuration before the document is sent.
PATCH /api/v1/documents/:id/fields/:fieldId

Path Parameters

ParameterTypeDescription
idnumberThe document ID
fieldIdnumberThe field ID

Request Body

All fields are optional. Only include what you want to update:
FieldTypeDescription
recipientIdnumberReassign to different recipient
typestringChange field type
pageNumbernumberMove to different page
pageXnumberUpdate X position
pageYnumberUpdate Y position
pageWidthnumberUpdate width
pageHeightnumberUpdate height
fieldMetaobjectUpdate configuration

Code Examples

# Move field position
curl -X PATCH "https://app.documenso.com/api/v1/documents/123/fields/1" \
  -H "Authorization: Bearer api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "pageX": 20,
    "pageY": 75
  }'

# Resize field
curl -X PATCH "https://app.documenso.com/api/v1/documents/123/fields/1" \
  -H "Authorization: Bearer api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "pageWidth": 40,
    "pageHeight": 6
  }'

# Reassign to different recipient
curl -X PATCH "https://app.documenso.com/api/v1/documents/123/fields/1" \
  -H "Authorization: Bearer api_xxxxxxxxxxxxxxxx" \
  -H "Content-Type: application/json" \
  -d '{
    "recipientId": 2
  }'

Response

Returns the updated field object.

Remove Field

Delete a field from a document in DRAFT status.
DELETE /api/v1/documents/:id/fields/:fieldId

Path Parameters

ParameterTypeDescription
idnumberThe document ID
fieldIdnumberThe field ID

Code Examples

curl -X DELETE "https://app.documenso.com/api/v1/documents/123/fields/1" \
  -H "Authorization: Bearer api_xxxxxxxxxxxxxxxx"

Response

Returns the deleted field object.

Field Metadata

Different field types support different metadata configurations.

Text Field Metadata

{
  "type": "text",
  "label": "Job Title",
  "placeholder": "Enter your job title",
  "required": true,
  "characterLimit": 100
}

Number Field Metadata

{
  "type": "number",
  "label": "Salary",
  "required": true,
  "numberFormat": "CURRENCY",
  "minValue": 0,
  "maxValue": 1000000
}

Checkbox Field Metadata

{
  "type": "checkbox",
  "label": "Skills",
  "required": true,
  "values": [
    { "value": "JavaScript", "checked": false },
    { "value": "TypeScript", "checked": false },
    { "value": "Python", "checked": false }
  ],
  "validationRule": "AT_LEAST_ONE",
  "validationLength": 1
}

Radio Field Metadata

{
  "type": "radio",
  "label": "Employment Type",
  "required": true,
  "values": [
    { "value": "Full-time", "checked": false },
    { "value": "Part-time", "checked": false },
    { "value": "Contract", "checked": false }
  ]
}
{
  "type": "dropdown",
  "label": "Department",
  "required": true,
  "values": [
    { "value": "Engineering" },
    { "value": "Sales" },
    { "value": "Marketing" },
    { "value": "Operations" }
  ],
  "defaultValue": "Engineering"
}

Signature Field Metadata

{
  "type": "signature",
  "required": true
}

Common Field Patterns

Standard Signature Block

const standardSignature = [
  {
    type: 'SIGNATURE',
    recipientId: 1,
    pageNumber: 1,
    pageX: 10,
    pageY: 85,
    pageWidth: 30,
    pageHeight: 5,
    fieldMeta: {},
  },
  {
    type: 'NAME',
    recipientId: 1,
    pageNumber: 1,
    pageX: 10,
    pageY: 90,
    pageWidth: 30,
    pageHeight: 3,
    fieldMeta: {},
  },
  {
    type: 'DATE',
    recipientId: 1,
    pageNumber: 1,
    pageX: 50,
    pageY: 85,
    pageWidth: 20,
    pageHeight: 3,
    fieldMeta: {},
  },
];

await client.createField({
  params: { id: documentId.toString() },
  body: standardSignature,
});

Form with Validation

const employeeForm = [
  {
    type: 'TEXT',
    recipientId: 1,
    pageNumber: 1,
    pageX: 10,
    pageY: 20,
    pageWidth: 40,
    pageHeight: 4,
    fieldMeta: {
      type: 'text',
      label: 'Full Name',
      required: true,
      characterLimit: 100,
    },
  },
  {
    type: 'NUMBER',
    recipientId: 1,
    pageNumber: 1,
    pageX: 10,
    pageY: 30,
    pageWidth: 20,
    pageHeight: 4,
    fieldMeta: {
      type: 'number',
      label: 'Employee ID',
      required: true,
      minValue: 1000,
      maxValue: 99999,
    },
  },
  {
    type: 'DROPDOWN',
    recipientId: 1,
    pageNumber: 1,
    pageX: 10,
    pageY: 40,
    pageWidth: 30,
    pageHeight: 4,
    fieldMeta: {
      type: 'dropdown',
      label: 'Department',
      required: true,
      values: [
        { value: 'Engineering' },
        { value: 'Sales' },
        { value: 'Marketing' },
      ],
    },
  },
];

Complete Example

import { initClient } from '@ts-rest/core';
import { ApiContractV1 } from '@documenso/api/v1/contract';
import fs from 'fs';

const client = initClient(ApiContractV1, {
  baseUrl: 'https://app.documenso.com/api/v1',
  baseHeaders: {
    authorization: 'Bearer api_xxxxxxxxxxxxxxxx',
  },
});

async function createDocumentWithFields() {
  // 1. Create document
  const { body: createBody } = await client.createDocument({
    body: {
      title: 'Employment Agreement',
      recipients: [
        {
          name: 'John Doe',
          email: 'john@example.com',
          role: 'SIGNER',
        },
      ],
    },
  });

  const { uploadUrl, documentId, recipients } = createBody;
  const recipientId = recipients[0].recipientId;

  // 2. Upload PDF
  const pdfBuffer = fs.readFileSync('./employment-agreement.pdf');
  await fetch(uploadUrl, {
    method: 'PUT',
    headers: { 'Content-Type': 'application/octet-stream' },
    body: pdfBuffer,
  });

  // 3. Add multiple fields
  await client.createField({
    params: { id: documentId.toString() },
    body: [
      // Signature block
      {
        type: 'SIGNATURE',
        recipientId,
        pageNumber: 5,
        pageX: 10,
        pageY: 85,
        pageWidth: 30,
        pageHeight: 5,
        fieldMeta: {},
      },
      {
        type: 'NAME',
        recipientId,
        pageNumber: 5,
        pageX: 10,
        pageY: 90,
        pageWidth: 30,
        pageHeight: 3,
        fieldMeta: {},
      },
      {
        type: 'DATE',
        recipientId,
        pageNumber: 5,
        pageX: 50,
        pageY: 85,
        pageWidth: 20,
        pageHeight: 3,
        fieldMeta: {},
      },
      // Form fields
      {
        type: 'TEXT',
        recipientId,
        pageNumber: 1,
        pageX: 10,
        pageY: 30,
        pageWidth: 40,
        pageHeight: 4,
        fieldMeta: {
          type: 'text',
          label: 'Job Title',
          required: true,
        },
      },
      {
        type: 'DROPDOWN',
        recipientId,
        pageNumber: 1,
        pageX: 10,
        pageY: 40,
        pageWidth: 30,
        pageHeight: 4,
        fieldMeta: {
          type: 'dropdown',
          label: 'Department',
          required: true,
          values: [
            { value: 'Engineering' },
            { value: 'Sales' },
            { value: 'Marketing' },
          ],
        },
      },
    ],
  });

  // 4. Send document
  await client.sendDocument({
    params: { id: documentId.toString() },
    body: { sendEmail: true },
  });

  console.log('Document created and sent with all fields!');
}

createDocumentWithFields().catch(console.error);

Best Practices

Add all fields for a recipient in a single batch request:
// Good: Single request
await client.createField({
  params: { id: '123' },
  body: [field1, field2, field3],
});

// Avoid: Multiple requests
await client.createField({ params: { id: '123' }, body: field1 });
await client.createField({ params: { id: '123' }, body: field2 });
await client.createField({ params: { id: '123' }, body: field3 });

2. Use Consistent Positioning

Maintain consistent alignment and spacing:
const leftMargin = 10;
const rightMargin = 10;
const lineHeight = 5;

const fields = [
  {
    type: 'SIGNATURE',
    pageX: leftMargin,
    pageY: 80,
    pageWidth: 30,
    pageHeight: lineHeight,
  },
  {
    type: 'DATE',
    pageX: 100 - rightMargin - 20,
    pageY: 80,
    pageWidth: 20,
    pageHeight: lineHeight,
  },
];

3. Validate Field Metadata

Ensure metadata matches the field type:
function getFieldMeta(type: string) {
  switch (type) {
    case 'TEXT':
      return { type: 'text', required: true };
    case 'NUMBER':
      return { type: 'number', required: true };
    case 'CHECKBOX':
      return { type: 'checkbox', values: [], required: true };
    default:
      return {};
  }
}

4. Test Field Positions

Before sending to recipients, test field positioning:
  1. Create a test document
  2. Add fields
  3. Use the signing URL to preview
  4. Adjust positions as needed
  5. Delete the test document

See Also