1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
const axios = require('axios') const path = require('path') const fs = require('fs') const docusign = { accountID: 'your account id', username: 'your email address', password: 'your password', integratorKey: 'xxxxx-xxxx-xxxx-xxxx-xxxxxxx' } const fileBytes = fs.readFileSync(path.resolve(__dirname, '1538129760865_gg2pbkcnkn9.pdf')) // file const base64Doc = Buffer.from(fileBytes).toString('base64') axios({ method: 'post', url: `https://demo.docusign.net/restapi/v2/accounts/${docusign.accountID}/envelopes`, headers: { 'X-DocuSign-Authentication': JSON.stringify({ "Username": docusign.username, "Password": docusign.password, "IntegratorKey": docusign.integratorKey }), 'Content-Type': 'application/json' }, data: { "recipients": { "signers": [ { "name": "Arjun", "recipientId": 1, "tabs": { "signHereTabs": [ { "xPosition": "120", "yPosition": "36", "documentId": "1", "pageNumber": "1" } ] } } ] }, "emailSubject": "DocuSign API - Signature Request on Document Call", "documents": [ { "documentId": "1", "name": "blank1.pdf", "documentBase64": base64Doc } ], "status": "sent" } }).then(console.log).catch(console.log) |