Skip to Content

Update a document field

You're viewing API version 2026-09, which is deprecated and stops working on October 1, 2027. To move your integration, see Upgrading to 2026-10.
PATCH
/api/v1/documents/{id}/fields/{fieldId}

Update a document field's properties. Only DRAFT documents can have fields updated.

Field Identifier:

  • fieldId - Can be either database ID or key-based reference (prefix with key:)
  • Example: /api/v1/documents/{docId}/fields/key:recipient-name

Updatable Properties:

  • type - Field type (cannot change if field has data)
  • position - Field order/position
  • fieldMeta - Field-specific metadata
  • key - Unique key identifier for API access

Regular Field Updates (by ID): Pass the full field structure including type and complete fieldMeta for that field type.

Example - Update TEXT field:

PATCH /api/v1/documents/{docId}/fields/{fieldId}{  "type": "TEXT",  "fieldMeta": {    "type": "TEXT",    "content": "<p>Updated content</p>"  }}

Example - Update HTML field:

PATCH /api/v1/documents/{docId}/fields/{fieldId}{  "type": "HTML",  "fieldMeta": {    "type": "HTML",    "content": "<div style='text-align: center'><h1 style='color: #003366'>Contract Title</h1><img src='https://example.com/logo.png' alt='Company Logo' style='max-width: 200px' /><p>Custom styled content with <span style='color: red'>highlighted text</span></p></div>"  }}

Example - Update FORM field:

PATCH /api/v1/documents/{docId}/fields/{fieldId}{  "type": "FORM",  "fieldMeta": {    "type": "FORM",    "columns": 2,    "fields": [...]  }}

Key-Based Updates for FORM Subfields: For FORM fields with subfield keys, use key:your-field-key as the fieldId to update a specific subfield by its key.

When updating a FORM subfield by key, only pass the fieldMeta property with the subfield's metadata structure. All other properties (type, position, key) are ignored.

Example - Update FORM subfield value:

PATCH /api/v1/documents/{docId}/fields/key:name{  "fieldMeta": {    "type": "input",    "value": "Andreas"  }}

This will update only the value property of the subfield with key "name", preserving all other properties like label, placeholder, and description.

Authorization

headerAuthorizationBearer <token>

Personal API key, e.g. Authorization: Bearer sajn_sk_.... Not scope-limited — acts as the issuing user.

Path Parameters

id*string
fieldId*string

Header Parameters

authorization*string

Bearer token for API authentication

Idempotency-Key?string

Makes retries safe. A retry with the same key and the same request replays the stored response for 24 hours (header Idempotent-Replayed: true); the same key with a different request returns 400.

Lengthlength <= 255

Request Body

Body

application/json
  1. body
type?string

Field type

Value in"TEXT""HTML""FORM""PDF""PRODUCT_TABLE""TABLE""SPACER""PAGE_BREAK""DURATION"
position?number

Field position/order

key?string

Unique key identifier for API access

Match^[a-z0-9_-]*$
fieldMeta?|||||||||

Field-specific metadata. By id: the full metadata for the field type. For FORM subfield updates via the key: prefix, pass the subfield structure to merge (e.g., {"type": "input", "value": "new value"}).

Response Body

Error response

application/json
  1. response

Error response

message*string

Error message describing what went wrong

code?string

Machine-readable error code (e.g. APPROVAL_REQUIRED)

errorId?string

Identifier for this occurrence — quote it to support when reporting a 500

issues?array<>

Every validation issue, on a 400 for an invalid request

requiredScopes?array<string>

OAuth scopes the endpoint requires, on a 403 for a missing scope

grantedScopes?array<string>

OAuth scopes the token was granted, on a 403 for a missing scope

Example Request
curl -X PATCH 'https://app.sajn.se/api/v1/documents/string/fields/string' \  -H 'authorization: string' \  -H 'Content-Type: application/json' \  -d '{}'
Example Response
{  "message": "string",  "code": "string",  "errorId": "string",  "issues": [    {      "path": "string",      "message": "string"    }  ],  "requiredScopes": [    "string"  ],  "grantedScopes": [    "string"  ]}

Was this page helpful?