How to download Signed Document from an Envelope? - docusignapi

Once a user signs a document attached to an envelope, is there anyway that developer can download that document using Rest API end-point? And before downloading it, is there any way to tell whether the document is signed or not?

Part I: Determine whether a particular signer OR whether all recipients have completed/submitted an Envelope
To check whether a particular Signer (recipient) has completed signing an Envelope, you can use the List Envelope Recipients request:
GET /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients
As shown here, the signers property within the JSON response is the array of signers for the Envelope, and the status property within each signer object indicates that particular recipient's status. A status of completed for a signer indicates that the recipient has signed/completed/submitted the Envelope.
{
...
"signers": [
{
"deliveredDateTime": "2016-10-05T21:18:12.3330000Z",
"email": "jallard#example.com",
"isBulkRecipient": "false",
"name": "Jennie Allard",
"recipientId": "1",
"recipientIdGuid": "4575d5e9-7654-467b-b2f5-6c59ca7c43f8",
"requireIdLookup": "false",
"routingOrder": "1",
"signedDateTime": "2016-10-05T21:18:41.6930000Z",
"status": "completed",
"userId": "ca45284a-a94e-4ee2-90af-76035bd795b2"
}
]
}
Alternatively, to check whether ALL recipients of an Envelope have completed/submitted the Envelope, you can use the Get Envelope request:
GET /v2/accounts/{accountId}/envelopes/{envelopeId}
As shown here, the response will be an Envelope object and the status property within that object indicates the overall status of the Envelope. A status of completed indicates that all recipients have completed/submitted the Envelope.
Part II: Download completed document(s)
For endpoints related to retrieving document(s) for an Envelope, see this page: https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeDocuments/. You'll likely use the List Envelope Documents request to get the list of documents in the Envelope, and then subsequently issue a Get Envelope Document request for each document that you want to retrieve.
Additional comments
While you certainly can use REST API requests as I've described above to periodically poll for Envelope (or Recipient) status, and then request document(s) when envelope (and/or recipient) status is completed -- a more efficient alternative would be to use DocuSign Connect, which you could configure to automatically push Envelope status and documents to an endpoint you specify when an Envelope reaches status = completed.

Related

How To fill all the recipients /Signer and move the workflow to the second signer through API/Rest Web Service

I have a docusign template created with below signing order(1.Employee 2.Manager).[Ref below screen]
I am able to fill the form element and the send the draft envelope to the first signer i.e Employee through API using the POSTMAN.()
Problem Statement:-
1.As of now I have hard coded the manager name and email Id in Template but actually I wanted to fill this dynamically while creating the Envelope.
2.When I am sending the Envelope with the data from postman, It is creating a draft Envelope for the first signer i.e for employee but my requirement is that the first signer task (Entering the data and move the workflow to Manager ) should be perform from API.
Thanks For helping Us.
You can update your draft envelope by making an additional RESTful request:
PUT /restapi/v2.1/accounts/{{accountId}}/envelopes/{{envelope_id}}
If you want to fill in the fields of your employee recipient, just specify something like this in your request body:
{
"recipients": {
"signers": [
{
"name": "InsertDynamicNameHere",
"email": "emailGoesHere",
"recipientId": "2"
}
]
}
}

Add tags after envelope creation but before generating the recipient view

I need to create an envelope by defining the recipients and the document. After creating the envelope, I then need to manually add the tags. After adding the tags, I want to generate a recipient URL for this particular envelope ID. Is this possible?
I do not want to send the envelope but edit it by adding tags. I will generate a recipient view separately. Currently, I am unable to find a way to add the tags after envelope creation and before sending.
I tried to create the envelope with status: created and then generated the correction view. On opening the URL, it said cannot find the envelope.
Create an envelope and if you want to show Send Button to the sender then use createSender View https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeViews/createSender/
and if you dont want to show Send button then create envelope with sent status and use createCorrect View https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeViews/createCorrect/
And if you don't want recipient to receive any email then make that recipient an embedded recipient by adding clientUserId, once clientUserId is added then that recipient will not receive an email. To get recipient View, you should use below call https://docs.docusign.com/esign/restapi/Envelopes/EnvelopeViews/createRecipient/
Use the Create:EnvelopeRecipientTabs api to add tabs to a draft envelope.
POST /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs
{
"signHereTabs": [
{
"anchorString": "Sign",
"anchorMatchWholeWord": "false"
}
]
}

