How to pre-fill custom fields when creating an envelope? - docusignapi

My business process is like this:
I have one template with one document.
The document must have several fields that must be filled in differently for each signatory.
For example:
fields "company_name", "signer_name", etc.
I assume that when creating an envelope, the fields must be pre-filled for each signer:
Signer 1 should receive values for the fields: "Alice's company", "Alice",
Signer 2 should receive values for the fields: "Bob's company", "Bob".
To do that, I make POST request to endpoint:
/restapi/v2.1/accounts/{accountId}/envelopes
Body:
{
"emailSubject": "Email Subject",
"templateId": "my-template-id",
"status": "sent",
"customFields": {
"textCustomFields": [
{
"fieldId": "10851848897",
"name": "company_name",
"required": "true",
"show": "true",
"value": "Alice's company"
},
{
"fieldId": "10851848898",
"name": "signer_name",
"required": "true",
"show": "true",
"value": "Alice"
}
]
},
"templateRoles": [
{
"email": "alice#maildomain.com",
"emailNotification": {
"emailBody": "email body",
"emailSubject": "email subject",
"supportedLanguage": "en"
},
"roleName": "signer",
"routingOrder": "1"
}
]
}
Alice recieve link to sign the document without pre-filled fields.
Also, GET request to list document's fields
/restapi/v2.1/accounts/{accountId}/envelopes/{envelopeId}/documents/{documentId}/fields
gives no fields:
{
"documentFields": []
}

Envelope Custom fields can be obtained by a different endpoint:
/restapi/v2.1/accounts/${account_id}/envelopes/${envelope_id}/custom_fields
Now, I assume you actually want something else, which is to show values to the recipients on the envelope.
That is done by actually adding tabs and settings their values like this:
(giving you here a complete example with various different tabs)
ENVELOPE
{
"customFields": {
"textCustomFields": [{
"name": "salary",
"required": "false",
"show": "true",
"value": "123000"
}]
},
"documents": [
{
"documentBase64": "' > $request_data
cat $doc1_base64 >> $request_data
printf '",
"documentId": "1",
"fileExtension": "docx",
"name": "Lorem Ipsum"
}
],
"emailBlurb": "Sample text for email body",
"emailSubject": "Please Sign",
"envelopeIdStamping": "true",
"recipients": {
"signers": [{
"clientUserId": "1000",
"email": "{USER_EMAIL}",
"name": "{USER_NAME}",
"recipientId": "1",
"routingOrder": "1",
"tabs": {
"signHereTabs": [{
"anchorString": "/sn1/",
"anchorUnits": "pixels",
"anchorXOffset": "20",
"anchorYOffset": "10"
}],
"textTabs": [{
"anchorString": "/legal/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "false",
"tabId": "legal_name",
"tabLabel": "Legal name",
"value": "{USER_NAME}"
}, {
"anchorString": "/familiar/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "false",
"tabId": "familiar_name",
"tabLabel": "Familiar name",
"value": "{USER_NAME}"
}, {
"anchorString": "/salary/",
"anchorUnits": "pixels",
"anchorXOffset": "5",
"anchorYOffset": "-9",
"bold": "true",
"font": "helvetica",
"fontSize": "size11",
"locked": "true",
"tabId": "salary",
"tabLabel": "Salary",
"value": "$123,000.00"
}]
}
}]
},
"status": "Sent"
}
TEMPLATE
{
"customFields": {
"textCustomFields": [{
"name": "app metadata item",
"required": "false",
"show": "true",
"value": "1234567"
}]
},
"status": "Sent",
"templateId": "'"${template_id}"'",
"templateRoles": [{
"clientUserId": "1000",
"email": "'"${SIGNER_EMAIL}"'",
"name": "'"${SIGNER_NAME}"'",
"roleName": "signer",
"tabs": {
"checkboxTabs": [{
"selected": "true",
"tabLabel": "ckAuthorization"
}, {
"selected": "true",
"tabLabel": "ckAgreement"
}],
"listTabs": [{
"documentId": "1",
"pageNumber": "1",
"tabLabel": "list",
"value": "green"
}],
"radioGroupTabs": [{
"groupName": "radio1",
"radios": [{
"selected": "true",
"value": "white"
}]
}],
"textTabs": [{
"tabLabel": "text",
"value": "Jabberwocky!"
}, {
"bold": "true",
"documentId": "1",
"font": "helvetica",
"fontSize": "size14",
"height": "23",
"locked": "false",
"pageNumber": "1",
"required": "false",
"tabId": "name",
"tabLabel": "added text field",
"value": "'"${SIGNER_NAME}"'",
"width": "84",
"xPosition": "280",
"yPosition": "172"
}]
}
}, {
"email": "'"${CC_EMAIL}"'",
"name": "'"${CC_NAME}"'",
"roleName": "cc"
}]
}

