The docusign website allows for me to save a document as a template, but I have not been able to find a way to do this programmatically through the API. Is there a simple way to save a document as a template?
Yes, you can create a Template via the API by issuing this request:
POST /v2/accounts/{accountId}/templates
The API documentation contains details about this operation.
UPDATE
Do I understand correctly that your goal is to create a Template that's based upon an existing DocuSign Document, i.e., to mimic the following functionality in the DocuSign web UI?
If that's the case, then I'm not aware of any single API call that can do this. Instead, I believe you'll need to issue a series of API calls, to retrieve info about the existing Document(s) and then create the new Template using that info:
1) Get information about the existing DocuSign Document (envelope): GET /v2/accounts/{accountId}/envelopes/{envelopeId} (docs)
This operation returns recipient info (including tabs for each recipient) as well as envelope data like email subject, email body, reminders, etc. It also returns a documentsUri property that you can use to get the document(s) that belong to the envelope.
2) Get the list of document(s) that the envelope contains by issuing a GET request to the URI specified by the documentsUri from the prior response. (docs)
This operation returns information about each document in the specified envelope, but does not return document contents.
3) For each document listed in the prior API response, issue a GET request to the URI specified by the uri property for the document. (docs)
4) Finally, create a new Template using the data that you received in response to the previous API requests: POST /v2/accounts/{accountId}/templates (docs)
Note: As a final note -- if you're using one of the DocuSign SDKs, it's possible that there might be a function that you can call to implement this scenario, without having to piece together all of these API calls yourself. I'm not familiar enough with the SDKs to say whether or not they provide this type of functionality, but it'd be worth checking for, if you're using an SDK.
Related
I would like to create a custom connector into Power Automate to void the DocuSign envelope (contract).
But the issue is I don't want to pass the envelope id as in URL this envelope id will be dynamic/parameter.
I know, we can pass this url
https://{{environment}}.docusign.net/restapi/v2.1/accounts/{{AccountID}}/envelopes/{{envelopeId}}
but here envelopeId will be fixed, I want to send as dynamic or as parameterized one or any random one.
Please help how can I use a dynamic envelope ID not fixed one.
Your question is really a Power Automate question, so I added the Power-Automate tag. I just did a quick google search and found this solution for a dynamic URL by using braces for the variable in the URL path. See the screenshot below.
If that doesn't work, and there is no way to use a dynamic URL path value as the envelope ID, then you will need to create your own API and API server.
Your server would receive the envelope ID as a parameter in the request body, and then make the appropriate API call to DocuSign.
DocuSign's use of variables in the URL path is standard REST. So I'd be very surprised if Power Automate still does not support this API pattern. (But you may need to update to the latest Power Automate version.)
I am using the embedded UI for template and document creation. I want to know the data which are being filled in the UI and also have to store them in my DB and then hit to 3rd party tools for signing. Is this flow possible to store the data in my DB?
With the HelloSign API, you have a few options to get information on the template:
The Get Template Endpoint
GET /template/[:template_id]
Gets general template details and includes a list of Accounts that can access it
https://app.hellosign.com/api/reference#get_template
The Get Template Files Endpoint
GET /template/files/[:template_id]
Obtains a copy of a template's original files.
https://app.hellosign.com/api/reference#get_template_files
And lastly, if you want the info that is being entered by the signer, you can poll the API or listen for callbacks that will supply you with said data to store in your DB.
https://app.hellosign.com/api/eventsAndCallbacksWalkthrough (best practice)
The Get Signature Request Endpoint can be used to poll this information
GET /signature_request/[:signature_request_id]
Gets a SignatureRequest that includes the current status for each signer.
https://app.hellosign.com/api/reference#get_signature_request
I'm using the docusign api and am having some trouble with a query string param. Basically I'm trying to grab the recipient information of an envelope along with the status of the envelope in a single call.
I am able to grab each of information individually with the following api calls and they both work
1.) Envelope endpoint (has a status field with overall envelope status such as Signed, Voided, Declined, etc...):
https://na2.docusign.net/restapi/v2/accounts/:accountId/envelopes/:docusignEnvelopeId/
2.) Envelope/recipients endpoint (has information regarding recipients)
https://na2.docusign.net/restapi/v2/accounts/:accountId/envelopes/:docusignEnvelopeId/recipients
However, I'm trying to see if I can grab these information all within one API call. According to the docs here for the general envelope endpoint, I think I should be able to with a query param
https://developers.docusign.com/esign-rest-api/reference/Envelopes/Envelopes/get#request.
Under the include Optional Query Parameters section, there's a param for "include" which says I can grab recipients from the 1st endpoint. "Specifies additional information about the envelope to return. Enter a comma-separated list, such as tabs,recipients. Valid values are..."
I've been trying to modify the first endpoint with this include param to look something like this...
https://na2.docusign.net/restapi/v2/accounts/:accountId/envelopes/:docusignEnvelopeId?include=recipients
But I have been unable to have recipients show up as well. Was wondering if I'm just typing in the param wrong or if this is not available anymore. Any help would be appreciated!
Thanks :)
The include parameters were added in v2.1 of the eSignature API, so they don't work in v2. Changing your URL to https://na2.docusign.net/restapi/v2.1/accounts/:accountId/envelopes/:docusignEnvelopeId?include=recipients should return the recipient info.
I am trying to access the custom field values for documents that I download. I am able to list the completed envelopes and download the documents, but the custom fields are showing up as empty?
var docFields = envelopeApi.ListDocumentFields(AccountID, envelopeId, docId);
Console.WriteLine(docFields.DocumentFields.Count);
Count is always zero even though the custom fields have been filled in by the user?
The endpoint which you calling is to download the document custom fields which is added by the sender as the metadata of the document. It will not help you in downloading the form data entered by the signer on the document. To download form data via API, you can use GET /v2/accounts/{accountId}/envelopes/{envelopeId}/form_data, more details available at getFormData DS Docs. You can also use to download tab details for the recipients using GET /v2/accounts/{accountId}/envelopes/{envelopeId}/recipients/{recipientId}/tabs, more details available at Download Recipient tab data
Most recommended way is to setup DS Connect so that you do not have to poll DS API to get envelope status or form data etc, instead host a webservice on your side and configure the same in DocuSign so that DocuSign can push the required data to your webservice in an XML format.
I have been successfully using DocuSign embedded signing in a J2EE application, using the createEnvelopeFromTemplates SOAP API, 1 template and 1 document to create 1 document in an envelope for 2 signers.
Now I am implementing a case with more than two signers. There are some checkboxes contained within the document. The chechboxes are to be checked by one of the signers. Not all signers sign each document, and which signer checks the checkboxes is determined at envelope creation time, based on which signers are actually present.
I tried to implement this case by using a set of templates with:
One template for all the possible signatures
Templates tagged for each possible signer that could fill in the checkboxes.
At envelope creation time, my website has collected the information to know which signers are present, and which signer will fill in the checkboxes. The appropriate templates are referenced in the call to DocuSign to create the envelope, and the appropriate roles are assigned. The problem is that when specifying multiple templates with the createEnvelopeFromTemplates operation, each TemplateReference object requires a document. I can't figure out how to tell the API to apply the multiple templates to the same document, so I will end up with a single document in the envelope.
Reading the DocuSign documentation, it appears that using createEnvelopesFromTemplatesAndForms with CompositeTemplates might work, but I would prefer to stay with the simpler CreateEnvelopeFromTemplates. Is there a way to apply multiple templates to a single document using CreateEnvelopeFromTemplates?
Thanks, Mark
You will need to use CompositeTemplates to solve this. The CreateEnvelopeFromTemplates() call that you are making adds what are known as ServerTemplates to your envelope, and since each server template contains a document (i.e. you can't save a design-time template in the DocuSign Console without providing a document) each time you add a server template to an envelope it adds the document too.
Using CompositeTemplates you can add ServerTemplates as well as InlineTemplates to your envelopes which means you can start with the template with the document(s) then use the properties of a second (inline) template without including its documents. Therefore, the SOAP call you should instead make is
CreateEnvelopeFromTemplatesAndForms()
And using the RoleName property you can assign your recipients to the template roles you have already created at design-time.
I was going to suggest testing this through the API Explorer but remembered you're using the SOAP API not REST and that's for testing with REST, so instead probably your best bet is the SOAP documentation and the samples found in the SOAP SDK on GithUb:
DocuSign SOAP SDK
SOAP Guide - CreateEnvelopeFromTemplatesAndForms
There are sample CreateEnvelopeFromTemplatesAndForms() calls in the SDK that show how to make the call.
We have found a solution that seems to work. We are still using the CreateEnvelopeFromTemplates operation, but we combined our templates into one and have a created a new role, "Question Answerer", and assigned all the checkboxes to that role. At envelope creation time, when we specify the role assignments, we specify the ID of the appropriate signer to both the signature role and the "Question Answerer" role.
Although we did not find a way to apply multiple templates to a single document using CreateEnvelopeFromTemplates, the above solution solves our problem.
Thanks, Mark