Get Template Details
This guide walks you through retrieving the details of an eSign template using the Stewart Sign API. Template details include the template name, roles, and free-text fields — all of which are required when creating an eSign session from a template.
When to Use
Retrieving template details is useful when you need to:
- Inspect a template's roles before assigning participants
- Discover available free-text fields for document generation
- Validate template IDs before creating a session from templates
Note: This endpoint requires the
apiTemplatingEsignfeature to be enabled for your organization. Contact Stewart Sign support if you receive a401 Unauthorizedresponse.
Requirements
- You need to have Node.js installed on your system.
- You'll also need the axios library. You can install it using the following command:
npm install axios
- A valid Bearer token (JWT) for authentication.
- The template ID (UUID) of the template you want to retrieve.
Endpoint
GET /esign/templates/{id}
| Parameter | Type | Required | Description |
|---|---|---|---|
id | string (UUID) | Yes | The unique identifier of the template. |
Code Snippet
Use the following code snippet to retrieve template details. Replace <templateId> with the actual template ID, and <accessToken> with your API access token.
const axios = require("axios");
const templateId = "<templateId>";
const config = {
method: "get",
url: `https://public-api.sign.stewart.com/esign/templates/${templateId}`,
headers: {
Authorization: "Bearer <accessToken>",
},
};
axios(config)
.then(function (response) {
console.log("Template details:", response.data);
})
.catch(function (error) {
console.log(error.response?.data || error.message);
});
Successful Response
On success, the API returns the template details including its name, roles, and free-text fields:
{
"id": "3d976a23-b865-4fcd-9165-ddc0aedaf614",
"templateName": "Mortgage Agreement",
"roles": [
{
"id": "7dfcc661-8669-4189-a375-2d8c21bbf9b0",
"name": "Buyer",
"description": "Home buyer"
},
{
"id": "a1b2c3d4-5678-90ab-cdef-1234567890ab",
"name": "Seller",
"description": "Home seller"
}
],
"freeTextFields": [
{
"id": "ba242168-4bd6-42f2-bc45-89efca12e9cf",
"name": "Terms and Conditions"
}
]
}
Response Fields
| Field | Type | Description |
|---|---|---|
id | string (UUID) | The template ID |
templateName | string | The name of the template |
roles | array | List of roles defined in the template. Each role has an id, name, and description. |
freeTextFields | array | List of dynamic text fields. Each field has an id and name. When creating a session from this template, you can provide text values for these fields. |
Error Responses
| Status | Reason |
|---|---|
400 Bad Request | The id parameter is not a valid UUID |
401 Unauthorized | Invalid token or the apiTemplatingEsign feature is not enabled for your organization |
404 Not Found | No template found with the provided ID |
Steps to Execute the Code Snippet
- Create a new file named
get_template.js. - Copy and paste the code snippet provided above into the new file.
- Replace
<templateId>and<accessToken>with the appropriate values. - Save the file and open a terminal or command prompt.
- Navigate to the folder where you saved the
get_template.jsfile. - Run the following command to execute the script:
node get_template.js
If the request is successful, you'll see the template details displayed in the console. In case of an error, the error details will be displayed instead.
Additional Resources
For more information about the eSignature API, visit the API reference.
If you need further assistance or have questions, feel free to reach out to our support team.