- Flow with External Services — No-code. Register Firma’s OpenAPI spec once, then invoke
Create and send signing requestfrom any Flow. Best for admins. - Apex with Named Credentials — Code. Call Firma directly from Apex classes, Flow Actions, or LWC controllers. Best for developers who want full control.
- Agentforce action — Expose Firma as an Action on an Agentforce agent so it can send signing requests in response to a user prompt or a trigger.
Prerequisites
- A Firma account with an API key
- A Salesforce org (Enterprise, Unlimited, or Developer edition) with permission to create Named Credentials and External Services
- 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.Step 0: Store the Firma API key as a Named Credential
Named Credentials are Salesforce’s secure pattern for storing endpoint URLs and auth headers. Every other section in this guide references it.- In Setup, search for Named Credentials and open the page
- Under External Credentials, click New:
- Label:
Firma - Name:
Firma - Authentication Protocol:
Custom
- Label:
- Click into the new External Credential, scroll to Principals, and click New:
- Parameter Name:
Default - Sequence Number:
1 - Identity Type:
Named Principal - Authentication Parameters: add one parameter
- Name:
ApiKey - Value: your Firma API key
- Name:
- Parameter Name:
- Scroll to Custom Headers and add one:
- Name:
Authorization - Value:
{!$Credential.Firma.ApiKey}
- Name:
- Back under Named Credentials, click New:
- Label:
Firma API - Name:
Firma_API - URL:
https://api.firma.dev/functions/v1/signing-request-api - External Credential:
Firma - Allowed Namespaces: leave default
- Label:
- Save
Path 1: Flow with External Services
The no-code path. You import Firma’s OpenAPI spec once, and the actions become available as invocable steps in any Flow.Step 1: Register Firma as an External Service
- In Setup, search for External Services and click Add an External Service
- Choose From API Specification, then Save and Next
- Configure:
- External Service Name:
Firma - Select a Named Credential:
Firma_API - Service Schema:
Upload from Localor paste the JSON
- External Service Name:
- Paste the Firma OpenAPI spec from
https://docs.firma.dev/api-reference/v01.26.00/openapi-v01.26.00.json - Click Save and Next
- Select the operations you want available in Flow. Common picks:
POST /signing-requests/create-and-sendPOST /signing-requestsPOST /signing-requests/{id}/sendGET /signing-requests/{id}GET /templates
- Click Save and Next, then Finish
Check the Firma API changelog for the latest spec URL. Salesforce caches the spec at registration time, so re-register the External Service whenever you want new endpoints.
Step 2: Build the Flow
- In Setup, open Flows and create a new Flow (Record-Triggered is the most common)
- Choose your trigger object (Opportunity, Contract, Quote, or a custom object) and the condition that should send a signing request (e.g.,
StageNameequalsClosed Won) - Add an Action element
- Search for
Firmaand pickCreate and send signing request - Map the inputs:
template_id: a Custom Metadata value, a record field, or a hardcoded template IDrecipients: build a collection of recipient records. Required fields arefirst_nameandemail. Optional fields includelast_name,designation(defaults toSigner),order,company,title,phone_number, and address fields. The easiest way is an Assignment element that builds the collection from the triggering record’s contact fields.
- Save and activate
Path 2: Apex with Named Credentials
For developers who want full control, call Firma directly from Apex. Use the Named Credential as the endpoint base so the API key stays encrypted.callout:Firma_API prefix tells Salesforce to use the Named Credential, which injects the Authorization header automatically. No API key appears in code, in logs, or in serialized request inspection.
The
create-and-send endpoint creates the signing request and emails it to recipients in one call. If you need an Apex-controlled review step, use POST /signing-requests to create a draft, then POST /signing-requests/{id}/send separately.Path 3: Agentforce action
To let an Agentforce agent send signing requests in response to a prompt (“send the standard NDA to alice@example.com”), wrap one of the above as an Agent Action.- In Setup, open Agentforce Builder and pick the agent you want to extend
- Open the relevant Topic (e.g.,
Contract Lifecycle) - Click New Action and choose Flow or Apex
- Flow: pick a screen Flow or autolaunched Flow that wraps the
Firma.Create and send signing requestExternal Services action - Apex: pick the
FirmaInvocable.sendmethod
- Flow: pick a screen Flow or autolaunched Flow that wraps the
- Define inputs the agent will collect from the conversation: template, signer name, signer email
- Add the action to the Topic and publish
Webhook integration: react when documents are signed
Receive Firma webhooks into Salesforce by exposing an Apex REST endpoint, then update the originating record (Opportunity, Contract, custom object) when the signing request completes.Step 1: Create the Apex REST endpoint
Step 2: Verify the webhook signature
Firma signs every webhook payload with HMAC-SHA256. Always verify the signature in production to reject spoofed payloads. Your webhook secret is available in Settings > Webhooks in the Firma dashboard.receive() method before processing:
Step 3: Expose the endpoint publicly
Firma’s webhook calls aren’t authenticated as a Salesforce user, so expose the endpoint through an Experience Cloud Site. Create a site (or use an existing one), then grant the site’s guest user profile permission to execute theFirmaWebhook Apex class. See Salesforce: Allow Guest Users to Access Apex REST for the full setup steps.
Step 4: Register the webhook in Firma
- In the Firma dashboard, go to Settings > Webhooks
- Add a new webhook pointing at
https://<your-site-domain>/services/apexrest/firma-webhook - Subscribe to the events you care about (
signing_request.completed,signing_request.recipient.declined,signing_request.expired)
Embedded signing in Lightning
If you want signers to complete documents inside a Lightning page, use a Lightning Web Component that embeds the Firma signing UI. After a successful create-and-send call, read the signer ID from the response and pass it to the LWC:https://app.firma.dev to your CSP Trusted Sites so the iframe loads. See the embedded signing guide for full setup including security best practices.
For ISVs and AppExchange partners: multi-org signing
If you’re building an AppExchange app that needs e-signatures for each of your customer orgs, use Firma Customer Workspaces. Each customer org gets its own isolated Firma workspace with separate templates, usage tracking, and audit trail. Provision a workspace per org at install time, store the workspace API key in a Protected Custom Setting on that org, and reference it from the Named Credential. No data bleed between customers.MCP connection for AI-assisted building
Firma offers a Docs MCP server athttps://docs.firma.dev/mcp. Connect it to Claude, Cursor, or any MCP-aware AI tool while you’re writing Apex or building Flows, and the assistant can answer accurate API questions from Firma’s docs. This is for the build experience and does not affect your deployed integration.
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