I’m writing an integration that will need to email the same document to hundreds of different people to sign. The application should run with no user intervention, so I’m using a JWT Grant and have setup a template for my document to be signed. My code can successfully use the JWT grant to get a Bearer token. But, when I use the Bearer token to call the eSignature API for sending an envelope, I get an HTML page back. I do not get a document set to the signer. I’m getting some type of error, but the returned HTML is no help on what the error is.
URL I’m calling: https://account-d.docusign.com/v2.1/accounts/<my account id>/envelopes
POST body:
{
"templateId": "dd5bb40b-2801-4434-babe-1e01eccc8ded",
"templateRoles": "
{
"name": "Eric Calvert",
"email": "xxxxxxxxxx@xxxxx.com",
"roleName": "signer"
}
],
"status": "sent"
}
Code snippet (golang):
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", token))
req.Header.Set("Accept", "application/json")
resp, e := http.DefaultClient.Do(req)
if e != nil {
return fmt.Errorf("http error: %s", e.Error())
}
Returned HTML:
<!DOCTYPE html>
<html lang="en" class="account-server">
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0">
<title>Docusign</title>
<link rel="icon" href="https://docucdn-a.akamaihd.net/olive/images/2.64.0/global-assets/ds-icons-favicon-defa ult-64x64.svg" type="image/svg+xml">
<link rel="canonical" href="https://account-d.docusign.com/" />
<base href="/">
<script type="text/javascript" nonce="MgGVdMvJN/5iUFyapGzPFQUR58AgZ2q9q8VWI37Okaw=">
window.__KAZMON_CONFIG__ = {
buildVersion: "25.2.100.26629",
environment: "DEMO",
instrumentationKey: "88d193ed-7206-4e34-975a-193a4fd08e36"
};
window.__NEW_ROOT_API__ = "True";
var FixtureHelper = {};
</script>
<!-- 25.2.100.26629 DA1DFE179 f2d68b35-f084-482d-b2fe-a6a2736351cb -->
</head>
<body class="site-content">
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<form name="fixtureForm">
<input id="fixtureInput" type="hidden" value="{"settings&quot;:{&quot;traceToken&quo t;:&quot;f2d68b35-f084-482d-b2fe-a6a2736351cb&quot;,&quot;siteRoot&quot;:&quot;https://account-d. docusign.com/&quot;,&quot;forgotPasswordUri&quot;:&quot;https://account-d.docusign.com/forgotpassword &quot;,&quot;flowSubmissionUris&quot;:{&quot;oAuth&quot;:&quot;/oauth/auth&quot;,&quo t;sso&quot;:&quot;/saml2/login/sp&quot;,&quot;username&quot;:&quot;/username&quot;,&q uot;password&quot;:&quot;/password&quot;,&quot;web&quot;:&quot;/web/login&quot;,&quot ;signUp&quot;:&quot;/signup&quot;,&quot;securityKeyLogin&quot;:&quot;/securitykeylogin&qu ot;,&quot;resourceCredentialSecurityKeyCreation&quot;:&quot;/resources/v1/manage/security-key/create& quot;,&quot;resourceCredentialSecurityKeyLogin&quot;:&quot;/resources/v1/manage/security-key/login&qu ot;},&quot;allowGetBrowserFingerprint&quot;:true,&quot;renderInkLoginApp&quot;:true,&quot;assetPr eloaderUrl&quot;:null,&quot;pseudoLocalizationEnabled&quot;:false,&quot;rebrandingEnabled&quot;:t rue},&quot;stateData&quot;:{&quot;state&quot;:&quot;username&quot;,&quot;oAuthLoginHintQS &quot;:null,&quot;oAuthLoginHintCookie&quot;:null,&quot;usernamePostAction&quot;:null,&quot;l ogoBytes&quot;:null,&quot;data&quot;:null},&quot;error&quot;:null}" />
<input name="__RequestVerificationToken" type="hidden" value="ASckkgrUhwnObJqO-sO9gecAAAAA0" />
</form>
</body>
<script src="/ReactApp/src/vendor/html-domparser.js"></script>
<script src="/ReactApp/dist/bundle.js?version=25.2.100.26629"></script>
</html>