Skip to main content
Firma lets you add legally binding e-signatures to any Lovable application. Use Supabase Edge Functions to call the Firma API, manage templates, send signing requests, and track completions via webhooks. This guide covers three integration paths:
  1. Lovable Cloud (built-in backend) — Store your API key in the Cloud Secrets panel and prompt Lovable to generate the integration. Best for new projects or builders who want the fastest path to a working integration.
  2. External Supabase — For projects already connected to a standalone Supabase instance. Write Edge Functions manually and manage secrets via the Supabase CLI. Best when you need full control over your backend.
  3. AI-prompted integration — Use Lovable’s AI chat to scaffold the entire integration from natural language prompts. Works with both Lovable Cloud and external Supabase setups.

Prerequisites

  • A Firma account with an API key
  • A Lovable project with Lovable Cloud enabled (required for Edge Functions and secrets)
  • 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.

Path 1: Lovable Cloud

Lovable Cloud provides a built-in Supabase backend, so you don’t need a separate Supabase account. Secrets, Edge Functions, and database tables are all managed from within the Lovable editor.

Step 1: Store your API key as a secret

  1. Open your project in the Lovable editor
  2. Click the + button next to the Preview panel
  3. Select the Cloud tab
  4. Scroll to Secrets and click Add Secret
  5. Set the name to FIRMA_API_KEY and paste your Firma API key as the value
  6. Click Save
The secret is encrypted and automatically available to your Edge Functions via Deno.env.get("FIRMA_API_KEY").
Never hardcode your API key in frontend code or paste it into the Lovable chat.

Step 2: Create a table to track signing requests

Prompt Lovable’s AI chat to create the database table:
Review and approve the SQL migration that Lovable generates.

Step 3: Create an Edge Function to send signing requests

Prompt Lovable to create the Edge Function:
If you prefer to write the function manually, create a file at supabase/functions/send-signing-request/index.ts:
The create-and-send endpoint creates the signing request and sends it to recipients atomically. If you need to review or modify the request before sending, use POST /signing-requests to create a draft, then POST /signing-requests/{id}/send separately.

Step 4: Connect the function to your app UI

Prompt Lovable to wire up the frontend:
Or call the function directly from your React component using the Supabase client:

Path 2: External Supabase

If your Lovable project is connected to a standalone Supabase instance that you manage separately, the integration uses the Supabase CLI instead of the Lovable Cloud panel.

Step 1: Store your API key

Step 2: Create the signing requests table

Run the SQL from Path 1, Step 2 directly in your Supabase SQL Editor.

Step 3: Create and deploy Edge Functions

Generate the function scaffold with the CLI:
Replace the contents of supabase/functions/send-signing-request/index.ts with the code from Path 1, Step 3. Then deploy:
The frontend integration is the same as Path 1, Step 4. For a more detailed walkthrough of the Supabase-specific setup, including database triggers and RLS policies, see the full Supabase integration guide.

Webhook integration

To track when documents are signed, set up a Firma webhook that points to an Edge Function. This works the same way regardless of whether you use Lovable Cloud or an external Supabase instance.

Create a webhook handler

If you’re using Lovable’s AI chat, prompt it:
Or create the function manually at supabase/functions/firma-webhook/index.ts:

Deploy and register the webhook

Deploy the function without JWT verification, since Firma webhook requests don’t include Supabase auth headers: Lovable Cloud: Prompt Lovable to deploy the Edge Function, then note the function URL. It will follow the pattern https://<your-project-ref>.supabase.co/functions/v1/firma-webhook. External Supabase:
Then register the webhook URL in your Firma dashboard under Settings → Webhooks. Select the events you want to receive, such as signing_request.completed and signing_request.recipient.signed. Firma sends events for all key state changes. See the webhooks guide for the full list of event types, payload structures, and signature verification.
For production use, verify the webhook signature using your Firma webhook signing secret. See the webhooks guide for details on HMAC signature verification.

Embedded signing

For apps where signers complete documents directly in your UI, Firma provides an embeddable signing experience. The create-and-send response includes a first_signer.id (the signing_request_user_id) and a ready-made first_signer.signing_link. Load the signer URL in an iframe inside your Lovable app:
You can prompt Lovable to build this into your UI:
See the embedded signing guide for full setup instructions including security best practices and postMessage event handling.

Bonus: MCP connection for AI-assisted building

Firma offers a Docs MCP server that you can connect to your Lovable account. This lets Lovable’s AI chat search Firma documentation while you build, so it can help you write integration code with accurate API details. To set it up:
  1. Go to Settings → Connectors → Personal connectors
  2. Click New MCP server
  3. Set a descriptive name (e.g., “Firma Docs”)
  4. Enter the server URL: https://docs.firma.dev/mcp
  5. Choose the authentication method (none is required for the public docs server)
  6. Click Add server
This is for the build experience only and does not affect your deployed app. With the MCP connection active, you can prompt Lovable with requests like “Add a signing request status dashboard using the Firma API” and the AI will reference live documentation to generate more accurate code.

Next steps