It's not possible to customize the Email Subject for DocuSign Completed/Voided/Declined emails at runtime on a per-envelope basis purely by using the API. However, you can achieve somewhat "runtime" control over email contents by using Branding and customizing the Email Resource File to specify the subject for the Decline Envelope Email. At a high-level, you'd do this by doing the following:
- Use the DocuSign web UI to login as an Admin user and create a new Brand for the account.
- Edit the Email Resource File that's associated with the brand to specify the custom subject for the envelope completion email.
- When sending the Envelope via the API, specify
brandId
within the Create Envelope request to specify the id of the Brand you created in step 1 (and customized in step 2).
So, for example, let's say you had 5 different variations of email subject for Declined Envelopes -- and wanted to be able to specify (via the API) which one to use for each Envelope that you create/send via API. You'd create 5 separate Brands via the DocuSign web UI, customize the Email Resource File for each of those 5 brands (to specify the Email Subject to use for the Declined Envelope email), then when you create/send an Envelope with the API, set brandId
to specify the Brand that contains the Declined Envelope subject that you want to use for that Envelope (if a signer declines to sign).
The answer on this SO thread contains additional info about this procedure, and the docs I've linked to above contain info about branding and the email resource file.