A field is the object that bears the action to be performed by a participant. A field has a type
which can be either:
signature
(for a signature request by a physical person),visa
(for a consultation request by a physical person),text
(for a text field to be filled by the participant),label
(for a read only text added by the transaction creator on a document).
You can also add initials fields.
This page presents only label
fields. For more information about other field types, visit Add a signature/visa field and Add a text field.
Create a label field
To create a label field, send a request to POST /v1/transactions/{transaction_id}/documents/{document_id}/fields
and pass label
in the type
argument. You can set other optional arguments:
curl
https://api.universign.com/v1/transactions/tx_DwYGle91EQZA/documents/doc_4dn/fields \
-d type=label \
-d name=LabelField \
-d page=1 \
-d x=75 \
-d y=200 \
-d value="This text is only for display!" \
-d font_size=10
name
: The label field name.page
: The page number on which you want to position the label field.x
: The label field horizontal coordinate on the document page (in pixels).y
: The label field vertical coordinate on the document page (in pixels).copy_from
: Use to copy the field. Expected value is the ID of the field you want to copy. This creates a new field with no position on the document. Do not pass if you pass themove_from
argument.move_from
: Use to move a field to another document. Expected value is the ID of the field you want to move. Do not pass if you pass thecopy_from
argument.height
: The height of the field (expressed in PDF’s default user space units). If not provided, the height is set to font height.width
: The width of the field (expressed in PDF’s default user space units). Default value is200
.value
: The text you want to display in the label field.font_size
: The font size of the field content. Possible values between7
and12
. Default value is12
.
The API response returns a field
sub-object.
{
"id" : "fld_3znk",
"name" : "LabelField",
"position" : {
"page" : 1,
"x" : 75,
"y" : 200,
"width" : 180,
"height" : 16
},
"built_in" : false,
"updatable" : true,
"deletable" : true,
"value" : "This text is only for display!",
"font_size" : 10,
"type" : "label"
}
Update a text field
To update a label field, send a request to POST /v1/transactions/{transaction_id}/documents/{document_id}/fields/{field_id}
.
curl
https://api.universign.com/v1/transactions/tx_DwYGle91EQZA/documents/doc_4dn/fields/fld_DL4x \
-d type=label \
-d name=UpdatedLabelField \
-d page=2 \
-d x=75 \
-d y=200 \
-d value="Please do not try to edit this text!" \
-d font_size=12
The API response returns a field
sub-object as it was last updated.
{
"id" : "fld_3znk",
"name" : "UpdatedLabelField",
"position" : {
"page" : 2,
"x" : 75,
"y" : 200,
"width" : 180,
"height" : 16
},
"built_in" : false,
"updatable" : true,
"deletable" : true,
"value" : "Please do not try to edit this text!",
"font_size" : 12,
"type" : "label"
}