Related

Docusign : create envelope with recipient custom field

I'm trying to create an envelope based on a template and assign a custom field to one of the recipients ("customFields": ["5616999"] , which is the employee ID).
This is my POST REST API:
URI : https://demo.docusign.net/restapi/v2/accounts/{accountid}/envelopes
Payload:
{ "status":"sent",
"emailSubject": "Test with template and custom field",
"templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5", "documents": [{ "documentId": "25407849", "name": "testTemplateDoc2.pdf", "documentBase64": " my base64 string of the document"}],
"templateRoles": [{
"email": "test#gmail.com",
"name": "john doe",
"recipientId": "10501840",
"roleName": "RH",
"routingOrder": "1",
"emailNotification": {
"emailBody": "text12808",
"emailSubject": "Signez ce document [[Collaborateur_UserName]]",
"supportedLanguage": "fr"
},
"recipientSignatureProviders": [{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"sms": "+33265555555"
}
}
],
"tabs": {
"signHereTabs": [{
"anchorString": "/RH1/",
"anchorUnits": "pixels",
"anchorXOffset": "0",
"anchorYOffset": "0",
"name": "Please sign here",
"optional": "false",
"recipientId": "10501840",
"scaleValue": 1
}
]
}
}, {
"email": "test2#gmail.com",
"name": "jane doe",
"recipientId": "61432066",
"roleName": "Collaborateur",
"routingOrder": "2",
"emailNotification": {
"emailBody": "text2 2808",
"emailSubject": "Signez votre document Mr. [[Collaborateur_UserName]]",
"supportedLanguage": "fr"
},
"recipientSignatureProviders": [{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"oneTimePassword": "1234"
}
}
],
"tabs": {
"signHereTabs": [{
"anchorString": "/S1/",
"anchorUnits": "pixels",
"anchorXOffset": "0",
"anchorYOffset": "0",
"name": "Please sign here",
"optional": "false",
"recipientId": "61432066",
"scaleValue": 1
}
]
},
"customFields": ["5616999"]
}, {
"email": "test3#gmail.com",
"name": "john3 doe3",
"recipientId": "64377607",
"roleName": "Directeur",
"routingOrder": "3",
"emailNotification": {
"emailBody": "text3 2808",
"emailSubject": "consultez le document de Mr. [[Collaborateur_UserName]]",
"supportedLanguage": "fr"
},
"recipientSignatureProviders": [{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"oneTimePassword": "1234"
}
}
]
}
]
}
SO I got a 200 OK and my envelope was created successfully, however the recipient custom field does not appear when I do a simple GET on the envelope.
I think it's not taken into account.
This is my GET URI
https://demo.docusign.net/restapi/v2/accounts/{accountID}/envelopes/{envelopeid}/recipients?include_extended=true&include_tabs=true
this is the result :
{
"signers": [
{
"tabs": {
"signHereTabs": [
{
"stampType": "signature",
"name": "Please sign here",
"tabLabel": "Sign Here",
"scaleValue": 1,
"optional": "false",
"documentId": "1",
"recipientId": "1",
"pageNumber": "1",
"xPosition": "69",
"yPosition": "688",
"anchorString": "/RH1/",
"anchorXOffset": "0",
"anchorYOffset": "0",
"anchorUnits": "pixels",
"tabId": "a3c9e24a-054c-4e39-bb85-ff602c9afd15"
}
]
},
"signInEachLocation": "false",
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSignatureProviders": [
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"sms": "+330642037079"
}
}
],
"name": "john doe",
"email": "test#gmail.com",
"recipientId": "1",
"recipientIdGuid": "77e97f08-552e-4e5b-ab0d-1802d72813cf",
"requireIdLookup": "false",
"userId": "0358b4e5-2c64-4d37-a6c2-d9f099ff5071",
"routingOrder": "1",
"note": "",
"roleName": "RH",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "[BPMED] Signez ce document [[Collaborateur_UserName]]",
"emailBody": "text12808",
"supportedLanguage": "fr"
},
"totalTabCount": "1"
},
{
"tabs": {
"signHereTabs": [
{
"stampType": "signature",
"name": "Please sign here",
"tabLabel": "Sign Here",
"scaleValue": 1,
"optional": "false",
"documentId": "1",
"recipientId": "2",
"pageNumber": "1",
"xPosition": "69",
"yPosition": "264",
"anchorString": "/S1/",
"anchorXOffset": "0",
"anchorYOffset": "0",
"anchorUnits": "pixels",
"tabId": "5bf64798-f22a-4f08-9bfd-da5745c1c0a0"
}
]
},
"signInEachLocation": "false",
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSignatureProviders": [
{
"signatureProviderName": "universalsignaturepen_opentrust_hash_tsp",
"signatureProviderOptions": {
"oneTimePassword": "1234"
}
}
],
"name": "jane doe",
"email": "test2#gmail.com",
"recipientId": "2",
"recipientIdGuid": "c3de6e46-be6a-4ccf-b939-30c0cd251849",
"requireIdLookup": "false",
"userId": "e0a726f8-a89d-4b86-99fc-153150cd4892",
"routingOrder": "2",
"note": "",
"roleName": "Collaborateur",
"status": "created",
"deliveryMethod": "email",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "[BPMED] Signez votre document Mr. [[Collaborateur_UserName]]",
"emailBody": "text2 2808",
"supportedLanguage": "fr"
},
"totalTabCount": "2"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [
{
"name": "john3 doe3",
"email": "test3#gmail.com",
"recipientId": "3",
"recipientIdGuid": "b9569f7c-996d-4549-88f6-1e05e9b96ea7",
"requireIdLookup": "false",
"userId": "6f0b5463-3baa-4607-bcc9-1958873c12e2",
"routingOrder": "3",
"note": "",
"roleName": "Directeur",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": " consultez le document de Mr. [[Collaborateur_UserName]]",
"emailBody": " text3 2808",
"supportedLanguage": "fr"
},
"totalTabCount": "0"
}
],
"inPersonSigners": [],
"recipientCount": "3"
}
I've tried creating the envelope in draft mode and then making a PUT request to add the custom field, but it didn't work either...
PS: I've successfully created envelopes with recipient custom fields (not based on a template) and it was ok and the recipient custom field was well integrated in the envelope.
You can use DocuSign compositeTemplates and specify the recipient custom fields. Here is an example. templateRoles does not support specifying recipient custom fields
{
"emailSubject": "Test with template and custom field",
"status": "sent",
"compositeTemplates": [
{
"serverTemplates": [
{
"sequence": "1",
"templateId": "447e6671-74d1-45ce-bf3b-aa7a5c235ea5"
}
],
"inlineTemplates": [
{
"sequence": "1",
"recipients": {
"signers": [
{
"email": "test#gmail.com",
"name": "john doe",
"recipientId": "10501840",
"roleName": "RH",
"routingOrder": "1",
"customFields": [ "5616999" ],
"tabs": { },
"emailNotification": { },
"recipientSignatureProviders": { }
}
]
}
}
],
"document": {
"documentId": "25407849",
"name": "testTemplateDoc2.pdf",
"fileExtension": "pdf",
"documentBase64": ""
}
}
]
}

