Create documents from templates with API

It's great to see the API is currently working with GET requests. I'd love to see a GET /api/templates route added.

On top of that, the biggest feature I'd use the API for would be triggering sending of a document based off a template.

Something along the lines of:

GET /api/templates/<templateId>
Response Body:

{
    "name": "NDA Template",
    "signers": [
        {
            "signerId": "<signerId1>",
            "name": "x Signatory 1",
            "customFields": [
                {
                    "id": "job_title",
                    "type": "string",
                    "name": "Job Title"
                }
            ]
        },
        {
            "signerId": "<signerId2>",
            "name": "x Signatory 2",
        },
    ]
}

POST /api/documents
Request Body:

{
    "templateId": "<templateId>",
     "externalId": "<externalId>",
     "name": "NDA 1",
     "signers": [
            {
                "signerId": "<signerId1>",
                "name": "x Signatory 1",
                "email": "signatory1@example.com",
                                "redirectUrl": "https://example.com/thank-you",
                "customFields": [
                    {
                        "id": "job_title",
                        "value": "General Manager"
                    }
                ]
            },
            {
                "signerId": "<signerId2>",
                "name": "x Signatory 2",
                "email": "signatory2@example.com",
                                "redirectUrl": "https://example.com/thank-you"
            }
     ]
}

A couple of things worth noting:

  • I've added a customFields entity to a template, so this could be mapped to a field for a particular signer. This way you could pre-fill those fields on behalf of a signer.
  • externalId has been added on the document creation which could then be returned on GET /api/documents. People could use this to refer back to an external system ID that triggered the document.
  • Ability to set custom redirectUrls per signer is particularly interesting to me too. The ability to integrate this into an overall flow would be great. Potentially that feature is only available on a higher tier (as referenced in my other feature requests).

Happy to help with testing too!

Thanks again.