Get template roles (REST API) - docusignapi

I'm interested in getting roles from templates to populate them correctly and keep that up to date automatically.
Is it somehow possible to get that using REST API?
There's the "Get Account Template by ID - v2/accounts/:accountId/templates/:templateId" request but it seems to return little useful info regarding roles or recipients.

Using the REST API, you can get recipient Role Names for a Template by simply executing a "GET Envelope Recipients" request, where you specify the Template Id in place of the Envelope Id. For example:
GET https://demo.docusign.net/restapi/v2/accounts/{accountId}/envelopes/{templateId}/recipients?include_tabs=false&include_extended=true
The response to this request will contain an array of recipient objects for each recipient type (i.e.: signers, agents, editors, intermediaries, carbonCopies, certifiedDeliveries, inPersonSigners); each recipient object will contain the property roleName. Here's an example response for a template that contains 3 recipients -- 2 signers and one CC recipient:
{
"signers": [
{
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "5741ec70-b056-44eb-b462-eceee88ddf77",
"requireSignerCertificate": "false",
"requireIdLookup": "false",
"routingOrder": "1",
"roleName": "Signer 1",
"status": "created",
"templateLocked": "false",
"templateRequired": "false"
},
{
"signInEachLocation": "false",
"name": "",
"email": "",
"recipientId": "c64d4567-2efd-422d-9b0a-a5427aa2512d",
"requireSignerCertificate": "false",
"requireIdLookup": "false",
"routingOrder": "2",
"roleName": "Signer 2",
"status": "created",
"templateLocked": "false",
"templateRequired": "false"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [
{
"name": "Legal Team",
"email": "email3#outlook.com",
"recipientId": "a63e3714-adc2-4e05-b2c5-b3c3bbf50aa2",
"requireIdLookup": "false",
"routingOrder": "3",
"roleName": "Legal Team",
"status": "created",
"templateLocked": "true",
"templateRequired": "true"
}
],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "3"
}

Related

DocuSign: Auto-Place doesn't work with sign tabs

I'm trying to add anchor tagging when I create a new envelope, but the tab to sign doesn't appear.
I've followed these steps:
Created a template
POST {{baseUrl}}/v2.1/accounts/{{accountId}}/templates
{"name": "Template 1",
"emailBlurb": "Blurb Test",
"emailSubject": "Subject Test",
"documents": [{
"documentId": "1",
"name": "Document1",
"fileExtension": "pdf",
"order": "1",
"documentBase64":"base64codehere" }]
}
Created an envelope
POST {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes
{"status": "created", "templateId": "{{templateId}}" }
Add recipient to the envelope
POST {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/recipients
{
"signers": [
{
"userName" : "Sender 1",
"email": "sender1email#gmail.com",
"name": "Sender 1",
"clientUserId": "SenderOne" ,
"recipientId": "1",
"roleName" : "SenderMember",
"routingOrder": "1",
"tabs": {
"signHereTabs": [
{
"anchorString": "\\sn1\\",
"anchorXOffset": "20",
"anchorYOffset": "10",
"anchorUnits": "pixels"
}
]
}
},
{
"userName" : "Sender2",
"email": "sender2email#gmail.com",
"name": "Sender2",
"clientUserId": "Sender2C" ,
"recipientId": "2",
"roleName" : "SenderMember2",
"routingOrder": "2",
"tabs": {
"signHereTabs": [
{
"anchorString": "\\sn1\\",
"anchorXOffset": "20",
"anchorYOffset": "10",
"anchorUnits": "pixels"
}
]}}
]
}
Got recipients from envelope
GET {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}/recipients
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"requireUploadSignature": "false",
"name": "Sender 1",
"firstName": "",
"lastName": "",
"email": "sender1email#gmail.com",
"recipientId": "1",
"recipientIdGuid": "ed850c16-be9b-45d1-b0a2-b06f9d043a33",
"requireIdLookup": "false",
"userId": "66f3947d-eea4-450a-9f3a-6145607dba20",
"clientUserId": "SenderOne",
"routingOrder": "1",
"roleName": "SenderMember",
"status": "created",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"requireUploadSignature": "false",
"name": "Sender2",
"firstName": "",
"lastName": "",
"email": "sender2email#gmail.com",
"recipientId": "2",
"recipientIdGuid": "88f5e6e2-9e95-4d94-9501-0ebdfeece93b",
"requireIdLookup": "false",
"userId": "4843e0fa-a69c-43ce-9638-e9d1c023ad27",
"clientUserId": "Sender2C",
"routingOrder": "2",
"roleName": "SenderMember2",
"status": "created",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"seals": [],
"witnesses": [],
"notaries": [],
"recipientCount": "2"
}
5 - Sent envelope
GET {{baseUrl}}/v2.1/accounts/{{accountId}}/envelopes/{{envelopeId}}
{
"status": "sent"
}
When I check the document, I do not see any sign tab:
DocuSign Document with the tags
Am I doing something wrong?
I suggest you follow our two how-to articles about this:
How to create a template
How to request a signature using a
template
Note that by putting the recipients as "placeholders" on the template, you can still define them differently for each envelope using the templateRoles object as long as you match the roleName. You will then get all the tabs that you defined to show on the envelope created from that templates.
Auto-place works fine with sign tabs. So the issue is to figure out what's happening with your app.
First off, most important please do not create an envelope by using multiple API calls to build up the envelope unless there's a real good reason why your application requires that pattern.
In general, building up an envelope via multiple API calls is not an efficient use of the API and is not allowed per DocuSign's API Usage Guidelines.
Instead, you can use one API call to create all aspects of the envelope and send it.
Easiest example to see how to use anchor tags with signHere tabs is the API Request Builder live examples. It enables you to try out the API and it then creates the SDK calls for you in various languages.
My guess from looking at your code is that the anchor strings are not matching with the document's text.

Docusign NodeJS EnvelopeViews: createRecipient UNKNOWN_ENVELOPE_RECIPIENT

I call the GET envelope recipients API
https://demo.docusign.net/restapi/v2.1/accounts/cf70dfa7-a861-4029-b149-5360c090ebfa/envelopes/4de0ca11-e07b-4ff0-936f-cdd37ff18ed2/recipients
and it returns clientUserId, userId, email, etc. Odd thing is even though I'm sending it to myself, it returns a different user id than the one I sent with.
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "michael",
"firstName": "",
"lastName": "",
"email": "email#email.email",
"recipientId": "2", //idk why this is 2
"recipientIdGuid": "smth",
"requireIdLookup": "false",
"userId": "fdbb65f9-ea71-4e59-8374-0e1952c70e0a",
"clientUserId": "random",
"routingOrder": "1",
"roleName": "signer",
"status": "sent",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
}
],etcetc
}
Using those I call the POST /view/recipient API and insert all those same things
{
"authenticationMethod": "HTTPBasicAuth",//I've tried this and password
"clientUserId": "random",
"email": "userid", //Tried both user ID's, and email + name, didnt work
"recipientId": "2", //same as above
"returnUrl": "http://localhost:3001/marketplace",
"userName": "userid"//tried same thing, and leaving this blank, gave another error
}
but it gives the error code
{
"errorCode": "UNKNOWN_ENVELOPE_RECIPIENT",
"message": "The recipient you have identified is not a valid recipient of the specified envelope."
}
Here is what your second call should be based on your first call:
{
"authenticationMethod": "none",
"clientUserId": "123456",
"email": "email#email.email",
"returnUrl": "http://localhost:3001/marketplace",
"userName": "michael"
}