Embedded Docusign Signing URL - using document visibility to only show 1 document in the envelope

I am creating an envelope via the Docusign Rest API. this envelope has 2 inline templates each have their own roles and do not share any tabs. I have a custom workflow that requires the user to fill in each document separately so i use the (/views/reciepients) endpoint to get a signing url.
The first signer sees the first (and only the first) document correctly, it is filled in and completed. Then i want to show the second document from the envelope in an iframe to a user. When i get the signing URL for the second recipient (signer) it also includes the first document all filled out.
I have document visibility set up on the account.
I have read the documentation a few times and there is one confusing, under "Post Recipient View" there is a field "userName" which is not mentioned when creating the recipient or in the response from the recipient end point. I assume this is the "name" field.
to make it a bit easier to read i have put all the API requests into paste bin.
Generate Envelope with 2 templates and 2 signers.
Request = http://pastebin.com/e98Dwaj8
Get First signing URL using /envelope/xxxx/views/recipient
Request =
{
"returnUrl": "http:\/\/local.example.com\/return.html",
"authenticationMethod": "none",
"email": "role1#example.com",
"userName": "TestFirstName TestSurname",
"clientUserId": "1"
}
Get recipients for envelope after first signer has completed
Response = http://pastebin.com/9VmGsE3p
Get second signing url (this shows both documents when visited)
Request =
{
"returnUrl": "http:\/\/local.example.com\/return.html",
"authenticationMethod": "none",
"email": "test#example.com",
"userName": "TestFirstName TestSurname1",
"clientUserId": "2"
}
Is there a way i can show the second signer only the second document?
Is it possible or will the completed document always show? does the /views/recipient url only hide documents in "draft" or "sent" and always shows "completed"?
note: this is a follow up to Docusign signing url - Showing document 1 of a composite template but that question was answered and solved the original issue so i thought it best to open a new more specific question.
In order for certain signers to only see certain documents, you will want to investigate the Document Visibility feature and settings. There is some starting documentation available at: https://support.docusign.com/guides/cdse-user-guide-advanced-sending-using-document-visibility-in-a-template
In short, signers can only see documents in an envelope for which they have at least 1 tab assigned. This is honored during the signing ceremony as well as any view of the completed document.
Regarding your last question, you should only be able to start a POST /recipient/view (signing ceremony) for an envelope which has been SENT. If you perform this action against an envelope which is completed it will start the signing session in a read only viewing mode (since the transaction is complete).
Is the 2nd signer a member on the sending account? If so, they would be able to see all documents in the envelope based on "Must sign to view unless Sender Account". This setting essentially means internal signers that have memberships on the same account as the Sender can see everything.

DocuSign API - Embedded Recipients

