Skip to Content

Update multiple FORM subfields by key in one request

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

Update several FORM subfield values by key in a single atomic request. Only DRAFT documents can have fields updated.

Use this instead of looping single-key PATCH .../fields/key:<key> calls. Because all FORM subfields share one underlying field row, concurrent single-key requests read-modify-write the same row and overwrite each other (lost updates). This endpoint applies all changes against one read per affected field, so nothing is clobbered.

Body:

PATCH /api/v1/documents/{docId}/fields{  "updates": [    { "key": "name",  "fieldMeta": { "type": "input", "value": "Andreas" } },    { "key": "phone", "fieldMeta": { "type": "input", "value": "070-1234567" } },    { "key": "email", "fieldMeta": { "type": "input", "value": "a@example.com" } }  ]}

Each entry's fieldMeta is merged into the existing subfield metadata (preserving label, placeholder, description, etc.), identical to the single-key endpoint. Max 50 updates per request.

Response: Returns a per-key result array so partial failures (e.g. an unknown key) are reported individually while valid updates still apply. success is true only when every update succeeded.

Authorization

headerAuthorizationBearer <token>

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

Path Parameters

id*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
updates*array<>

Array of field updates (max 50)

Items1 <= items <= 50

Response Body

200

application/json
  1. response
success*boolean

Whether all updates succeeded

updated*number

Number of fields successfully updated

results*array<>

Per-field update results

Example Request
curl -X PATCH 'https://app.sajn.se/api/v1/documents/string/fields' \  -H 'authorization: string' \  -H 'Content-Type: application/json' \  -d '{  "updates": [    {      "key": "string",      "fieldMeta": null    }  ]}'
Example Response
{  "success": true,  "updated": 0,  "results": [    {      "key": "string",      "success": true,      "error": "string"    }  ]}

Was this page helpful?