How to create an envelope with signingGroup recipient?

I am creating an envelope using this uri:
POST https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes
headers:
Content-Type : application/json
X-DocuSign-Authentication: {"Username" : *****, "Password" : ******, "IntegratorKey" : *********}
body:
{
"status": "sent",
"emailSubject": "Signing Request for Doc2.docx",
"signerCanSignOnMobile": "true",
"documents": [
{
"documentId": "384098342",
"name": "Doc2.docx",
"fileExtension": "docx",
"documentBase64": *****,
"tabs": {
"textTabs": [
{
"xPosition": "2",
"yPosition": "3",
"documentId": "384098342",
"pageNumber": "1",
"value": "Fill in name.",
"locked": "false",
"anchorString": "sign5",
"anchorXOffset": "1.75",
"anchorYOffset": "0",
"anchorUnits": "inches",
"anchorIgnoreIfNotPresent": "true"
}
]
}
}
],
"recipients": {
"signers": [
{
"name": "Tom Ford",
"email": "tom.ford#email.com",
"recipientId": "64000",
"clientUserId": "c7052b97-f9a7-4af4-85de-8c64371467b1"
},
{
"name": "Demand Approvers",
"email": "approvers#email.com",
"signingGroupId": "true",
"signingGroupName": "Demand Approvers",
"recipientId": "626000",
"clientUserId": "123c6d15-1d25-4595-9878-5cbda4ba2823",
"signingGroupUsers": [
{
"userName": "John Smith",
"userId": "9c328221-1e86-41db-a3e7-bde9b4b4a50d",
"email": "josmith#example.com"
}
]
}
]
}
}
and the request succeeds. However, when I try to query the returned envelope, the "Demand Approvers" is listed as a single recipient instead of as a signingGroup.
Here is an example output:
{
"status": "sent",
"documentsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/documents",
"recipientsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/recipients",
"attachmentsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/attachments",
"envelopeUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e",
"emailSubject": "Signing Request for Doc2.docx",
"envelopeId": "063454a6-dee6-4e86-8d38-56d85e66c61e",
"signingLocation": "online",
"customFieldsUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/custom_fields",
"notificationUri": "/envelopes/063454a6-dee6-4e86-8d38-56d85e66c61e/notification",
"enableWetSign": "true",
"allowMarkup": "false",
"allowReassign": "true",
"createdDateTime": "2021-02-17T00:43:28.7070000Z",
"lastModifiedDateTime": "2021-02-17T00:43:28.7230000Z",
"initialSentDateTime": "2021-02-17T00:43:29.2570000Z",
"sentDateTime": "2021-02-17T00:43:29.2570000Z",
"statusChangedDateTime": "2021-02-17T00:43:29.2570000Z",
"documentsCombinedUri": "/envelopes/********************/documents/combined",
"certificateUri": "/envelopes/********************/documents/certificate",
"templatesUri": "/envelopes/********************/templates",
"expireEnabled": "true",
"expireDateTime": "2021-06-17T00:43:29.2570000Z",
"expireAfter": "120",
"sender": {
"userName": "********",
"userId": "********",
"accountId": "********",
"email": "sender#email.com"
},
"recipients": {
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "Demand Approvers",
"firstName": "",
"lastName": "",
"email": "approvers#email.com",
"recipientId": "626000",
"recipientIdGuid": "365b2f4d-0968-42d1-805e-55eece700246",
"requireIdLookup": "false",
"userId": "891a3891-f49d-4f14-8bc8-959524e2445a",
"clientUserId": "123c6d15-1d25-4595-9878-5cbda4ba2823",
"routingOrder": "1",
"status": "sent",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"recipientSuppliesTabs": "true",
"requireUploadSignature": "false",
"name": "Tom Ford",
"firstName": "",
"lastName": "",
"email": "tom.ford#email.com",
"recipientId": "64000",
"recipientIdGuid": "c60c5ccd-e49f-4b63-9745-5f283b8520eb",
"requireIdLookup": "false",
"userId": "4a78d305-43bf-4d78-a844-2bdc15e63770",
"clientUserId": "c7052b97-f9a7-4af4-85de-8c64371467b1",
"routingOrder": "1",
"status": "sent",
"completedCount": "0",
"deliveryMethod": "email",
"recipientType": "signer"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"seals": [],
"witnesses": [],
"notaries": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
},
"purgeState": "unpurged",
"envelopeIdStamping": "true",
"is21CFRPart11": "false",
"signerCanSignOnMobile": "true",
"autoNavigation": "true",
"isSignatureProviderEnvelope": "false",
"hasFormDataChanged": "false",
"allowComments": "true",
"hasComments": "false",
"allowViewHistory": "true",
"envelopeMetadata": {
"allowAdvancedCorrect": "true",
"enableSignWithNotary": "true",
"allowCorrect": "true"
},
"anySigner": null,
"envelopeLocation": "current_site",
"isDynamicEnvelope": "false"
}
The signingGroup related information for Demand Approvers is missing.
How do I structure my request so that the Demand Approvers will be listed as a signingGroup?
I found the cause. So it seems that when dealing with Signing Groups,
These 2 points must be true:
The Signing Group must be registered in DocuSign. The generated
signingGroupId can then be used as recipient. Setting signingGroupId
to "true" or any random value will not work.
clientUserId must not be provided

