partyId in its fieldMeta belongs to that party: it’s empty when you send the document, and the party fills it in on the signing page. A subfield without a partyId is yours: you fill it in, and the party sees the value as read-only text.
Before you begin
- Store your API key in the
SAJN_API_KEYenvironment variable. To create a key, go to workspace settings in the sajn app, then Utvecklare (Developer) > API-nycklar (API keys). - Have a
DRAFTdocument with at least oneSIGNERparty, and the party’sid. For more information, see Create a document.
Add a form with party inputs
1
Create the FORM field
Send a Replace the following:
POST request to /api/v1/documents/DOCUMENT_ID/fields with the FORM field in a fields array. Each subfield has an id that’s unique in the form, a row and column in the grid, and its own fieldMeta. The following form has two values you fill in and two inputs for the party:DOCUMENT_ID: the ID of the draft document.PARTY_ID: theidof the party who fills in the inputs.
data. position is the field’s 0-based place among the document’s content blocks.A subfield’s key lets you fill it in later without knowing the field ID. Keys can contain lowercase letters, digits, hyphens, and underscores.2
Change your values before sending
To change the values you fill in, use Fill in values on a document with the subfield keys. It writes every value in one request:The response lists the outcome for each key in
results. A value that the party fills in, such as address, is read-only through this endpoint: its result has success set to false and an error with the code INVALID_STATE. The other values in the request are still written.3
Send the document
Send the document as usual. On the signing page, the party sees
Company and Role as text, and Home address and Preferred start date as inputs. The party can’t sign until every required input is filled in.After signing, the values are on the document. Read them with List the fillable values on a document. The values are in data, and each value the party filled in has filledBy set to SIGNER and the partyId of that party.Subfield types
The subfield type isfieldMeta.type, in uppercase. Every type takes label, placeholder, description, partyId, and required:
INPUT: a single-line text input. The value is invalue.TEXT: a text area.rowssets its height, from 2 to 20.NUMBER: a number input.DATEPICKER: a date picker.SELECT: a drop-down list. Setoptionsto a list such as[{ "value": "Engineering" }, { "value": "Sales" }], and optionallydefaultValue.RADIO: one choice fromoptions.CHECKBOX: any number of choices fromoptions. The selected values are invalues.ATTACHMENT: a file that the party uploads.allowedTypestakesPDFandIMAGE. After the upload,valueis{ filename, mimeType, size }.
input, fails with 400 VALIDATION_FAILED.
Give each party their own inputs
When a document has several signing parties, set each subfield’spartyId to the party who owns it. A party can only fill in their own inputs. Another party’s inputs show as empty until that party fills them in. For the signing order, see Multi-party signing.
Change who fills in a subfield
To move a subfield to another party, or back to yourself, update the FORM field that holds it. APATCH request replaces the field’s whole fieldMeta, so start from the stored one:
- To find the FORM field by the subfield’s key, call
GET /api/v1/documents/DOCUMENT_ID/fields?key=address. The field is indata. - In its
fieldMeta.fields, change the subfield’spartyId. To fill the subfield in yourself, setpartyIdtonulland setvalue. - Send the whole
fieldMetato Update a document field:
FIELD_ID with the FORM field’s id. The response is the updated FORM field. A field is addressed by its ID only; to change a value without changing who fills it in, use Fill in values on a document instead.
Handle errors
400 VALIDATION_FAILED: a subfield is invalid, for example withoutrow, with an unknown or lowercasetype, or withsignerIdinstead ofpartyId. Readissuesfor the path.409 INVALID_STATE: the document isn’t aDRAFT. Fields can change only before sending.404 NOT_FOUND: no field on the document has the ID.
Next steps
Place fields on a PDF
Put inputs and signature boxes on an uploaded PDF.
Templates and forms
Reuse a form across documents.
Fields
Learn how the field model works.
Create document fields
See every field type in the API reference.

