docs

Quickstart

From an empty project to a signed test document. Every endpoint is in the API reference, and agents can start from llms.txt. Errors always have the form {"error":{"code","message","request_id"}}. To see every call before you write one, try the live demo.

Building an agent? Two paths for your user

  • No account: if they only need to sign a PDF themselves, send them to /sign-pdf. Nothing is stored and they sign it themselves.
  • With an account: they sign in at /login, create an API key under Developers and give it to the agent. The agent uploads the PDF, places the fields (Placing fields), sends and hands out the signing links. With the “Agent: prepare only” key the user approves before anything is sent.

Free workspaces have storage and upload limits: limits. The full agent guide is llms.txt.

Three ways to run

The API is the same in all three, so the steps below work everywhere. What differs is mail, the dashboard and who holds the seal key.

  1. The standalone server, on Node or in Docker. signnative serve runs the API and the signing page as one process with a SQLite file. It starts in test mode. signnative serve --live makes real envelopes, sealed with a key of your own that is made for that data directory. It has no mail and no dashboard: sending returns one signing link per signer, the sender hands each link over, and the evidence says that no identity was checked (sender_link).
  2. Your own Cloudflare deployment. The whole web app: this API plus the dashboard, the envelope builder and the browser verifier. Mail goes through your Resend account, so signers can be checked with an emailed one-time code. The guide is docs/self-hosting-cloudflare.md in the repository.
  3. The hosted service. Sign in on signnative.com and create a key. Nothing to install. Test mode is on the same address.

The standalone server needs Node 22.16+ and, to build it, pnpm 10. The source repository is not public yet, so the first two work from the day it opens. Until then, use a test key on the hosted service.

terminal
git clone https://github.com/signnative/signnative.git signnative && cd signnative
pnpm install && pnpm packages:build
alias signnative="node $PWD/packages/cli/dist/signnative.mjs"

signnative serve            # test mode, http://localhost:8080
signnative serve --live     # real envelopes, own data directory and seal key

# or in a container, built from the same clone (add -e SIGNNATIVE_MODE=live for live)
docker build -t signnative-server .
docker run -p 8080:8080 -v signnative-data:/data -e APP_URL=http://localhost:8080 signnative-server

Keys for an agent

Choose the key before the agent runs for the first time. On a sender_link envelope the link alone is enough to sign, so the choice decides whether the agent ever holds one.

  • The default. The MCP server reads the address and key that signnative serve or signnative login saved on the machine, so it needs no settings. On a standalone server that key (local-api-key) has every scope: the agent is handed the signing links and must pass them to the signers.
  • A key that is never handed links. The standalone server also writes agent-api-key in its data directory: every scope except sessions:create. With it the agent prepares and sends, the send response says signing_links_withheld: true, and a person makes the links with signnative link <envelope_id>.
  • On the hosted service or your own deployment. Create the key in the dashboard. The “Agent: prepare only” preset can neither send nor make links: a person approves and sends.

The stricter key only binds an agent that cannot read the other one. An agent with a shell on the same machine can read both key files and the saved CLI configuration. To keep links away from such an agent, run the server on another machine or as another user.

MCP configuration: the saved key
{ "mcpServers": { "signnative": { "command": "node", "args": ["/path/to/signnative/packages/mcp/dist/signnative-mcp.mjs"] } } }
MCP configuration: the agent key
{ "mcpServers": { "signnative": { "command": "node", "args": ["/path/to/signnative/packages/mcp/dist/signnative-mcp.mjs"],
  "env": { "SIGNNATIVE_BASE_URL": "http://localhost:8080", "SIGNNATIVE_API_KEY": "<the contents of agent-api-key>" } } } }

