Using Identity Verification with templates, continued

In a previous blog post, my colleague Jonathan Sammons outlined how to add Identity Verification to a draft envelope that is based on a template. This post will look into achieving the same result, but through composite templates.

Step 1: Activate Identity Verification for your account

Before you can add Identity Verification to your envelopes, you must have the feature enabled in your DocuSign developer account. If it’s not already activated, please reach out to the DocuSign support team through DocuSign Support and request activation. You’ll also need to request activation for your production account before you can use Identity Verification there.

Step 2: Get available workflows

Obtain identity workflows available on your account (using the IdentityVerification:list API) and extract the workflowId associated with the one that you’d like to use.

Request:

GET https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/identify_verification
Headers: 
Authorization: Bearer {code}

Response:

{
    "identityVerification": [
        {
            "workflowId": "{workflowID}",
            "workflowLabel": null,
            "defaultName": "DocuSign ID Verification",
            "defaultDescription": "The signer will need to identify themselves with a valid government ID.",
            "workflowResourceKey": "ds_identify_default",
            "steps": [
                {
                    "name": "identify",
                    "type": "EnvelopeAccess"
                }
            ],
            "signatureProvider": null,
            "inputOptions": []
        },
        {
            "workflowId": "{workflowID}",
            "workflowLabel": "Phone Auth",
            "defaultName": "Phone Authentication",
            "defaultDescription": "Recipient will need to authenticate with their phone number via SMS or a phone call",
            "workflowResourceKey": "",
            "steps": [
                {
                    "type": "EnvelopeAccess"
                }
            ],
            "signatureProvider": null,
            "inputOptions": [
                {
                    "optionName": "phone_number_list",
                    "isRequired": true,
                    "valueType": "PhoneNumberList"
                }
            ]
        }
    ]
}

Step 3: Add identity verification and composite template to your envelope

Create the envelope (using the Envelopes:create API) through a composite template and add the identity verification as shown in the code below. For this example, I will be using the Phone Authentication workflow retrieved from the previous step.

Request:

POST https://demo.docusign.net/restapi/v2.1/accounts/{accountId}/envelopes
Headers: 
Authorization: Bearer {code}

JSON Payload:

{
    "compositeTemplates": [
        {
            "serverTemplates": [
                {
                    "sequence": "1",
                    "templateId": "{templateId}"
                }
            ],
            "inlineTemplates": [
                {
                    "recipients": {
                        "signers": [
                            {
                                "email": "{recipientEmail}",
                                "name": "{recipientName}",
                                "roleName": "{templateRoleName}",
                                "recipientId": "1",
                                "identityVerification": {
                                    "workflowId": "{workflowId}",
                                    "steps": null,
                                    "inputOptions": [
                                        {
                                            "name": "phone_number_list",
                                            "valueType": "PhoneNumberList",
                                            "phoneNumberList": [
                                                {
                                                    "countryCode": "{recipientCountryCode}",
                                                    "number": "{recipientPhoneNumber}"
                                                }
                                            ]
                                        }
                                    ]
                                }
                            }
                        ]
                    },
                    "sequence": "2"
                }
            ]
        }
    ],
    "status": "sent"
}

Response:

{
    "envelopeId": "cde1c205-xxxx-xxxx-xxxx-b6388f799b28",
    "uri": "/envelopes/cde1c205-xxxx-xxxx-xxxx-b6388f799b28",
    "statusDateTime": "2023-09-15T12:17:27.0270000Z",
    "status": "sent"
}

Additional resources

Ahmed Shorim
Author
Ahmed Shorim
Sr. Developer Support Advisory Engineer
Published