- 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.
- 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.
- 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
- Open your project in the Lovable editor
- Click the + button next to the Preview panel
- Select the Cloud tab
- Scroll to Secrets and click Add Secret
- Set the name to
FIRMA_API_KEYand paste your Firma API key as the value - Click Save
Deno.env.get("FIRMA_API_KEY").
Step 2: Create a table to track signing requests
Prompt Lovable’s AI chat to create the database table:Step 3: Create an Edge Function to send signing requests
Prompt Lovable to create the Edge Function: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: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:supabase/functions/send-signing-request/index.ts with the code from Path 1, Step 3. Then deploy:
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: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 patternhttps://<your-project-ref>.supabase.co/functions/v1/firma-webhook.
External Supabase:
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.
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 the signer URL in an iframe inside your Lovable app:
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:- Go to Settings → Connectors → Personal connectors
- Click New MCP server
- Set a descriptive name (e.g., “Firma Docs”)
- Enter the server URL:
https://docs.firma.dev/mcp - Choose the authentication method (none is required for the public docs server)
- Click Add server
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