- Workers — Standalone serverless functions that call the Firma REST API. Best for APIs, microservices, or apps that don’t use Cloudflare Pages.
- Pages Functions — File-based serverless functions that deploy alongside your Cloudflare Pages site. Best if you already have a Pages project and want to keep everything in one repo.
Prerequisites
- A Firma account with an API key
- The Wrangler CLI installed (
npm install -g wrangler) - At least one Firma template with signing fields configured
Firma uses the raw API key as the
Authorization header value. Do not prefix it with Bearer. This differs from many other APIs.Choose your path
- Workers
- Pages Functions
Step 1: Create a Worker project
If you don’t have a Workers project yet, scaffold one:Step 2: Store your API key as a secret
Add your Firma API key as an encrypted secret. Wrangler will prompt you to paste the value:env binding at runtime.Step 3: Create a Worker to send signing requests
Replace the contents ofsrc/index.js (or src/index.ts if you chose TypeScript) with the following. This Worker accepts a POST request with signer details, calls the Firma create-and-send endpoint, and returns the signing request ID.Step 4: Deploy
https://firma-signing.<your-subdomain>.workers.dev). Your frontend can now POST signer details to that URL.Webhook handling
To track when documents are signed, create a second Worker that receives Firma webhook events. In the Firma dashboard under Settings → Webhooks, register a webhook pointing to this Worker’s URL.Embedded signing
For apps where signers complete documents directly in your UI, Firma provides an embeddable signing experience. Thecreate-and-send response includes a first_signer.id (the signing_request_user_id) and a ready-made first_signer.signing_link. Load it in an iframe:
Bonus: MCP connection for AI-assisted building
Firma offers a Docs MCP server that AI coding tools can connect to. If you use an AI assistant while building your Cloudflare integration, connecting the MCP server lets it search Firma documentation and generate accurate API calls. Add the MCP server URL to your tool’s configuration:Next steps
- API authentication — API keys and workspace scoping
- Webhooks guide — event types, payloads, and signature verification
- Embedded signing — in-app signing experience
- Creating workspaces — multi-tenant setups for SaaS apps
- Complete setup guide — end-to-end Firma integration walkthrough
- API reference — full endpoint documentation