I would like to create envelopes for embedded/captive recipients using SOAP based API calls and generate a token with which a recipient can sign the envelope right after it gets created.
I have followed your documentation but am not able to create token(s) for the embedded signer(s). I am able to create an envelope but while creating the tokens, I get an error
"Invalid Signature Credentials".
According to your documentation, while creating an envelope with captive recipient,I need to pass in clientuserid for the recipient. I need to use the same clientuserid for the same recipient each time.
It looks like, I might have created an envelope with a captive recipient before but I am not using the right combination..Recipient name, email address and clientuserid every time I am creating an envelope with captive recipient(s).
1) Is there a way to reassign the clientuserid to the recipient?
2) Is there a way to retrieve the clientuserid for the recipient?
3) From the DocuSign account, how do we check if an envelope has been created with a captive recipient(s)?
4) Do we have to turn any setting on from our DocuSign account to create envelopes with captive recipients?
1) You might be able to use the Recipient Correction call to update the clientUserId for a given recipient, but if that does not work you can always remove the recipient from the envelope, then re-add as an Embedded recipient.
2) To retrieve the clientUserId value and other information for your recipients you need to make the following API call:
Get Envelope Recipient Status
URI:
/accounts/{accountId}/envelopes/{envelopeId}/recipients
Method:
GET
Sample Response:
{
"recipientCount":"String content",
"signers":[{
"deliveredDateTime": "String content",
"recipientAuthenticationStatus":{
"(authentication status result)":
"eventTimestamp":"String content"
"status":"String content"
}
},
"recipientId": "String content",
"clientUserId": "String content",
"requireIdLookup": "String content",
"roleName":"String content",
"routingOrder": "String content",
"signedDateTime": "String content",
"status": "String content",
"email": "String content",
"name": "String content" }]
}]
}
3) I'm not sure if you can check through the DocuSign Console, the API call described above will indicate if a given recipient is captive or not. If the have a clientUserId value defined, they are embedded - otherwise they are a remote signer.
4) Yes, this is a feature that you're API integration would need to include in its account plan. Talk to your DocuSign account manager for more information.

Docusign Powerforms Embed Success Status

I'm working on a PHP application that has multiple products which require signing from a customer before going for the product.
I'm using powerforms link to embed them on my application (using iFrame).
They work fine. But the problem is I need to store the document signed status in my database.
The we can set a return URL in the Docusign Preferences Page. But that will be static and I won't have a clue of what product the user has selected.
References:
Powerform Docs
You can use DocuSign Connect to receive real-time notifications of envelope events (for example, Envelope Completed). At a high-level, it works like this:
You login to DocuSign web console (as Admin) and create a Custom Connect Configuration. As part of creating this configuration, you'll specify the endpoint (http address) that you want Connect to send notifications to, and which events you want to be notified of.
You build a "listener" -- i.e., the web page that will receive the HTTP POST messages from DocuSign Connect, and process those messages.
When an Envelope or Recipient event occurs (for which you've enabled notifications in your DocuSign Connect Configuration), Connect will almost immediately send an HTTP POST to your listener. This message contains XML with info about the Envelope, Recipients, Documents, Fields, etc. You'll develop your listener such that it parses the XML message to determine Envelope status, data field values, etc. and then can respond appropriately within the context of your application (i.e., in your scenario, your listener would use the XML message from Connect to determine envelope status and which product(s) the user selected).
See this guide (http://www.docusign.com/sites/default/files/DocuSign_Connect_Service_Guide.pdf) and this page in the DocuSign Dev Center (http://www.docusign.com/developer-center/explore/connect) for more detailed information on configuring/using DocuSign Connect.
UPDATE - Using Custom Fields to populate unique Identifier for Envelope
Depending on the nature of your use case, you might need to use an "envelope custom field" to populate a unique identifier for each Envelope in the "create/send envelope" request, so that your listener application has a way of identifying the envelope when it receives a Connect message. (An 'envelope custom field' is simply a custom piece of metadata on an envelope.) Simply set the customFields property in your Create Envelope request, and populate a single textCustomFields item with the unique identifier. For example:
{
"emailSubject": "Please sign this",
"emailBlurb": "Please sign...thanks!",
"customFields": {
"textCustomFields": [
{
"value": "1234567",
"required": "false",
"show": "true",
"name": "ProductId"
}
]
},
"status": "sent"
...
}
See the REST API Guide (http://www.docusign.com/sites/default/files/REST_API_Guide_v2.pdf) for more detailed info about using Custom Envelope Fields.

Resources