Skip to main content

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 apiTemplatingEsign feature to be enabled for your organization. Contact Stewart Sign support if you receive a 401 Unauthorized response.

Requirements

  1. You need to have Node.js installed on your system.
  2. You'll also need the axios library. You can install it using the following command:
npm install axios
  1. A valid Bearer token (JWT) for authentication.
  2. The template ID (UUID) of the template you want to retrieve.

Endpoint

GET /esign/templates/{id}

ParameterTypeRequiredDescription
idstring (UUID)YesThe 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

FieldTypeDescription
idstring (UUID)The template ID
templateNamestringThe name of the template
rolesarrayList of roles defined in the template. Each role has an id, name, and description.
freeTextFieldsarrayList 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

StatusReason
400 Bad RequestThe id parameter is not a valid UUID
401 UnauthorizedInvalid token or the apiTemplatingEsign feature is not enabled for your organization
404 Not FoundNo template found with the provided ID

Steps to Execute the Code Snippet

  1. Create a new file named get_template.js.
  2. Copy and paste the code snippet provided above into the new file.
  3. Replace <templateId> and <accessToken> with the appropriate values.
  4. Save the file and open a terminal or command prompt.
  5. Navigate to the folder where you saved the get_template.js file.
  6. 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.