I Built Docusign for AI Agents — Here's How
Source: Dev.to
AI agents can draft contracts, negotiate terms, and finalize language, but the moment a signature is required the workflow breaks. Traditional e‑sign services (DocuSign, HelloSign, Adobe Sign) rely on browsers, OAuth flows, or manual steps that aren’t suited for non‑human senders.
I built signb.ee – a document‑signing infrastructure designed for AI agents.
Introducing signb.ee
signb.ee provides a single API call that accepts markdown (the native output format of most LLMs) and handles the entire signing ceremony:
- Converts markdown to a clean PDF
- Verifies the sender (API key or email OTP)
- Emails the recipient a signing link
- Lets both parties choose a signature style and sign
- Returns a SHA‑256‑certified PDF with a tamper‑proof signing certificate
No SDK, no OAuth dance, no browser automation.
API Example
curl -X POST https://signb.ee/api/v1/send \
-H "Content-Type: application/json" \
-d '{
"markdown": "# Mutual NDA\n\nTerms here...",
"sender_name": "Alice",
"sender_email": "alice@company.com",
"recipient_name": "Bob",
"recipient_email": "bob@acme.com"
}'How signb.ee Works
- Markdown → PDF – The service renders the markdown into a PDF.
- Sender verification –
- Without API key: an email OTP is sent to the sender.
- With API key: the sender is pre‑verified, skipping the OTP.
- Recipient flow – The recipient receives an email with a signing link, chooses a signature style, and signs.
- Certificate – Both parties receive a PDF that includes a SHA‑256 hash and a signing certificate.
Implementation Details
PDF Generation
I originally tried Puppeteer (HTML → screenshot → PDF), but the 50 MB Chromium binary caused massive cold‑starts on serverless platforms. Switching to pdf‑lib, a pure‑JavaScript PDF library, eliminated native dependencies and reduced bundle size by 95 %.
import { PDFDocument, rgb, StandardFonts } from "pdf-lib";
const pdfDoc = await PDFDocument.load(originalPdfBytes);
const page = pdfDoc.addPage([595, 842]); // A4
const helveticaBold = await pdfDoc.embedFont(StandardFonts.HelveticaBold);
page.drawText("SIGNING CERTIFICATE", {
x: 50,
y: 750,
font: helveticaBold,
size: 18,
color: rgb(0.1, 0.1, 0.1),
});
// ... add signatures, timestamps, SHA‑256 hashCold‑start times dropped from ~8 s to < 500 ms.
Authentication Options
| Mode | How it works |
|---|---|
| API‑key | Sender is pre‑verified; recipient gets the signing link instantly. |
| OTP | Sender receives an email with a one‑time code; minimal friction, no prior setup. |
Cookie Bug with BetterAuth
In production the authentication cookie was prefixed with __Secure- on HTTPS, while the middleware only looked for better-auth.session_token. The fix is a one‑liner:
// Before (broken in production)
const session = request.cookies.get("better-auth.session_token");
// After (works everywhere)
const session =
request.cookies.get("__Secure-better-auth.session_token") ||
request.cookies.get("better-auth.session_token");If you use BetterAuth over HTTPS, ensure you check both cookie names.
End‑to‑End Flow
- Agent →
POST /api/v1/send- Markdown → PDF, uploaded to blob storage
- Sender gets OTP email (or is pre‑verified)
- Sender clicks verification link → creates account, chooses signature style, signs → recipient receives signing link
- Recipient clicks link → reviews PDF, chooses signature style, signs → both receive final PDF with certificate
Signing Certificate Contents
- Names and signatures of both parties
- UTC timestamps for each signature
- IP addresses of signers
- SHA‑256 hash of the complete document
- Verification URL
Future Work
- MCP server discovery – Allow agents (Claude, Cursor, Windsurf, etc.) to discover signb.ee automatically via a tool description, removing the need for manual docs.
- Webhook notifications – Emit a webhook when a document is fully signed, enabling fully automated agent workflows without relying on email.
API Availability
The API is live at https://signb.ee with a free tier (5 documents/month). No credit card is required.
Installation for Agent Skills
npx skills add signbee/skill --skill signbee -gThe OpenAPI spec and llms.txt are available for agent consumption.
Feedback
I’m looking for feedback on the API design, especially from anyone building agent workflows. What’s missing? What would make this more useful for your agents?