How to pass a "request id" to the signature request and retrieve it? - docusignapi

I'm looking to use the DocuSign REST Java API to request a signature from a template, but I'd like to include a specified request id string that I can retrieve via the envelope after the signer completes the form.
Envelope.setTransactionId("") sounded like what I wanted (though I'd rather have something permanent instead of just valid for 7 days as mentioned in the docs), so as an example I called:
envDef.setTransactionId("TRANS12345");
But when I sign the test Envelope and then query it with getEnvelope(...) and call getTransactionId() I get null.
Can anyone point me in the direction of how to properly retrieve the transaction ID, or if there is a better way of adding a permanent specified ID to a signing request?

You can use Envelope Custom Fields aka Document labels to specify additional metadata for an envelope.
See this answer for more information.

Related

Power Automate: How can I void the DocuSign envelope using Custom Connectors with a dynamic envelope id?

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.)

Grabbing docusign envelope status and recipients in a single API call

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.

DocuSign - How to get a URL that lasts longer than a few minutes?

I am using the DocuSign REST Api and noticed that the lifetime of a URL obtained using the EnvelopeViews API (https://developers.docusign.com/esign-rest-api/reference/Envelopes/EnvelopeViews/createRecipient) is only a few minutes. However, I have gotten emails in the past with DocuSign links. How are these links able to be added to an email (and therefore have a longer lifetime)?
Is there a separate API that can be used to get a longer-life link like the one in the email?
For example, here is an email that has a Review Document DocuSign link:
Good question. Here's what you can do.
Your application wants to let Larry sign a document using the
EnvelopeViews::createRecipient API call.
Your application should store the details needed for the API call in your app's database. Something like: envelopeId, signerEmail, clientUserId.
Create a guid for the database record and add it to the database record.
Now you can look up the database record via either the row's key or
via the guid. Ensure that the guid database column is indexed.
Now create a signing url that you will send to Larry. Something like:
https://myapplication.example.com/docusign-ceremony/[guid]
Send the url to Larry
When Larry clicks on the URL:
Your app is invoked
Look up the guid in the url in your database. You should find the
record that you stored there.
Retrieve all of the record's info: envelopeId, signerEmail,
clientUserId.
Call the EnvelopeViews::createRecipient API call with the data
and get back the signing ceremony url (that must be used within
5 minutes)
Redirect the user's browser to the url.
They'll sign the document(s) and then be re-directed back to your
application.
Done.
And guess what? This is pretty much what DocuSign does itself.
The response from Larry K above is correct, you would need to handle this on your side.
These are all the parameters that you can send as part of the request body for the POST {vx}/accounts/{accountid}/envelopes/{envelopeid}/views/recipient API endpoint and there are no options to set the expiration time for the recipient view that you create.
You could look into using PowerForms to see if they fit your needs. With PowerForms you can create a URL that users can click and it will allow them to fill out a specific DocuSign envelope. This might not fit your needs if you need to pre-fill some of the fields with information related to the specific recipient but it might be worth looking at.
PowerForms Documentation:
https://www.docusign.com/features-and-benefits/features/powerforms
Please correct me if I'm wrong but I think that your goal is creating the recipient view URL, creating an email formatted in a specific way and sending that email to the recipients.
If you use the branding feature you could specify the format for your email (if you want to use a specific message) and just send the envelope to your recipients. Once the recipients receive the email they'll see the message in the format that you specified and the link for accessing the envelope would be a regular DocuSign link that doesn't expire.
The link below shows how to create Brands in your account. Specifically signing brands would allow you to set the email content.
If you have multiple email formats you could create multiple brands and just specify the brandId when creating the envelope.
I hope this helps.
Branding:
https://support.docusign.com/guides/ndse-admin-guide-configure-branding

Save Docusign Document as Template through API

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.

Can I get the url for managing an envelope from the Docusign API?

I'm able to create an envelope with the API which returns the envelopeId which looks like:
13f23354-7eee-41d3-897a-c1353a1e465c
When I navigate to docusign in my browser and open the envelope the url is:
https://na2.docusign.net/MEMBER/EnvelopeSetup.aspx?ti=ad05458248c54654a16a54195bf72ffe
I don't see what that "ad05458248c54654a16a54195bf72ffe" id is. I've tried every envelope API in the documentation (many don't make sense, but I tried them anyways):
/accounts/{accountId}/envelopes/{envelopeId}
/accounts/{accountId}/envelopes/{envelopeId}/audit_events
/accounts/{accountId}/envelopes/{envelopeId}/custom_fields
/accounts/{accountId}/envelopes/{envelopeId}/email_settings
/accounts/{accountId}/envelopes/{envelopeId}/notification
/accounts/{accountId}/envelopes/{envelopeId}/templates
But that id isn't anywhere.
Is there a way to retrieve that URL id? and/or is there another way I can get the url for the envelope?
The ID that appears as part of any URL when you're using the DocuSign web console is an internal ID -- you cannot use it with the API in any way. The Envelope ID value that DocuSign returns in response to the "Create Envelope" API request is the ID that you'll want to use with any API request that requires an Envelope ID.
It's not exactly clear to me what you mean by "[url for] managing an envelope" -- but I'd suggest you explore the following operations in the DocuSign REST API Guide:
Post Envelope Correction (page 146)
Modify or Correct and Resend Recipient Information (page 137)
Post Sender View (page 149)
(I'd guess that "Post Envelope Correction" is likely what you're after.)

Resources