Search code examples
c#docusignapi

Dynamically add text/data to a DocuSign template


I'm implementing an API that is written in C# using ASP.NET Web API. The implementation of our API calls out to DocuSign e.g. in order to request signatures for contracts. Our application interacts with DocuSign through its REST API.

I would like to be able to create a template for our contract document and then simply reference this template when sending the contract via the REST API.

The issue I have is that the contract document needs to include data that is queried from our database, e.g. a list of products that are specific to a recipient.

Is it possible to add placeholders in the template that can then be replaced, via the REST API, with recipient-specific text/data that is queried from a database?


Solution

  • Yes this is easy to do through the API. Let's say you want to get a person's name and SSN and have a template that has two data fields in it called ApplicantName and ApplicantSSN. By referring to the tabLabel of each you can dynamically set their values, so for instance:

    {
        "accountId": "221765",
        "emailSubject": "DocuSign API Example",
        "templateId": "44D9E888-3D86-4186-8EE9-7071BC87A0DA",
        "templateRoles": [
            {
                "email": "[email protected]",
                "name": "Sally Doe",
                "roleName": "RoleOne",
                "tabs": {
                    "textTabs": [
                        {
                            "tabLabel": "ApplicantName",
                            "value": "John Doe"
                        },
                        {
                            "tabLabel": "ApplicantSSN",
                            "value": "12-345-6789"
                        }
                    ]
                }
            }
        ],
        "status": "sent"
    }
    

    Just make sure you exactly match the name you set in the UI with the tabLabel you set through the API call.