A role acts; a subject is described
A field has both. The spouse’s surname is filled in by the main member, so that field’s
role is
Main Member and its subject is spouse. A field with no subject (subject is null) belongs
to the document itself, like a policy number, or to the person signing it.
Declaring subjects on a template
Declare them insubjects on POST /api/v1/templates, or add
them in the editor’s Subjects rail. Each has three parts.
keyis the machine name:main_member,spouse,dependant_1. It must match the pattern^[a-z0-9_]+$and be at most 100 characters, and it is not lower-cased for you:Spouseis refused, and the refusal names the key that would be accepted. A key never changes once it exists, so it is the thing to match against your own records.labelis what people read: “Spouse”, “Dependant 1”. At most 200 characters (UTF-16 code units, after Unicode composition), never blank. It can be renamed at any time and the key stays put. Each subject’s label is its own. In aPOST /api/v1/templatesrequest, labels that differ only in case count as the same, because a signer would read the two as one person; the editor’s rail refuses an exact repeat.presenceisrequiredorconditional, and it is optional, defaulting torequired. More on this below.
Addressing a field to a subject
A field is addressed by a pair: itssubject and its data_key. first_name under spouse is a
different piece of information from first_name under main_member, and the two never collide.
- With a text tag, add
subject(...)with the subject’s key, not its label:<<text:Main Member:subject(spouse):key(first_name):First name>>. A tag naming a subject the template does not declare refuses the whole request, as an unknown role does. See Text tags. - In the editor, select the fields (drag a box around a whole section to select it at once) and pick the subject from the Subjects rail. A detected field has no subject until you give it one.
- In the template response,
GET /api/v1/templates/{templateId}reports every field’ssubjectanddata_key, and lists the template’s subjects bykeyandlabel. It does not report a subject’spresence, so keep your own note of which subjects you declaredconditional.
Filling a subject’s fields from an envelope
values on POST /api/v1/envelopes is a list of triples:
values[].subject, values[].key and values[].value. The subject and key together are the
address, and an address names a set of fields: every field at that address gets the value.
One main_member id_number fills the box on the application, the box on the declaration and
any other box with the same address.
Use null as the subject for a field that has none. A subject the template does not declare is
refused as value_subject_unknown, and an address that matches no field is refused
as value_address_unknown.
Present or absent
Each envelope records which of the template’s subjects it is about.- A
requiredsubject is on every envelope, and nobody can switch them off: a medical aid application is always about its main member. - A
conditionalsubject may be left off. A conditional subject is absent unless somebody says they are there.
- The template.
requiredmeans present;conditionalmeans absent. - You, when you create the envelope.
subjectsonPOST /api/v1/envelopesis a map from subject key totrueorfalse:{ "spouse": true, "dependant_2": false }. A subject you do not name keeps the template’s rule. A key the template does not declare is refused, and so isfalsefor arequiredsubject; both are 400invalid_request, and nothing is created. - The signer. Beside each conditional subject’s section, the signing page offers a control
labelled from the subject’s name, such as “Add spouse details”, and the signer can switch the
section on or off. It is offered to a recipient who has fields about that subject, and never to
a
cc.
- A value you locked is put back for every recipient who has not finished yet (a status of pending, sent or opened).
- Nothing a recipient typed is put back. The signer who switches the section on still sees their own answers on screen until they reload, and their next save stores them again. Anybody else with fields in the section fills them in again before they finish.
- ⚠️ Name as
trueevery conditional subject you prefill. A value for a conditional subject you did not name as present is handled in one of two ways, and which depends only on whethersubjectsis in the request at all:subjectssent, even{}: the subject is absent, byfalseor by the template’s rule, so the value contradicts the request and is refused asinvalid_request. Nothing is created.subjectsomitted: the value is accepted and stored, but the subject is absent by the template’s rule when the envelope is sent, so the prefilled section opens hidden until the signer switches it on.
- An envelope made without
subjects, such as a batch row or an envelope sent from the dashboard, opens with every conditional subject absent. The signer switches on the people who exist. - ⚠️ An envelope records who it is about once, and keeps it. Changing a subject’s presence
in the editor reaches only an envelope that has not recorded it yet: one sent afterwards, or a
draft made without
subjects, which records it when it is sent. An envelope already sent keeps what it was sent with. So does a draft created withsubjects, even{}: it recorded every subject when it was created, and sending it later changes none of them.
A worked example
A medical aid application about a main member, a spouse and up to two dependants, signed by the main member alone. The document carries tags like these, written in white so they do not print:Tags in the document
file is the document, base64-encoded; it is shortened here.)
POST /api/v1/templates
POST /api/v1/envelopes
dependant_2 is not named, so as a conditional subject it is
absent: its fields are hidden and nothing in them is required. If she has a second child after
all, she switches “Dependant 2” on and fills it in. Only Thandi is emailed, and only Thandi signs.
What a subject is not
- Not a recipient record, though the same person can be both. A subject and a recipient are
two different records. The subject record has no email address, and it is never emailed, given a
signing link or asked to sign: whoever fills in the section does it under their own role. The
same human can be both. In the worked example, Thandi is the
main_membersubject, whose details the document holds, and the recipient in theMain Memberrole, who signs it. She is emailed and signs as the recipient, not as the subject. - Not a count the signer chooses. The template fixes how many subjects there are, as the paper fixes how many rows it prints. A family with more dependants than the form has room for cannot add one.
- Not a heading the signer reads by key. The signing page names a subject by its label, never by its key.
- Not a condition, though a condition can read one. A subject hides its own fields with no condition written. For anything finer, a condition set in the editor can test whether a subject is present or absent.