Skip to main content
Newcomer
September 1, 2026
Question

How to fetch envelopes created from a specific template ID without custom fields?

  • September 1, 2026
  • 0 replies
  • 7 views

Hello Developers, I’m Hudson.
 
In our integration, we create templates (name, description, upload document, add recipients, add fields, save). From the template list we copy the unique templateId from the history screen. When sending envelopes in bulk, we currently paste that templateId into a custom field (TEMPLATE_ID) and then use EnvelopesApi.listStatusChanges with options.setCustomField("TEMPLATE_ID=...") to filter envelopes. This works fine — we can import only the envelopes created from that template.

However, if we don’t add the custom field at envelope creation, the envelope JSON does not expose the templateId directly. We can fetch envelopes, but we cannot tell which template they were created from.

Code snippet (current approach):

EnvelopesApi.ListStatusChangesOptions options = envelopesApi.new ListStatusChangesOptions();
options.setFromDate(fromDate);
options.setFromToStatus("sent,delivered");
options.setCustomField("TEMPLATE_ID=" + templateId);

EnvelopesInformation envelopesInfo = envelopesApi.listStatusChanges(accountId, options);

 

Question: Is there a native way in the DocuSign API/Java SDK to query envelopes by their originating templateId (DocGen or non‑DocGen) without relying on custom fields? For example, can listStatusChanges or another endpoint return or filter by envelopeTemplateDefinition.templateId? Or is the recommended approach always to set a custom field at envelope creation and use that for filtering?


Thanks,

Hudson.