Skip to navigation

How to require ID verification (IDV) for a recipient

View as Markdown
eSignature REST API 2.1 only

This topic demonstrates how to request a signature via email while also using ID verification authentication.

Run this code example from our Quickstart or launcher projects: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.

Required data

Running the code in this how-to requires this data:

Data elementDescription
{API_ACCOUNT_ID}A GUID value that identifies your account. This value is automatically generated by Docusign for any account you create. Copy the value from the API Account ID field on the Apps and Keys page.
{BASE_PATH}A string value that forms the root of the URL required to make API calls. The base path value in the example code is set to target the developer environment at
https://<domain>/restapi
Where <domain> is demo.docusign.net for the developer environment and is the result of the GetUserInfo call in production.
{RECIPIENT_ID}A unique string value that you assign to identify each recipient. This value assigns tabs on a per-recipient basis.
{SIGNER_EMAIL}A string value for the email address where the signer will receive a notification of the signing request.
{SIGNER_NAME}A string value for the full name of the signer.
{WORKFLOW_ID}A GUID value that identifies the ID verification workflow assigned to your account when IDV is enabled.

Step 1. Obtain your OAuth token

To make the API calls shown in this how-to, you need a valid OAuth access token. Docusign supports access tokens for three different recommended OAuth grant types: Public Authorization Code Grant, Confidential Authorization Code Grant, and JSON Web Token (JWT) Grant. Choose the OAuth grant type appropriate for your scenario.

See Confidential Authorization Code Grant for guidance on your options to get an Confidential Authorization Code Grant OAuth token.

Three icons that represent the three methods a user can use to obtain an OAuth token: JSON Web Token (JWT), Public Authorization Code Grant (ACG), and Confidential Authorization Code grant

Step 2. Construct your API headers

After you have a valid OAuth access token, you are ready to construct the API headers that you will pass to the API call. Construct your headers like this, but make sure to substitute your valid OAuth access token for {ACCESS_TOKEN}.

declare -a Headers=('--header' "Authorization: Bearer ${ACCESS_TOKEN}" \
'--header' "Accept: application/json" \
'--header' "Content-Type: application/json")

Step 3. Obtain your workflow ID

To configure recipient authentication for IDV, you must provide your workflow ID in the request body. Call the IdentityVerifications:list endpoint using your {API_ACCOUNT_ID} to retrieve the workflow ID. Different workflow IDs can be specified per recipient. If you do not have IDV configured for your account, the identity_verification call will return an empty array. Omitting a workflow ID or providing an invalid workflow ID will cause your IDV request to fail.

echo ""
echo "Attempting to retrieve your account's workflow ID"
echo ""
response=$(mktemp /tmp/response-bs.XXXXXX)
Status=$(curl -w '%{http_code}' -i --request GET "https://demo.docusign.net/restapi/v2.1/accounts/${account_id}/identity_verification" \
"${Headers[@]}" \
--output ${response})
#If the Status code returned is greater than 201 (OK / Accepted), display an error message along with the API response.
if [[ "$Status" -gt "201" ]] ; then
echo ""
echo "Unable to retrieve your account's workflow ID."
echo ""
cat $response
exit 0
fi
echo ""
echo "Response:"
cat $response
echo ""
# Retrieve the workflow IDs from the API response and put them in an array.
workflowIds=`cat $response | grep -o -P '(?<=workflowId\":\").*?(?=\")'`
# Get the index of the default workflow based on name and use that index for workflowId.
# Workflow name of the default workflow is 'DocuSign ID Verification'
workflowNames=`cat $response | grep -o -P '(?<=defaultName\":).*?(?=,)'`
element="DocuSign ID Verification"
workflowId=$(GetWorkflowId "$workflowNames" "$element" "$workflowIds")

Step 4. Construct the request body

Next, create the request body. Replace {RECIPIENT_ID}, {SIGNER_NAME}, {SIGNER_EMAIL}, and {WORKFLOW_ID} with your recipient’s data in the JSON request body.

Note: The sample code provided uses fixed positioning for the signHere tab. If your Docusign account has Document Visibility enabled (via Sending Settings in eSignature Admin), and you have not placed a tab for each signer, you will receive this API error: “Freeform signing is not allowed for your account because it conflicts with other settings, please place fields for each signer.”

Tip: The example Base64-encoded document shown here is a generic sample that you can copy and paste into your own code for testing. There are many free online Base64 encoders/decoders, such as FreeFormatter.com, that you can use to encode the documentBase64 property.

printf \
'{
"documents": [{
"documentBase64": "' > $request_data
cat $doc_base64 >> $request_data
printf '",
"documentId": "1",
"fileExtension": "txt",
"name": "NDA"
}],
"emailBlurb": "Sample text for email body",
"emailSubject": "Please Sign",
"envelopeIdStamping": "true",
"recipients": {
"signers": [{
"name": "'"${RECIPIENT_NAME}"'",
"email": "'"${RECIPIENT_EMAIL}"'",
"roleName": "",
"note": "",
"routingOrder": 1,
"status": "created",
"tabs": {
"signHereTabs": [{
"documentId": "1",
"name": "SignHereTab",
"pageNumber": "1",
"recipientId": "1",
"tabLabel": "SignHereTab",
"xPosition": "200",
"yPosition": "220"
}]
},
"templateAccessCodeRequired": null,
"deliveryMethod": "email",
"recipientId": "1",
"identityVerification": {
"workflowId": "'"${workflowId}"'",
"steps": null
},
"idCheckConfigurationName": "",
"requireIdLookup": false
}]
},
"status": "Sent"
}
' >> $request_data

Step 5. Call the eSignature REST API

Now that you have constructed your API headers and request body, you can send the envelope with the Envelopes:create method. Here’s how you make the call, but make sure to substitute your API account ID for {ACCOUNT_ID}.

View the source code for this how-to on GitHub: Bash, C#, Java, Node.js, PHP, PowerShell, Python, or Ruby.

curl --request POST "https://demo.docusign.net/restapi/v2.1/accounts/${account_id}/envelopes" \
"${Headers[@]}" \
--data-binary @${request_data} \
--output ${response}

Expected response

If you run this code example from our Quickstart or launcher projects, you should see a JSON response similar to the code shown.

Sample response
{
"envelopeId": "4e5e1569-xxxx-xxxx-xxxx-f18fc5609b48",
"uri": "/envelopes/4e5e1569-xxxx-xxxx-xxxx-f18fc5609b48",
"statusDateTime": "2020-08-04T00:15:50.1300000Z",
"status": "sent"
}

Next steps