Developer Guide · Node.js

How to add e-signatures
in Node.js

Add legally binding e-signatures to a Node.js app in four steps with the GetSigned REST API: get a token, create an envelope with FormData, send the signing link, and handle the completion webhook. Node 18+ only — no SDK required.

Get free API keys →
1

Get a bearer token

Exchange your OAuth2 client credentials for a short-lived access token. Node 18+ has global fetch — no dependencies needed.

javascript
const res = await fetch('https://api.getsigned.app/oauth/token', {
  method: 'POST',
  headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
  body: new URLSearchParams({
    grant_type:    'client_credentials',
    client_id:     process.env.GETSIGNED_CLIENT_ID,
    client_secret: process.env.GETSIGNED_CLIENT_SECRET,
  }),
});
const { access_token: token } = await res.json();
2

Create an envelope

Upload the PDF and declare signers and fields with FormData. Node 18+ ships FormData and Blob natively.

javascript
import { readFile } from 'node:fs/promises';

const form = new FormData();
form.append('document', new Blob([await readFile('nda.pdf')]), 'nda.pdf');
form.append('signers', JSON.stringify([{ name: 'Jamie', email: 'jamie@client.io' }]));
form.append('fields',  JSON.stringify([{ type: 'signature', page: 1, x: 420, y: 580 }]));

const res = await fetch('https://api.getsigned.app/v1/envelopes', {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
  body: form,
});
const envelope = await res.json(); // { id: 'env_...', status: 'draft' }
3

Send for signing

Sending generates a tokenized, single-use link per signer and emails it. Signers verify identity with email/SMS OTP.

javascript
await fetch(`https://api.getsigned.app/v1/envelopes/${envelope.id}/send`, {
  method: 'POST',
  headers: { Authorization: `Bearer ${token}` },
});
4

Handle the completion webhook

When the last signer finishes, GetSigned seals the document and POSTs envelope.completed to your endpoint. Verify the HMAC-SHA256 signature over the raw body before trusting it. Your app never polls.

javascript
import express from 'express';
import crypto from 'crypto';

const app = express();
const SECRET = process.env.GETSIGNED_WEBHOOK_SECRET;

// Capture the raw body so the HMAC matches byte-for-byte
app.post('/webhooks/getsigned', express.raw({ type: '*/*' }), (req, res) => {
  const sig = req.get('X-GetSigned-Signature') || '';
  const expected = crypto.createHmac('sha256', SECRET).update(req.body).digest('hex');
  const a = Buffer.from(sig), b = Buffer.from(expected);
  if (a.length !== b.length || !crypto.timingSafeEqual(a, b)) {
    return res.sendStatus(401);
  }

  const payload = JSON.parse(req.body.toString('utf8'));
  if (payload.event === 'envelope.completed') {
    // GET /v1/envelopes/:id/document → sealed PDF, then update your DB
  }
  res.sendStatus(200);
});

Frequently asked questions

How do I add e-signatures in Node.js?

Use the GetSigned REST API from any Node 18+ app with built-in fetch: POST your client credentials to /oauth/token for a bearer token, create an envelope by POSTing a PDF with signers and fields as FormData, send it to generate signing links, then handle the envelope.completed webhook to fetch the sealed PDF. No SDK is required.

Do I need an SDK or extra dependencies?

No. Node 18 and later include fetch, FormData, and Blob natively, so the entire integration uses the standard library plus your web framework. The API is a plain REST API, so any HTTP client works.

Is there a free tier to build against?

Yes. The free Starter plan includes full REST API access, PKCS#7 sealing, OTP verification, and webhooks, with 5 envelopes per month — enough to build and test a complete Node.js integration before upgrading.

Language-agnostic version: How to add e-signatures to your app

Ship signing in your Node app today

Get free API keys →