texttabs not being set using rest api create envelope

Wondering what I am missing or doing wrong here as the value for the tabs are not being set when creating the envelope.
In the JSON code below I am trying to default values for the text tabs for recipient 5.
{
"emailSubject":"Allowance Agreement - AK Anne Klein Footwear - ytd .doc",
"emailBlurb":"DEV - Please complete the Vendor Allowance Agreement required for your Supplier setup with Zappos.com or 6pm.com. \n\n Please reach out to your Vendor Support team member or vendorsupport#zappos.com with any questions.",
"status":"sent",
"compositeTemplates":[
{
"compositeTemplateId": "1",
"inlineTemplates":[
{
"sequence":"1",
"documents": [
{
"documentId": "1",
"name": "Allowance Agreement - AK Anne Klein Footwear - ytd .doc.doc"
}
],
"customFields": {
"textCustomFields": [
{
"name": "Node ID",
"required": "true",
"show": "true",
"value": "658824"
}
]
},
"recipients":{
"signers":[
{
"email":"email#email.com",
"name":"v",
"recipientId":1,
"roleName":"Vendor"
},
{
"email":"email#email.com",
"name":"test",
"recipientId":2,
"roleName":"Vendor Support"
},
{
"email":"email#email.com",
"name":"ap",
"recipientId":3,
"roleName":"AP"
},
{
"email":"email#email.com",
"name":"f",
"recipientId":4,
"roleName":"Finance"
},
{
"email":"email#email.com",
"name":"ap",
"recipientId":5,
"roleName":"AP2",
"tabs":{
"textTabs":[
{
"tabLabel":"txtVendorId",
"value":"100023"
},
{
"tabLabel":"txtSupplierName",
"value":"AK Anne Klein Footwear"
},
{
"tabLabel":"txtSupplierId",
"value":"253"
}
]
}}
]
}
}
],
"serverTemplates":[
{
"sequence":"2",
"templateId":"A3B4F6BB-639A-486F-8C84-826295142F21"
}
]
}
]
}
When I look at the envelope tabs here is what I get for the 5th recipient:
"textTabs": [
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "",
"width": 300,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "txtVendorId",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1",
"recipientId": "5",
"pageNumber": "2",
"xPosition": "217",
"yPosition": "651",
"tabId": "2179efb5-9f59-4bb7-895e-da868fba9919"
},
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "",
"width": 342,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "txtSupplierName",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1",
"recipientId": "5",
"pageNumber": "2",
"xPosition": "172",
"yPosition": "670",
"tabId": "2c6e59b1-6a4f-4f5f-a873-33398c78e408"
},
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "",
"width": 354,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "txtSupplierId",
"font": "lucidaconsole",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1",
"recipientId": "5",
"pageNumber": "2",
"xPosition": "172",
"yPosition": "690",
"tabId": "614eb20b-5536-45db-b64a-84a475cdc44d"
}
]
* EDIT *
adding final part of envelopes tabs and screen captures of recipients and one tab...
},
"isBulkRecipient": "false",
"name": "ap",
"email": "email#email.com",
"recipientId": "5",
"recipientIdGuid": "77e255d8-a6d6-47a8-98ee-0f3829631d76",
"requireIdLookup": "false",
"userId": "8d7f443b-7adf-4cfa-8368-296aee88e959",
"routingOrder": "5",
"roleName": "AP2",
"status": "created",
"totalTabCount": "5"
}
* Workaround *
Since I was not able to set the tab values at creation time I tried the following:
Tried to create a PUT request to update the tabs using the uri for the tab for the recipient /envelopeid/recipients/5/tabs and passing the JSON for the text tabs as.
{
"textTabs":[
{
"tabLabel": "txtVendorId",
"value":"123"
}
]
}
Passing the JSON above I would get a response that the tab was not found on the envelope
{
"requireAll": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"recipientId": "5",
"tabId": "00000000-0000-0000-0000-000000000000",
"errorDetails": {
"errorCode": "INVALID_TAB_OPERATION",
"message": "The Tab specified is not valid for the requested operation. The Tab specified is not valid for the requested operation. Tab not found in envelope."
}
My second step was to actually get the tabId value from the created envelope instead of using the tab lable (something that I would not have before creating the envelope).
By calling /envelopeid/recipients/5/tabs with the tabId in the JSON instead like
{
"textTabs":[
{
"tabId": "57135910-fe34-417d-a4e3-fc7d6c4a42ed",
"value":"123"
}
]
}
Then the field value got updated correctly.
In conclusion, for my workaround will need three calls to DocuSign to be able to set the default values for this recipient:
Create Envelope
Get Recipient tabs (to get value of tab ids)
Update tab values using tab ids.
Are you positive you are correctly matching your recipients to valid roles you've configured on the Template?
For instance, I see that for recipient #5 you are assigning them to the "AP2" role, does that exact role exist in your template when you login to the website and view the template?
I'm sorry for the very long delay on an answer, your JSON needs one small tweek.
You need to change your sequence of your serverTemplates to 1, assigning the values to the same template.
"serverTemplates":[
{
"sequence":"1",
}
This will remove the need for the GET/PUT (although you can still do the GET to verify information if you'd like)

Get tab values from signed_completed document

First of all, DocuSign does not have consistent name for tabs in the document. When you convert PDF into DocuSign template, they were called "fields" which are where you could input your values such as text box, radio button, and check box.
Then in DocuSign admin console, DocuSign lists or labels them as Tags. But in the API document or calls, DocuSign uses another keyword as tab.
My question is how to get all the tab value from a signed document. There is a API call to get tab value from a draft document. It may work for a signed document too. But that API is based on recipient as well.
So if a document has multiple recipients and they all can change one tab. Then once the document is signed by all recipients, how do I get the final tab value from this final document.
The key is there should be only ONE final document regardless how many signers. So I should NOT get the value from each recipient and guess whose input is the final one.
Yes you can make a single API call to get all the tab values and information from a given, completed envelope in addition to draft ones. You need to make a GET request to the URI
v2/accounts/:accountId/envelopes/:envelopeId/recipients
And you need to include the optional query parameter ?include_tabs=true
For instance, your call should look like:
GET https://demo.docusign.net/restapi/v2/accounts/...123456.../envelopes/...ABCDE.../recipients?include_tabs=true
X-DocuSign-Authentication: <DocuSignCredentials><Username>{name}</Username><Password>{password}</Password><IntegratorKey>{integrator_key}</IntegratorKey></DocuSignCredentials>
Accept: application/json
Content-Type: application/json
Sample Response for a completed envelope with 2 recipients:
{
"signers": [
{
"tabs": {
"signHereTabs": [
{
"name": "Signature",
"tabLabel": "Signature 1",
"scaleValue": 1,
"optional": "false",
"documentId": "1386280",
"recipientId": "1822485",
"pageNumber": "1",
"xPosition": "88",
"yPosition": "234",
"tabId": "07e52952-304d-42d3-8ed2-347945e8a5bb"
}
],
"textTabs": [
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "recipient 1 text goes here",
"width": 120,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "DataField1",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1386280",
"recipientId": "1822485",
"pageNumber": "1",
"xPosition": "160",
"yPosition": "261",
"tabId": "668c1395-ced9-4b17-8ee9-f495ecbf02cd"
}
],
"checkboxTabs": [
{
"name": "Checkbox",
"tabLabel": "Checkbox 1",
"selected": "true",
"shared": "false",
"requireInitialOnSharedChange": "false",
"required": "true",
"locked": "false",
"documentId": "1386280",
"recipientId": "1822485",
"pageNumber": "1",
"xPosition": "118",
"yPosition": "298",
"tabId": "c767ad9a-9ab9-464d-bf4b-4dbfd811fa98"
}
]
},
"isBulkRecipient": "false",
"name": "John Doe",
"email": "john#test.com",
"recipientId": "1822485",
"recipientIdGuid": "5cb7641f-4009-4341-ab36-7d81074e3456",
"requireIdLookup": "false",
"userId": "346a8395-6a4a-4044-87a4-77586d038bf7",
"routingOrder": "1",
"status": "completed",
"signedDateTime": "2015-03-23T19:39:39.6270000Z",
"deliveredDateTime": "2015-03-23T19:39:14.7770000Z"
},
{
"tabs": {
"signHereTabs": [
{
"name": "Signature",
"tabLabel": "Signature 2",
"scaleValue": 1,
"optional": "false",
"documentId": "1386280",
"recipientId": "1827039",
"pageNumber": "1",
"xPosition": "320",
"yPosition": "234",
"tabId": "dd733be4-6f07-4ab3-bc1f-6b46596e7faa"
}
],
"textTabs": [
{
"height": 22,
"isPaymentAmount": "false",
"validationPattern": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"requireAll": "false",
"name": "Text",
"value": "Sally's text goes here",
"width": 120,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "DataField2",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1386280",
"recipientId": "1827039",
"pageNumber": "1",
"xPosition": "445",
"yPosition": "261",
"tabId": "7e435666-255c-4a3c-8699-be71ab6f384b"
}
],
"listTabs": [
{
"listItems": [
{
"text": "foo",
"value": "foo",
"selected": "true"
},
{
"text": "bar",
"value": "bar",
"selected": "false"
}
],
"value": "foo",
"width": 100,
"requireInitialOnSharedChange": "false",
"required": "true",
"locked": "false",
"requireAll": "false",
"tabLabel": "Drop Down 1",
"font": "arial",
"bold": "false",
"italic": "false",
"underline": "false",
"fontColor": "black",
"fontSize": "size9",
"documentId": "1386280",
"recipientId": "1827039",
"pageNumber": "1",
"xPosition": "320",
"yPosition": "301",
"tabId": "b845dde2-ba64-4905-8400-a7b795877ef2"
}
]
},
"isBulkRecipient": "false",
"name": "Sally Doe",
"email": "sally#test.com",
"recipientId": "1827039",
"recipientIdGuid": "43617294-9b97-41c2-8b90-bac4f40a0b33",
"requireIdLookup": "false",
"userId": "346a8395-6a4a-4044-87a4-77586d038bf7",
"routingOrder": "2",
"status": "completed",
"signedDateTime": "2015-03-23T19:40:43.6630000Z",
"deliveredDateTime": "2015-03-23T19:40:20.4070000Z"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
}
See THIS PAGE of the REST API documentation for more info on the call.

can i modify tabs of a template using API in docusign

Reading the API documentation i understood that I can edit the tabs of recipients for an envelope which is created/sent
However i am trying to undertsand can i also modify tabs for a template?
When i used the same request, as the one below i am getting error
Any reference would be appreciable.
The reason for my question is, everytime when i update the feed document for some corrections i have to redo creating the fields over it. Rather if i can send the fields through API that would save me a lot of time
Thank you
Sample JSON while updating the TABS (trying to add Tabs)
{
"signers": [
{
"tabs": {
"fullNameTabs": [
{
"name": "Full Name",
"tabLabel": "Full Name",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"pageNumber": "1",
"xPosition": "321",
"yPosition": "676",
"tabId": "82be754a-47c6-47fc-9793-6fdec6758060"
}
],
"dateSignedTabs": [
{
"name": "Date Signed",
"value": "",
"tabLabel": "Date Signed",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"pageNumber": "1",
"xPosition": "504",
"yPosition": "676",
"tabId": "1e3f16e8-77a9-4726-9876-66e6d377a0c1"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"recipientIdGuid": "5b46b9dc-d40d-493d-b319-5757bf1d5cb4",
"requireIdLookup": "false",
"routingOrder": "1",
"roleName": "ONE",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
},
{
"tabs": {
"signHereTabs": [
{
"name": "Sign Here",
"tabLabel": "Signature 3",
"scaleValue": 0.9,
"optional": "false",
"documentId": "1",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"pageNumber": "1",
"xPosition": "106",
"yPosition": "591",
"tabId": "9b20f825-f37c-4dc6-aa57-d29b3d531d6b"
}
],
"fullNameTabs": [
{
"name": "Full Name",
"tabLabel": "Full Name",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"pageNumber": "1",
"xPosition": "319",
"yPosition": "622",
"tabId": "79c35daf-cada-4a57-ac82-8a2a149839e8"
}
],
"dateSignedTabs": [
{
"name": "Date Signed",
"value": "",
"tabLabel": "Date Signed",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"pageNumber": "1",
"xPosition": "504",
"yPosition": "622",
"tabId": "14d47f01-a911-49b9-bf04-1c4cadb2924a"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"recipientIdGuid": "d4f63c18-8ccc-4ed3-bacb-660bebf829bf",
"requireIdLookup": "false",
"routingOrder": "2",
"roleName": "TWO",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
},
{
"tabs": {
"approveTabs": [
{
"buttonText": "Approve",
"width": 60,
"height": 18,
"tabLabel": "Approve 9",
"font": "lucidaconsole",
"bold": "false",
"italic": "false",
"underline": "false",
"fontSize": "size9",
"documentId": "1",
"recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"pageNumber": "1",
"xPosition": "228",
"yPosition": "718",
"tabId": "5083943e-bdf0-42fe-87ff-d92778b13be7"
}
],
"declineTabs": [
{
"buttonText": "Decline",
"width": 60,
"height": 18,
"declineReason": "",
"tabLabel": "Decline 10",
"font": "lucidaconsole",
"bold": "false",
"italic": "false",
"underline": "false",
"fontSize": "size9",
"documentId": "1",
"recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"pageNumber": "1",
"xPosition": "350",
"yPosition": "718",
"tabId": "b1c1ad78-e3b9-4630-b411-09127997f7dd"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"recipientIdGuid": "95f1d73e-df27-4f19-86ea-c921f0321d26",
"requireIdLookup": "false",
"routingOrder": "3",
"roleName": "THREE",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
}
],
"agents": [],
"editors": [],
"intermediaries": [
{
"name": "",
"email": "",
"recipientId": "fa2bffdb-81d7-4de4-a964-e543e2d1d3cf",
"recipientIdGuid": "fa2bffdb-81d7-4de4-a964-e543e2d1d3cf",
"requireIdLookup": "false",
"routingOrder": "3",
"roleName": "FOUR",
"status": "created",
"templateLocked": "false",
"templateRequired": "false",
"emailNotification": {
"emailSubject": "Subject",
"emailBody": "Body",
"supportedLanguage": "en"
}
}
],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "5"
}
URL (tried both POST/PUT)
https://DOMAIN/restapi/v2/accounts/ACCTID/envelopes/ENVELOPID/recipients
RESPONSE
{
"errorCode": "ENVELOPE_CANNOT_CORRECT_INVALID_STATE",
"message": "This account may not have 'correct' permission, or the envelope state is not 'sent' or 'delivered'."
}
I don't believe it's possible to modify the tabs in the Template itself, using the API. The "Modify or Correct Recipient Information" operation you're trying to use allows you to "modify recipients in a draft envelope or correct recipient information for an in process envelope." (from p156 of the REST API guide: https://08d1d92f490618f41c65-8fb00e97ac499a7066a18ce9c66b019b.ssl.cf2.rackcdn.com/REST_API_Guide_v2.pdf). Since a Template is neither a draft envelope nor an in-process envelope, I wouldn't expect this operation to work for modifying tags within a Template.
If you wanted to use a template to specify the document(s), and then specify fields via the "Create Envelope" API call each time you send the envelope, you could achieve this by using a technique like I describe below. (The same technique could also be applied if you're using "Composite Templates" in your Create Envelope API call.)
For example, let's say that I've created a template via the DocuSign UI that has a single recipient (Signer1) and no tags within the document(s). I could then use the following request to create an Envelope that has the document(s) and recipient(s) that the template defines, with the tag(s) that my API request specifies (in this example, just a single Text Tab):
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"emailSubject": "Please sign this",
"emailBlurb": "Please sign...thanks!",
"templateId": "TEMPLATE_ID",
"templateRoles": [
{
"roleName": "Signer1",
"name": "John Doe",
"email": "johnsemail#outlook.com",
"recipientId": "1",
"tabs":{
"textTabs":[
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "100",
"yPosition": "400",
"tabLabel":"Address",
"name":"Address",
"value":"123 Main Street",
"locked": "false"
},
],
}
}
],
"status": "sent"
}
The example above uses templateRoles in the "Create Envelope" request. If you're instead using Composite Templates in your "Create Envelope" request, the request body would look like this:
POST https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes
{
"emailSubject": "Please sign",
"emailBlurb": "Please sign...thanks!",
"status": "sent",
"compositeTemplates": [{
"serverTemplates": [{
"sequence": 1,
"templateId": "TEMPLATE_ID"
}],
"inlineTemplates": [{
"sequence": 2,
"recipients": {
"signers": [{
"email": "sallysemail#outlook.com",
"name": "Sally Adamson",
"recipientId": "1",
"roleName": "Signer1",
"tabs":{
"textTabs":[
{
"documentId": "1",
"pageNumber": "1",
"recipientId": "1",
"xPosition": "100",
"yPosition": "400",
"tabLabel":"Address",
"name":"Address",
"value":"123 Main Street",
"locked": "false"
},
],
}
}]
}
}]
}]
}
If you're going to implement this approach, I'd suggest that you consider using the "anchor text" technique of specify tag placement, rather than specifying x-y coordinates for each and every tag. Using "anchor text" placement technique means that you specify placement of each tag relative to some existing text within your document(s), such that the tag location will always be correct, even if the format of your document changes slightly -- as long as the anchor text string still exists in the doc and can therefore be used to place the tag. See pages 324-325 of the REST API guide for more info on using anchor text to specify tag placement.

Getting all tabs from a template using REST DocuSign API

I was wondering what the best approach is to get all the tabs from a template using the REST API.
What I am currently trying to do is get all the recipients and all of their tabs so that we can default some of the values as well as lock fields that have populated values when creating the envelope.
To get the recipients I am using /envelopes/{templateId}/recipients.
To get the tabs I would be looping through through all the recipients in the template(s) and then I would be using /envelopes/{templateId}/recipients/{recipientId}/tabs.
I was wondering if this would be the best approach as I would be making as many calls to DocuSign as there are recipients and don't want to make extra calls if there is a better way of doing this.
Thank you.
Actually, there's a simpler way to get all the fields (tabs) for a Template via the REST API. Simply make the following (single) call:
GET https://{{env}}.docusign.net/restapi/{{version}}/accounts/{{acctId}}/envelopes/{{templateId}}/recipients?include_tabs=true&include_extended=true
A successful response will contain a collection of the Template's Recipients for each recipient type (i.e., signers, agents, carbonCopies, etc.) -- and each recipient object within any of those collections will include information about the recipient's tabs. For example, here's the response for a Template that contains two Signers -- each 'owning' several tabs of various types:
{
"signers": [
{
"tabs": {
"signHereTabs": [
{
"name": "Sign Here",
"tabLabel": "Signature 1",
"scaleValue": 1,
"optional": "false",
"documentId": "1",
"recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
"pageNumber": "1",
"xPosition": "74",
"yPosition": "96",
"tabId": "bb7df562-665c-4f8d-8395-56f0c2f6accf"
}
],
"textTabs": [
{
"height": 11,
"validationPattern": "",
"validationMessage": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"name": "Text",
"value": "",
"width": 42,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "address",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
"pageNumber": "1",
"xPosition": "74",
"yPosition": "257",
"tabId": "451365aa-f066-45b9-aa58-4d7da60f3039"
}
],
"radioGroupTabs": [
{
"documentId": "1",
"recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
"groupName": "Radio Group 1",
"radios": [
{
"pageNumber": "1",
"xPosition": "185",
"yPosition": "165",
"value": "Radio 1",
"selected": "false",
"tabId": "25362e61-c421-466b-a13c-934bb3be0ac6",
"required": "True",
"locked": "False"
},
{
"pageNumber": "1",
"xPosition": "214",
"yPosition": "165",
"value": "Radio 2",
"selected": "false",
"tabId": "350f3efa-f2ba-4aaf-bd78-4b45dc475ee4",
"required": "True",
"locked": "False"
}
]
}
],
"listTabs": [
{
"listItems": [
{
"text": "Married",
"value": "M",
"selected": "false"
},
{
"text": "Single",
"value": "S",
"selected": "false"
},
{
"text": "Divorced",
"value": "D",
"selected": "false"
},
{
"text": "Widowed",
"value": "W",
"selected": "false"
}
],
"value": "",
"width": 78,
"shared": "false",
"requireInitialOnSharedChange": "false",
"tabLabel": "MaritalStatus",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
"pageNumber": "1",
"xPosition": "72",
"yPosition": "213",
"tabId": "b6e5b284-5c87-4a0c-9db5-e4d364ab1113"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
"recipientIdGuid": "f1b5d256-d85c-42d3-b081-913fb93e13a7",
"requireIdLookup": "false",
"routingOrder": "1",
"roleName": "Signer1",
"status": "created",
"templateLocked": "false",
"templateRequired": "false"
},
{
"tabs": {
"signHereTabs": [
{
"name": "Sign Here",
"tabLabel": "Signature 8",
"scaleValue": 1,
"optional": "false",
"documentId": "1",
"recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
"pageNumber": "1",
"xPosition": "354",
"yPosition": "88",
"tabId": "1e1829ef-005d-4277-b7af-8758cfdf186a"
}
],
"fullNameTabs": [
{
"name": "Full Name",
"tabLabel": "Full Name",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
"pageNumber": "1",
"xPosition": "354",
"yPosition": "183",
"tabId": "c33c0f3c-2f77-4985-b5b7-d538220a2f86"
}
],
"textTabs": [
{
"height": 11,
"validationPattern": "",
"validationMessage": "",
"shared": "false",
"requireInitialOnSharedChange": "false",
"name": "Text",
"value": "",
"width": 42,
"required": "true",
"locked": "false",
"concealValueOnDocument": "false",
"disableAutoSize": "false",
"tabLabel": "Data Field 9",
"bold": "false",
"italic": "false",
"underline": "false",
"documentId": "1",
"recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
"pageNumber": "1",
"xPosition": "354",
"yPosition": "156",
"tabId": "80e5a803-b1d4-4175-97b4-09c6125f3143"
}
]
},
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
"recipientIdGuid": "79e8bc34-6a40-4cc5-90e1-e58d9707418e",
"requireIdLookup": "false",
"routingOrder": "2",
"roleName": "Signer2",
"status": "created",
"templateLocked": "false",
"templateRequired": "false"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2"
}

Resources