curl --request PATCH \
--url https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"position": 123,
"key": "<string>",
"fieldMeta": {
"type": "TEXT",
"content": "<string>",
"locked": true,
"hidden": true
}
}
'import requests
url = "https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}"
payload = {
"position": 123,
"key": "<string>",
"fieldMeta": {
"type": "TEXT",
"content": "<string>",
"locked": True,
"hidden": True
}
}
headers = {
"authorization": "<authorization>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
authorization: '<authorization>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
position: 123,
key: '<string>',
fieldMeta: {type: 'TEXT', content: '<string>', locked: true, hidden: true}
})
};
fetch('https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'position' => 123,
'key' => '<string>',
'fieldMeta' => [
'type' => 'TEXT',
'content' => '<string>',
'locked' => true,
'hidden' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}"
payload := strings.NewReader("{\n \"position\": 123,\n \"key\": \"<string>\",\n \"fieldMeta\": {\n \"type\": \"TEXT\",\n \"content\": \"<string>\",\n \"locked\": true,\n \"hidden\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}")
.header("authorization", "<authorization>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"position\": 123,\n \"key\": \"<string>\",\n \"fieldMeta\": {\n \"type\": \"TEXT\",\n \"content\": \"<string>\",\n \"locked\": true,\n \"hidden\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["authorization"] = '<authorization>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"position\": 123,\n \"key\": \"<string>\",\n \"fieldMeta\": {\n \"type\": \"TEXT\",\n \"content\": \"<string>\",\n \"locked\": true,\n \"hidden\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}Update a document field
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 withkey:)- Example:
/api/v1/documents/{docId}/fields/key:recipient-name
Updatable Properties:
type- Field type (cannot change if field has data)position- Field order/positionfieldMeta- Field-specific metadatakey- 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.
curl --request PATCH \
--url https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'authorization: <authorization>' \
--data '
{
"position": 123,
"key": "<string>",
"fieldMeta": {
"type": "TEXT",
"content": "<string>",
"locked": true,
"hidden": true
}
}
'import requests
url = "https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}"
payload = {
"position": 123,
"key": "<string>",
"fieldMeta": {
"type": "TEXT",
"content": "<string>",
"locked": True,
"hidden": True
}
}
headers = {
"authorization": "<authorization>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {
authorization: '<authorization>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
position: 123,
key: '<string>',
fieldMeta: {type: 'TEXT', content: '<string>', locked: true, hidden: true}
})
};
fetch('https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'position' => 123,
'key' => '<string>',
'fieldMeta' => [
'type' => 'TEXT',
'content' => '<string>',
'locked' => true,
'hidden' => true
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"authorization: <authorization>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}"
payload := strings.NewReader("{\n \"position\": 123,\n \"key\": \"<string>\",\n \"fieldMeta\": {\n \"type\": \"TEXT\",\n \"content\": \"<string>\",\n \"locked\": true,\n \"hidden\": true\n }\n}")
req, _ := http.NewRequest("PATCH", url, payload)
req.Header.Add("authorization", "<authorization>")
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.patch("https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}")
.header("authorization", "<authorization>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"position\": 123,\n \"key\": \"<string>\",\n \"fieldMeta\": {\n \"type\": \"TEXT\",\n \"content\": \"<string>\",\n \"locked\": true,\n \"hidden\": true\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.sajn.se/api/v1/documents/{id}/fields/{fieldId}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["authorization"] = '<authorization>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"position\": 123,\n \"key\": \"<string>\",\n \"fieldMeta\": {\n \"type\": \"TEXT\",\n \"content\": \"<string>\",\n \"locked\": true,\n \"hidden\": true\n }\n}"
response = http.request(request)
puts response.read_body{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}{
"message": "<string>",
"code": "<string>",
"errorId": "<string>"
}Authorizations
OAuth 2.0 access token for a connected application. Limited to the scopes granted at consent.
Headers
Bearer token for API authentication
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.
255Body
Body
Field type
TEXT, HTML, FORM, PDF, PRODUCT_TABLE, TABLE, SPACER, PAGE_BREAK, DURATION Field position/order
Unique key identifier for API access
^[a-z0-9_-]*$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"}).
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
Show child attributes
Show child attributes
Was this page helpful?

