Vercel e-sign integration

Vercel hosts the marketing site, the signing middleware, and the serverless functions that call Atlas. Teams search "Vercel e-sign integration" when they want Next.js API routes to create envelopes without running a separate backend.

> Share: "Vercel API route creates the envelope. Atlas hosts review and sign pages."

Typical stack

Next.js app on Vercel
  → Route Handler POST /api/contracts/send
  → Atlas POST /api/envelope
  → Return review_url to dashboard UI
  → Atlas webhook → same app's /api/webhooks/atlas
  → Update Postgres via Vercel Postgres or Supabase

Atlas review and sign pages stay on atlaswork.ai. Your Vercel app orchestrates create and listens for completion.

Route Handler example

app/api/contracts/send/route.ts:

import { NextRequest, NextResponse } from 'next/server';

const ATLAS = 'https://atlaswork.ai/api/envelope';

export async function POST(req: NextRequest) {
  const { documentUrl, signerEmail, signerName } = await req.json();

  const res = await fetch(ATLAS, {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${process.env.ATLAS_API_KEY}`,
      'Content-Type': 'application/json',
      'Idempotency-Key': crypto.randomUUID(),
    },
    body: JSON.stringify({
      document_url: documentUrl,
      webhook_url: `${process.env.APP_URL}/api/webhooks/atlas`,
      metadata: { created_via: 'vercel-app' },
      parties: [{ email: signerEmail, name: signerName, role: 'Customer' }],
    }),
  });

  const data = await res.json();
  if (!res.ok) return NextResponse.json(data, { status: res.status });
  return NextResponse.json(data);
}

Store ATLAS_API_KEY in Vercel Environment Variables. Never expose it to the browser.

Webhook route on Vercel

app/api/webhooks/atlas/route.ts must read raw body for HMAC verification:

import crypto from 'crypto';

export async function POST(req: Request) {
  const raw = await req.text();
  const sig = req.headers.get('x-atlas-signature') ?? '';
  const key = process.env.ATLAS_API_KEY!;
  const expected = 'sha256=' + crypto.createHmac('sha256', key).update(raw).digest('hex');
  if (sig !== expected) return new Response('Unauthorized', { status: 401 });

  const event = JSON.parse(raw);
  // queue job or update DB
  return new Response('ok');
}

Disable body parsing that mutates raw bytes. In App Router, use req.text() as shown.

Edge vs Node runtime

Use Node runtime for webhook verification and file uploads. Edge can proxy lightweight status polls but multipart PDF upload is simpler on Node.

Vercel Cron for poll fallback

If corporate customers block inbound webhooks, add vercel.json cron to poll pending envelopes:

{
  "crons": [{
    "path": "/api/cron/atlas-reconcile",
    "schedule": "*/15 * * * *"
  }]
}

Cron route calls GET /api/envelopes?status=pending and reconciles stale rows.

Preview deployments

Point staging webhook_url at a stable ngrok tunnel or dedicated staging domain. Preview URLs change every deploy and break webhook registration.

Multipart upload from Vercel

When the browser uploads PDF or DOCX to your route, forward multipart to Atlas:

const form = await req.formData();
const file = form.get('file') as File;
const outbound = new FormData();
outbound.append('file', file);
outbound.append('parties', JSON.stringify(parties));

await fetch('https://atlaswork.ai/api/envelope', {
  method: 'POST',
  headers: { Authorization: `Bearer ${process.env.ATLAS_API_KEY}` },
  body: outbound,
});

Deployment checklist

  • [ ] ATLAS_API_KEY in Production and Preview envs (separate keys optional)
  • [ ] APP_URL matches production domain for webhook_url
  • [ ] Webhook route returns 2xx within ten seconds
  • [ ] Idempotency-Key on create from client reference
  • [ ] Error monitoring on 402 credit exhaustion

MCP on the same project

Founders may also connect Claude to Atlas MCP while engineers use Vercel routes for customer-facing flows. Same Atlas account, different entry points. See /mcp.

Environment variables per branch

Map Vercel Preview, Production, and Development to separate Atlas API keys when you want hard separation. Document which key backs customer demos versus internal dogfood. Rotating production keys should not require redeploying preview branches if previews use their own env scope.

Rate limits and cold starts

Atlas create is fast relative to field detection. Your route returns review_url immediately while detection continues async. UI should poll envelope status or disable Send until fields_status is ready. Vercel function cold start adds latency to webhook ACK; keep webhook handlers thin and queue heavy work to background jobs.

Local development

Run vercel dev with .env.local holding ATLAS_API_KEY. Point webhooks at ngrok tunnel URL and update a dev envelope create call when tunnel restarts. Stable tunnel domains save hours during webhook debugging.

Middleware folder layout

Suggested Next.js layout:

app/api/contracts/send/route.ts
app/api/webhooks/atlas/route.ts
lib/atlas/verify-webhook.ts
lib/atlas/create-envelope.ts

Shared helpers keep route files under 80 lines for reviewability.

FAQ

Does Atlas run on Vercel? Atlas production is hosted separately. Your Vercel app is the integrator.

Serverless timeout? Atlas create returns quickly with review_url. Field detection continues async. Poll before send.

Can I embed sign in Vercel page? Signers can use tokenized sign URLs you redirect to. Full iframe embed is a custom UX choice.

DOCX uploads? Supported on multipart create path.

Credits? Sends consume credits at POST /send time. Draft create on Vercel is free.

API reference

Full route list and request schemas live at /dev. Start with E-signature API for the mental model, then use this guide for copy-paste examples.