Reputation: 3
I'm requesting a signature by email using an existing template.
After using JWT grant for successful authorization, I call the api function docusign.EnvelopesApi(dsApiClient).createEnvelope
with a new envelope including my templateId.
The call results in the error: {"errorCode":"TEMPLATE_ID_INVALID","message":"Invalid template ID."}
async function main(){
const args = makeEnvelope({
email: "signer email",
name: "Signer name",
templateId: "some template id",
});
// Make the envelope request body
let envelope = makeEnvelope(args)
let results = await new docusign.EnvelopesApi(dsApiClient).createEnvelope(
accountInfo.apiAccountId, {envelopeDefinition: envelope});
return results;
}
function makeEnvelope(args){
let env = new docusign.EnvelopeDefinition();
env.templateId = args.templateId;
let signer = docusign.TemplateRole.constructFromObject({
email: args.signerEmail,
name: args.signerName,
roleName: 'signer'});
env.templateRoles = [signer];
env.status = "sent";
return env;
}
main();
Upvotes: 0
Views: 530
Reputation: 14005
This error can mean:
I cannot tell which one it is, you will have to contact support for this. But instead of just double-checking your ID, you need to also double check the env (prod vs. dev) as well as the accounts, make sure it's from the same account.
Upvotes: 1