@signnative/mcp is not on npm yet, so the command points at the build in a clone (pnpm packages:build).

  1. 1

    Get an API key

    Sign in to the dashboard (a workspace with free envelopes is created for you), open Developers and create an API key. Switch on Test mode first to get a test key (osk_test_): it works on the same URL, emails nobody, returns signing links in the send response and uses free test credits. A live key (osk_live_) sends real invitations. The standalone server (signnative serve) has no dashboard: its first start creates a key, saves it to local-api-key in its data directory and prints the path. It runs in test mode by default; signnative serve --live makes real envelopes in a data directory of its own (~/.local/share/signnative-live by default), with an osk_live_ key.

    export OSK=osk_test_xxxxxxxx
    export BASE=https://<your-host>/api/v1
    
    # or, with signnative serve (default port and data directory):
    export OSK=$(cat ~/.local/share/signnative/local-api-key)
    export BASE=http://localhost:8080/api/v1
  2. 2

    Upload a PDF

    The server validates the file (type, size, encryption, existing signatures, scripts and attachments) and stores an immutable version with its SHA-256. The response has the version_id you pass to the envelope and each page's size in points.

    curl -X POST $BASE/documents \
      -H "Authorization: Bearer $OSK" \
      -F file=@test-agreement.pdf
  3. 3

    Create a draft envelope

    Each field gives a page (1-based) and a box as fractions 0 to 1 of the page, measured from the top-left corner of the page as displayed. Every recipient needs at least one signature field. Placing fields explains the coordinates, converting from PDF points, rotated pages, field types, limits and metadata.

    curl -X POST $BASE/envelopes \
      -H "Authorization: Bearer $OSK" -H "Content-Type: application/json" \
      -d '{"document_version_id":"ver_…","title":"Consulting agreement",
           "recipients":[{"role":"customer","name":"Test Customer","email":"customer@example.com"}],
           "fields":[{"recipient_role":"customer","type":"signature","page":1,"x":0.1,"y":0.8,"width":0.3,"height":0.06}]}'
  4. 4

    Request approval (agents)

    If the workspace requires approval for API sends, request it. A person approves in the dashboard; the approval binds to the payload hash and is single-use.

    curl -X POST $BASE/envelopes/env_…/approval-requests -H "Authorization: Bearer $OSK"
    # → { "approval_id": "apr_…", "approval_url": "…", "payload_hash": "…" }
  5. 5

    Send

    Sending locks the document, recipients, fields and the credit quote, and reserves 1 credit (charged on completion, released on decline, cancel or expiry; 402 insufficient_credits if none are available). An Idempotency-Key is required; retries with the same key return the same result. In test mode, signing links are returned and emails go to the test inbox. A standalone server emails nothing in test mode or live: the response has signing_links, one per signer, and the sender hands each link to its signer.

    curl -X POST $BASE/envelopes/env_…/send \
      -H "Authorization: Bearer $OSK" -H "Idempotency-Key: $(uuidgen)" \
      -H "Content-Type: application/json" -d '{}'
    # with an approval from step 4: -d '{"approval_id":"apr_…"}'
  6. 6

    Register a webhook endpoint

    Webhooks tell your app when an envelope is signed, declined or expired. The secret (whsec_…) is returned once, in this response: store it with your other secrets. Hosted deployments deliver only to public https URLs; signnative serve on localhost also accepts http://localhost.

    curl -X POST $BASE/webhooks \
      -H "Authorization: Bearer $OSK" -H "Content-Type: application/json" \
      -d '{"url":"https://app.example.com/webhooks/signnative","events":["envelope.completed","envelope.declined","envelope.expired"]}'
    # → { "id": "whk_…", "secret": "whsec_…", … }
  7. 7

    Verify webhooks

    Verify the HMAC over the timestamp and raw body before parsing, reject old timestamps, and de-duplicate on webhook-id. Ordering is not guaranteed; fetch the envelope for current state. In TypeScript, verifyWebhook(secret, rawBody, signatureHeader) from @signnative/sdk does these checks; the snippet shows what they are.

    // Node/Workers (WebCrypto). Throw before you parse the body.
    const m = /^t=(\d+),v1=([0-9a-f]+)$/.exec(sigHeader ?? "");
    if (!m) throw new Error("bad webhook-signature header");
    const t = Number(m[1]);
    if (Math.abs(Date.now() / 1000 - t) > 300) throw new Error("timestamp outside 5 minutes");
    const enc = new TextEncoder();
    const sig = Uint8Array.from(m[2].match(/../g) ?? [], (h) => parseInt(h, 16));
    const key = await crypto.subtle.importKey("raw", enc.encode(secret), { name: "HMAC", hash: "SHA-256" }, false, ["verify"]);
    // crypto.subtle.verify compares in constant time
    if (!(await crypto.subtle.verify("HMAC", key, sig, enc.encode(`${t}.${rawBody}`)))) throw new Error("bad signature");
  8. 8

    Download the signed PDF and evidence

    Artifacts are available after completion through short-lived URLs: signed.pdf, evidence.json (canonical manifest) and evidence.sig.json (Ed25519 platform seal).

    curl $BASE/envelopes/env_…/artifacts -H "Authorization: Bearer $OSK"

Verify the evidence

The CLI saves the files of step 8 and checks them offline. The verifier does the same in the browser, and Evidence format has every rule.

signnative download env_…                                   # signed.pdf, original.pdf, evidence.json, evidence.sig.json
signnative verify env_… --key-from http://localhost:8080    # exit code 0 valid, 3 indeterminate, 4 invalid

The result is valid, invalid or indeterminate. indeterminate means that no check failed, but something could not be established. Either the seal signature was not checked because no public key was given, or the key is not one the verifier was told to trust, or the server that made the package labelled its own key untrusted_test_key or self_managed_key. With one of those labels the result is never valid, even when you give the key. That is what every test envelope and every standalone server with a generated key gives today. It is not a failure: the report states integrity on its own line, and integrity: valid says that the files match the manifest and that the manifest was sealed with the key you gave. Who holds that key is what stays open.

Seal a self-signed PDF

When a person signs a PDF in your own app, without an envelope, POST /v1/seals seals a record of it: the SHA-256 of the file before and after signing, the page count, the name the person typed and their consent. You get back evidence.json and evidence.sig.json, which the verifier checks like envelope evidence. The document never leaves your app and nothing is stored. The name is self-asserted and the evidence says so. The person must see intent_text and agree; never request a seal on someone's behalf. Needs the seals:write scope; free, 600 per hour per key. The free signer uses this endpoint.

import { SignNative, selfSignIntentText } from "@signnative/sdk";

const ts = new SignNative({ apiKey: process.env.OSK!, baseUrl: process.env.BASE }); // key with seals:write
const name = "Test Customer";                    // typed by the signer, not verified
const original = "<sha256 of the PDF before signing>";
const signed = "<sha256 of the PDF after you stamped it>";

// Show intent_text to the signer and only continue when they agree.
const intent = selfSignIntentText(name, original, "self-sign-intent/v2");

const seal = await ts.seals.create({
  document: { sha256: original, size: 48213, page_count: 2 },
  signed_document: { sha256: signed, size: 61877 },
  signer: { name, signature_kind: "typed" },
  fields: [{ type: "signature", page: 2 }],
  consent: true,
  intent_version: "self-sign-intent/v2",
  intent_text: intent,
  client_time: new Date().toISOString(),
});
// Save next to the signed PDF; nothing is kept on the server.
// seal.files["evidence.json"], seal.files["evidence.sig.json"]

What this is, and is not

Signatures are simple electronic signatures (SES): the signer controls an email address, sees the locked document and explicitly consents. The platform seal proves the evidence has not been changed relative to the sealing key. It is not a qualified or advanced signature: the key is managed by the operator, not certified by a trust service provider. A sandbox deployment uses an untrusted test key.