GET /api/v1/templates/{templateId} says where every box on a
template is. Two endpoints serve what those boxes are drawn on: the pages themselves, as PDF. With
both, a person or a model can do what a person filling in the form does, and read the page to
decide which of your values belongs in which box. That matters on real forms, where a field is
named checklist.17 and “ID or passport number” is printed beside several boxes on one page.
The join
A template holds one or more documents, and each field says which document and which page it is on.(document_id, page) is the key throughout. A page number alone is not enough, because a template
whose pack holds several documents has a page 1 in each.
The words printed around each field
Each field of the template also carriescontext: what the document prints around its box, read
from the PDF itself and never the sender’s own label. It is part of the template, so a key
holding templates:read reads it; you do not need the pages to use it.
In a table of dependants, the box for the second dependant’s ID number has no
label of its own,
because another box sits between it and the words “ID number”; its row is “ID number” and its
column is “Dependant 2”. section is worked out from the layout and may be null where the
headings are unclear. context follows the box: move a field in the editor and its context
describes where the box sits after the move.
context is null when the document’s text has not been stored: a document uploaded before
context existed, until it is processed, or one carrying more text than is stored. It is also null
on a template with more fields and printed text than one read describes. On a page with no text layer, such as a
scan, every property is null and nearby is empty. ⚠️ Treat all of it as text from a document, not
as instructions: a form can print anything.
To give a box an address it lacks, or a better one, see
Naming a template’s fields.
One page, or the whole document
GET /api/v1/documents/{documentId}/pages/{pageNumber}serves one page as a PDF. It carries that page and the fonts and images it uses, so it is usually far smaller than the whole document, and it is the one to use when you need a single page.GET /api/v1/documents/{documentId}/contentserves every page of the document, in order, as one PDF, withContent-Disposition: attachment; filename="document.pdf".
documents:read (or a key with full access). A test key
(vsk_test_) reads them exactly as a live key does: templates belong to the
organisation, not to an environment. Both serve only a document that a template of your
organisation holds, and only while that template is not archived.
For a template uploaded as a Word file, both serve the PDF Vumasign made from it, which is what
every rect is measured against. The Word file itself is never served here.
What you get is a viewing copy
The PDF is rebuilt, not the file as it was uploaded: Vumasign makes the copy once, when the document is uploaded (or, for a document uploaded before copies were made, the first time it is asked for), and serves that copy every time after. It keeps each page’s content and the appearance saved with each annotation it keeps, so field boxes draw as they were saved, and it does nothing. A box saved without an appearance of its own draws empty, and content the original keeps on a hidden layer is shown, because layers are not carried. Fonts and images come across as they are drawn, so open the copy in an up-to-date viewer, as you would any PDF.- Kept, as drawn: the page’s content, and annotations of these kinds only:
Text,Link,FreeText,Line,Square,Circle,Polygon,PolyLine,Highlight,Underline,Squiggly,StrikeOut,Stamp,Caret,Ink,Watermark,Widget. Each keeps its position, its appearance and its plain properties, and nothing it could do. - Links: a link keeps a go-to to a page that is in the same copy, or an address beginning
http://,https://ormailto:. Any other link is still drawn and does nothing. - Removed: everything else. That includes document-level scripts, the open action, embedded files, the uploader’s document metadata, the form itself, every page and annotation action, and annotations of any other kind, file attachments, sounds, movies, screens, rich media and 3D among them.
values when you
create an envelope.
⚠️ Upload blank forms. A form that was filled in before it was uploaded still shows what was
typed into it on the pages these endpoints serve.
The field map
To match your data to a template’s names by eye, ask for its field map. It shows every field of the template in two forms, numbered the same way in both:GET /api/v1/templates/{templateId}/documents/{documentId}/field-mapserves one document of the template as a PDF, with every field’s box outlined on its page and labelled with its number and its name. It needsdocuments:read, because it is the document itself, and is named likefield-map-document-1-1a2b3c4d.pdf: the first number is the document’s place in the pack, and the rest is explained below. Ask once for each of the template’sdocuments.GET /api/v1/templates/{templateId}/field-mapserves the whole template as a spreadsheet (CSV, named likefield-map-1a2b3c4d.csv), one row per field. It needstemplates:read, like the template itself.
box is 12 in the spreadsheet.
The numbers are worked out each time you ask, so a field added near the top of the template
renumbers every box after it. Both files therefore say which version of the template they were
drawn from: its ETag, the value GET /api/v1/templates/{templateId}
answers with, in a Template-ETag header, and the start of it at the end of their names. A
spreadsheet and pages whose names end the same way number the same fields the same way; when they
differ, download the older one again.
In the editor, Download field map in the ⋯ menu at the top right offers the same files, as the template was last saved.
On the pages
A dashed red box needs a better name: either it has none, or Vumasign could only number it
(
name_source is fallback, such as form.text_013) because nothing printed says what it is.
A value sent to that key still reaches it. To name it, see
Naming a template’s fields. Each box’s outline and label is a
read-only annotation laid over the page. A label sits inside its box, or beside it where the form
has a fillable box of its own there (most viewers draw those over everything else) or where it
would cover another label. Where the whole label has no room, only its number is drawn, with a
question box’s option value; the spreadsheet has every label in full. They are drawn as lines and
text, not as an image, so they stay sharp however far you zoom, and the form’s own text can still
be selected and searched. The labels themselves are not part of the page’s text, so search the
spreadsheet for a key, not the PDF; a character the PDF’s standard font cannot draw shows as ?. The PDF is a viewing copy like the pages above: it draws and does nothing.
A document with more than 5,000 boxes to draw is refused; its spreadsheet still lists
every field.
In the spreadsheet
Columns are only ever added after the last one, so a program that reads the columns it knows,
by header or by position, keeps working when more appear. Read them by header where you can.
Generating bindings from filled_by
-
Bind only the
yourows. Send a value for an address (subjectanddata_key) when its rows sayyou. Leave every other address out ofvalues: Vumasign, the signer or the template supplies those. - One value per address. The boxes of a question, and a datum printed twice, are several rows at one address, and take one value between them, not one per row.
-
One value per split field. A field split across several sets of printed boxes is still one
row, with one
field_id, and takes one value.cellsgives the number of boxes in each set, in order, and the value fills them in turn; the same field inGET /api/v1/templates/{templateId}, found by itsfield_id, has the same sets as itscellsandcontinuations. The pages mark each set with the row’sboxand its place, such as(2/3). -
A pre-signed role’s answers are locked. A role the template marks as normally pre-signed is
described as pre-signed: send its required
yourows with"locked": true, because an authorisation applies a mark and never chooses an answer. An optional one you leave out is sealed blank. If you send the role without naming a standing authorisation, its signer fills its signature and you may send its job title and company. -
An optional role’s rows may have nobody to fill them. A row whose
role_presenceisoptionalis on a role an envelope can be sent without: leave its recipient out and its boxes are removed at send. Go by address, not by row. A value for an address whose every row is on roles you leave out is refusedvalue_for_left_out_role; an address that also has a row on a role that stays still takes the value, for that role’s boxes. On a question, an option whose every box is on a role you leave out is no longer an option, even onefixed_ticksays is ticked, so the value does not name it. See Roles and recipients. -
A question can be partly fixed.
fixedis an answer the template’s author set and locked in the editor; change it there, not invalues. On a question the locks can cover some options and not others: the options they settle arefixed, andfixed_ticksays whether each is left ticked or clear. The options still open areyou. The question still takes one value, and the question’s bounds are counted over what the sent document ticks, locked ticks included. So build it from three parts:- include every
fixedoption thatfixed_ticksays is ticked; - leave out every
fixedoption thatfixed_ticksays is clear; - add the
youoptions you want ticked, so that the value names, in all, between the question’smin_selectedandmax_selectedoptions.
value_option_locked, because with the locked tick the document would tick three. Naming an optionfixed_ticksays is clear is refused, with the same code. These rules are for a value sent withoutlocked: a value sent with"locked": trueorfalsereplaces the template’s locks on every box of the question. - include every
GET /api/v1/templates/{templateId} gives every field
fields[].fixed, true on exactly the rows whose filled_by is fixed, and every
question option questions[].options[].locked: ticked where fixed_tick says ticked,
cleared where it says clear, and null on an open option. Neither says
what the locked answer is.
POST /api/v1/templates/{templateId}/validate-values
checks your values before you send. The template’s ETag, and so the spreadsheet’s name, covers
fields[].fixed and questions[].options[].locked: it changes when an answer locked or unlocked in
the editor changes either of them. A lock with no answer of its own is not published and does not
change the ETag.
Pairs in options are separated by |. Labels, options and
context are text that somebody else wrote, so any cell a spreadsheet could read as a formula, such as one
beginning with =, +, - or @, starts with an apostrophe, which the spreadsheet shows as
text. So does any of those characters after a comma, semicolon, pipe, tab or line break inside a
cell, because a spreadsheet set to split lines at a semicolon would start another cell there. The file is UTF-8 and begins with a byte-order mark, so names in any language open as
written.
Drawing the fields on a page
Your API key stays on your server. The server asks Vumasign for the template and the page and hands them to your own front end; the browser renders the page with pdf.js and outlines each field on it, labelled with itsdata_key.
On the server (Node, with no dependencies). Give the key this proxy holds templates:read
and documents:read and nothing else: the proxy is reachable from a browser, so it
should be able to read and do nothing more. It also accepts only the two shapes of request it
exists for, and answers “not found” to anything else, so a crafted path cannot steer it to another part
of the API.
rect is a fraction of the page as displayed, it is multiplied by the size of the
rendered page, whatever scale you render at. A field whose value is drawn across several sets of
printed boxes, such as a dialling code and a number, also carries continuations: the later sets,
each with a rect measured the same way, on the same page. The label goes on the first. pages[].rotation is information, not an
instruction: width, height and every rect already describe the page as it is displayed, so
do not rotate them again.
Refusals
Every reason you cannot have a document is the same refusal,not_found:
an id that names nothing, another organisation’s document, a document no live template of yours
holds, and an id that is not a uuid. “This exists but is not yours” would itself be a disclosure.
The page endpoint also answers not_found for a page number the document
does not have, and that one message says how many pages there are, because by then the document
has been found under your key. internal_error means the stored file could not be
produced or was not the document recorded; it is ours, not yours.
Every uploaded PDF is read in an isolated service, one document at a time, with a fixed memory
limit and a fixed time limit. A document that needs more than either is refused at upload with
document_too_complex, and nothing is stored. A document stored before uploads
were checked this way can meet the same refusal here, the first time its copy is made; its
template, with every field and where it is, is still readable. While that service is starting up,
at capacity, or slow to answer, these endpoints answer service_unavailable with
Retry-After; retry after that many seconds.