RecipientId get changed by docusign

I am creating envelope using DocuSign API. While creating envelope I am also passing list of signers and also set my own unique "RecipientId" (GUID) for each signers. But when envelope gets created and checking the list of recipients(signers) and found that recipient id gets changed all time. It is not "RecipientId" which I am passing.
Can you help me how can we set own "RecipientId" while creating envelope?
-- Create envelope request
{ "documents": [{
"documentBase64": "<Base64BytesHere>",
"documentId": "1",
"fileExtension": "pdf",
"name": "lite"
}],
"emailSubject": "test recipient 2",
"recipients": { "signers": [ { "email": "xxx.yyy#xxx.com",
"name": "xxx yyy",
"recipientId": "1"
} ]
},
"status": "sent"
}
-- Web hook Response see recipient Id --
<DocuSignEnvelopeInformation><EnvelopeStatus>
<RecipientStatuses>
<RecipientStatus>
<Type>Signer</Type>
<Email>xxx.yyy#abc.com</Email>
<UserName>xxx yyy</UserName>
<RoutingOrder>1</RoutingOrder>
<Sent>2017-08-29T02:13:33.853</Sent>
<DeclineReason xsi:nil="true"/>
<Status>Sent</Status>
<RecipientIPAddress/>
<CustomFields/>
<AccountStatus>Active</AccountStatus>
<RecipientId>011eac75-f2fa-4f57-94df-5aedaxxxxxxx</RecipientId>
</RecipientStatus>
</RecipientStatuses>
....
<DocuSignEnvelopeInformation><EnvelopeStatus>
Another way around this is to use recipient.customFields. It's an array of strings:
someEnvelopeSigner.customFields = [yourUUID, somethingElse]
In the webhook / event notification, it will come through in DocuSignEnvelopeInformation.EnvelopeStatus[0].RecipientStatuses[0].RecipientStatus[i].CustomFields and look something like (in JSONified form)
{
"CustomFields": [{
"CustomField": [
"6e45cb20-3953-11ea-b02d-dedef9da77b9",
"something else!"
]
}],
}
You can specify a unique recipientId for each recipient while creating an envelope.
Here is a sample CreateEnvelope request
POST /v2/accounts/{accountId}/envelopes
Json Payload.
{
"emailSubject": "Please sign the agreement",
"status": "sent",
"recipients": {
"signers": [
{
"email": "janedoe#acme.com",
"name": "jane doe",
"recipientId": 1,
"routingOrder": 1,
"tabs": {
"signHereTabs": [
{
"documentId": "1", "pageNumber": "1", "xPosition": "80", "yPosition": "80"
}
]
}
},
{
"email": "johnsmith#acme.com",
"name": "john smith",
"recipientId": 2,
"routingOrder": 2,
"tabs": {
"signHereTabs": [
{
"documentId": "1", "pageNumber": "1", "xPosition": "80", "yPosition": "180"
}
]
}
}
]
},
"documents": [
{
"documentId": "1",
"name": "Contract",
"fileExtension": "txt",
"documentBase64": "RG9jIFRXTyBUV08gVFdP"
}
]
}
Use the listEnvelopeRecipients api to retrieve the list of recipients in the envelope.
{
"signers": [
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "jane doe",
"email": "janedoe#acme.com",
"recipientId": "1",
"recipientIdGuid": "98d60cc3-5f67-46e4-9fc0-ca6bb519f1c9",
"requireIdLookup": "false",
"userId": "585b8733-b1a9-4329-87e7-4f20bcde00c2",
"routingOrder": "1",
"status": "sent"
},
{
"creationReason": "sender",
"isBulkRecipient": "false",
"name": "john smith",
"email": "johnsmith#acme.com",
"recipientId": "2",
"recipientIdGuid": "726bd54d-89ed-41ba-a751-fdb129894b8b",
"requireIdLookup": "false",
"userId": "45abe022-ae12-4816-8c42-fd66d207807a",
"routingOrder": "2",
"status": "created"
}
],
"agents": [],
"editors": [],
"intermediaries": [],
"carbonCopies": [],
"certifiedDeliveries": [],
"inPersonSigners": [],
"recipientCount": "2",
"currentRoutingOrder": "1"
}

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.

Resources