Integration Guide

Everything you need to integrate Verfi into your lead generation workflow.

Overview

The Verfi SDK captures session recordings on your lead forms — mouse movements, clicks, scrolls, and form interactions — creating independent, third-party proof of the consumer's consent experience.

Integration requires a single script tag. No form modifications, no backend changes, no build step.

What you'll need:

Quick Start

Add the SDK script to any page with a lead capture form:

HTML
<script async
  src="https://sdk.verfi.io/v2/index.min.js?apiKey=pk_YOUR_PUBLIC_KEY">
</script>

That's it. The SDK will:

  1. Auto-detect all <form> elements on the page
  2. Start recording the session (mouse movements, clicks, scrolls, form interactions)
  3. Detect and hash PII fields automatically
  4. Generate a unique Verfi ID for the session
  5. Inject a hidden verfiProof field into each form with the proof URL
  6. Submit the session recording to Verfi when the form is submitted

How It Works

1

Page loads

SDK initializes, detects forms, starts recording

→
2

Consumer interacts

Mouse movements, clicks, scrolls, and form inputs are captured

→
3

Form submitted

Session recording sent to Verfi, proof URL injected into form data

→
4

Proof available

Buyers verify consent via proof link or API

Proof Field

On form submission, the SDK automatically injects a hidden field containing the proof URL. By default, this field is named verfiProof.

Your form backend receives the proof URL alongside the rest of the form data:

Form Data (received by your backend)
{
  "firstName": "Jane",
  "lastName": "Doe",
  "email": "jane@example.com",
  "phone": "555-0100",
  "verfiProof": "https://proof.verfi.io/VF-4af0a15a"
}

Store this URL with the lead record and pass it to buyers. They can click it to view the full session replay — no Verfi account required.

Custom field name

If verfiProof conflicts with an existing field in your form, use the field parameter to change it:

HTML
<script async
  src="https://sdk.verfi.io/v2/index.min.js?apiKey=pk_YOUR_PUBLIC_KEY&field=consent_proof">
</script>

This will inject a hidden field named consent_proof instead of verfiProof.

The proof field is injected only when the SDK captures a genuine interactive session. If the SDK is blocked (by a privacy extension, tracker blocker, or browser setting) and records nothing meaningful, no proof field is added to your form — an empty or missing verfiProof value signals that no verifiable recording exists for that submission, rather than a link to an empty session.

PII Handling

The SDK automatically detects and protects personally identifiable information:

  • Auto-detection: Fields containing emails, phone numbers, SSNs, and other PII patterns are identified automatically based on field names, types, and input patterns
  • Hashing: PII values are SHA-256 hashed in the browser before any data is sent to Verfi — raw PII never leaves the page
  • Session recordings: Text inputs in the session replay show masked values, not actual PII

Explicit PII tagging

For fields that aren't auto-detected, you can explicitly mark them as PII:

HTML
<input type="text" name="custom_id"
  data-verfi-pii
  data-verfi-pii-category="ID" />

Supported PII categories: EMAIL, PHONE, SSN, NAME, ADDRESS, ID

Consent disclosure capture

SDK v2 automatically detects and captures TCPA consent disclosure text, visibility metrics, partner links, and consent checkbox state on form submission. For custom layouts or multi-step forms, you can explicitly tag the consent container:

HTML
<p data-verfi-disclosure>
  By clicking Submit, I consent to receive calls and texts from
  Acme Auto Insurance at the phone number provided.
</p>

Verfi cross-checks the captured disclosure against the recorded rrweb DOM snapshot and verifies consent-language cues server-side so non-consent text (like a page footer) cannot spoof a disclosure.

SPA Support

The SDK works with single page applications out of the box:

  • Starts recording immediately, even if no forms are present on initial load
  • Monitors for dynamically added forms
  • Periodically saves session data for long-lived pages
  • Only saves sessions where meaningful user interaction occurred (prevents saving bounce sessions)

No additional configuration is needed for React, Vue, Next.js, or other SPA frameworks.

Managing Sessions (API)

Lead buyers and routers use the Verfi REST API to verify and claim sessions. Authentication uses a secret API key (sk_ prefix) with Bearer token auth.

API Keys & Scopes: Manage keys from Settings → API Keys. Use pk_ keys for the SDK (client-side) and sk_ keys for the API (server-side). Every new account's default sk_ key includes sessions:claim — the only scope needed for the recommended single-call claim flow below. Never expose secret keys in client-side code.

Claim & Verify a Session (Recommended — Single API Call)

You do not need two API calls to verify and claim a lead. Send all desired verification checks — PII matching, claim mode, recording validity, declared/verified intent, quality score, and disclosed calling brand — directly in a single POST /claim request. Any missing session (404), failed gate (409), or wallet restriction (402) rejects before any claim or charge is committed.

cURL
curl -X POST "https://api.verfi.io/tenant/v1/sessions/VF-4af0a15a/claim"   -H "Authorization: Bearer sk_YOUR_SECRET_KEY"   -H "Content-Type: application/json"   -H "Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7"   -d '{
    "requirePII": ["email", "phone"],
    "emailHash": "<64-char-lowercase-sha256-hex>",
    "phoneHash": "<64-char-lowercase-sha256-hex>",
    "requireRecording": true,
    "requireVerticals": ["auto_insurance"],
    "requireVerifiedScore": 0.4,
    "minQualityScore": 50,
    "requireDisclosedEntity": ["Acme Auto Insurance"],
    "expirationDate": "2029-04-09T00:00:00Z"
  }'
  • Single call, sessions:claim scope only: No separate lookup or sessions:search scope is required.
  • Idempotency-Key: Required for wallet-enrolled accounts (16–128 characters, such as a UUID). Persist one key per intended claim and reuse it with the identical request body on timeout retries so you are never billed twice.
  • All gates are opt-in: Omit any gate you do not need (a minimal claim only requires an empty JSON body {}).
  • Retention: Defaults to 3 years; set expirationDate at claim time (up to 5 years from claim) or update it later via the expiration endpoint.

Lead Integrity Controls & Claim Gates

Verfi enforces lead integrity at claim time — not the honor system. All gates are fail-fast, evaluated before any debit, and return 409 with a machine-readable error code if they fail.

Exclusive vs. multi-buyer claim mode

Publishers set claimMode at session creation (via the SDK / POST /public/session). Default is "multi", which lets resellers and their downstream buyers each claim independently. Setting "exclusive" allows only one active claim globally — any subsequent claim (from another buyer or a reseller's buyer) is rejected with 409 already_claimed. This field is immutable once set; buyers can require a specific mode at claim time using requireClaimMode.

Declared intent

Publishers declare the consumer's intent when the session is created:

JSON
{
  "intent": {
    "verticals": ["auto_insurance"],
    "products": ["6-month auto policy"]
  }
}

Verticals use a starter taxonomy (auto_insurance, home_insurance, life_insurance, health_insurance, medicare, mass_tort, mortgage, solar, final_expense, debt_relief); custom verticals are accepted with an x_ prefix. Declared intent is immutable and visible on the proof page.

Available claim-time gates

  • requirePII + emailHash / phoneHash — require exact SHA-256 hex matches against captured email, phone, or both (both means AND; hash the exact SDK-captured UTF-8 string without extra normalization). Rejected with 409 pii_mismatch.
  • requireClaimMode ("exclusive" or "multi") — checks the publisher's immutable claim mode without changing it. Rejected with 409 claim_mode_mismatch.
  • requireRecording (boolean) — claim only if the session captured a genuine interactive recording (at least two meaningful clicks, scrolls, or form inputs; passive mouse movement alone does not count). Blocked or empty SDK sessions reject with 409 no_recording.
  • requireVerticals — claim only if the session's declared verticals overlap your list. A session with no declared intent is treated as a mismatch. Rejected with 409 intent_mismatch.
  • requireVerifiedScore (0–1) — claim only if Verfi's cached heuristic content-verification score (URL, title, and non-PII form metadata against declared starter verticals) meets your threshold. Rejected with 409 verification_below_threshold.
  • minQualityScore (0–100) — behavioral human-confidence floor based on event timing and interaction patterns. Rejected with 409 quality_below_threshold.
  • requireDisclosedEntity (string or array of up to 10 strings) — claim only if at least one of your calling brands/DBAs was visibly named inline in the consumer's TCPA consent disclosure, verified against the recorded rrweb DOM snapshot. On success, disclosureMatch.authorizedBrand returns the matched buyer-supplied alias (inspect matchType and excerpt for verbatim recorded wording). Hybrid disclosures (your brand named inline alongside a partner link) pass by default with hasPartnerLink: true. Rejected at $0 cost with 409 disclosure_missing, disclosure_dom_mismatch, disclosure_not_visible, or entity_not_disclosed.
  • rejectPartnerLinks (boolean, default false) — strict 1:1 opt-in mode that rejects any disclosure containing a hyperlinked marketing-partners list with 409 partner_list_rejected, even when your brand is also named inline. Can be used alone or alongside requireDisclosedEntity.

These controls let a buyer refuse — and not pay for — leads that don't match what they're buying.

For recommended thresholds and gate order, see Tuning Claim Gates. For the complete buyer/router contract (exact responses, errors, and retries), see agent-integration.md.

Optional Pre-Claim & Diagnostic Lookups

You do not need to call these endpoints before POST /claim — all enforcement checks run atomically inside the claim request above. Use them only for diagnostics or if your router explicitly needs a read-only check before buyer selection. Both endpoints require the sessions:search scope and share a per-tenant rate limit of 60 requests/minute (10,000/day, 100,000/month).

Check claim status

Inspect a session's claimMode, whether it is currently claimable, and its recordingStatus (valid, insufficient, or empty) without revealing who holds a claim:

cURL
curl "https://api.verfi.io/tenant/v1/sessions/VF-4af0a15a/claim-status" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"

This check does not reserve a claim, evaluate your thresholds, or check your existing claim in multi mode — the final POST /claim call is authoritative.

Search / diagnostic PII lookup

Look up session metadata and optionally check SHA-256 hashed email/phone values:

cURL
curl "https://api.verfi.io/tenant/v1/sessions/VF-4af0a15a?email={email_hash}&phone={phone_hash}" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"

Lookup mismatches are informational only and do not block a later claim. To enforce PII matching before claiming, pass requirePII with emailHash/phoneHash inside POST /claim.

List Claimed Sessions

Retrieve all sessions claimed by your tenant with pagination and filtering:

cURL
curl "https://api.verfi.io/tenant/v1/sessions?page=1&limit=20&status=claimed" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"

Supports page, limit (1–100, default 20), and status filters.

Update Expiration

Extend or shorten the retention period on a claimed session. The new expiration must be at least 30 days from now and no later than 5 years from the claim date. Updates are limited to 3 per month with a 24-hour cooldown; they do not reset the claim date:

cURL
curl -X PUT "https://api.verfi.io/tenant/v1/sessions/VF-4af0a15a/expiration"   -H "Authorization: Bearer sk_YOUR_SECRET_KEY"   -H "Content-Type: application/json"   -d '{"expirationDate": "2030-04-09T00:00:00Z"}'

Limited to 3 updates per month per session with a 24-hour cooldown between changes.

Unclaim a Session

Release a previously claimed session (requires the sessions:unclaim scope):

cURL
curl -X POST "https://api.verfi.io/tenant/v1/sessions/VF-4af0a15a/unclaim" \
  -H "Authorization: Bearer sk_YOUR_SECRET_KEY"

Unclaiming releases only your tenant's active claim and does not refund the $0.05 claim debit. Re-claiming later is a new billable claim. Most buyers keep claims on returned leads so consent proof remains retained if a dispute arises later.

Full API reference: The complete OpenAPI spec is available at api.verfi.io/.well-known/openapi.json. You can also test all endpoints interactively in the API Playground inside your dashboard.

Testing

In-App Playground

The fastest way to test is the SDK Playground in your dashboard — it loads the SDK with your key, provides a sample form, and lets you submit a test session and view the recording immediately.

Debug mode

Add debug=true to the script URL to enable verbose console logging:

<script async
  src="https://sdk.verfi.io/v2/index.min.js?apiKey=pk_YOUR_PUBLIC_KEY&debug=true">
</script>

This logs form detection, PII field identification, event counts, and submission status to the browser console. Look for [VERFI SDK v2] messages.

Test keys

Use a dedicated test key or the in-app playground during development so you can verify recording and claiming end to end before enabling production traffic.

Verify your integration

  1. Add the SDK script tag to your form page
  2. Open browser DevTools → Console
  3. Look for [VERFI SDK v2] log messages confirming initialization and form detection
  4. Fill out and submit the form
  5. Check that a verfiProof value appears in your form submission data
  6. Click the proof URL to view the session replay on proof.verfi.io

FAQ

Does the SDK slow down my page?

The SDK loads asynchronously (async attribute) and doesn't block page rendering. The recording library is lightweight and has minimal impact on page performance.

Do I need to modify my forms?

No. The SDK auto-detects all <form> elements on the page and attaches listeners automatically. The hidden verfiProof field is injected at submission time — no changes to your existing form HTML needed.

Is PII sent to Verfi?

No. PII is detected and hashed (SHA-256) in the browser before any data leaves the page. Verfi never receives raw email addresses, phone numbers, or other sensitive data. Session recordings show masked values for PII fields.

How long are sessions retained?

Three years is the default, not a required retention period. Choose expirationDate when claiming and update it as needed. The current API caps expiration at 5 years from the claim date, including later updates; indefinite renewal of an active claim is not currently supported. Choose retention to meet your own recordkeeping requirements. Vault storage is billed separately.

Can multiple buyers claim the same session?

Yes, in the default multi mode — resellers and their downstream buyers can each claim the same session independently and manage their own retention periods. If the publisher sets claimMode=exclusive at session creation, only one active claim is allowed globally and any subsequent claim is rejected with 409 already_claimed.

Can I use this alongside TrustedForm or Jornaya?

Yes. The Verfi SDK runs independently and doesn't conflict with other compliance scripts on the page. Many publishers use Verfi alongside existing consent documentation tools for additional, independent coverage.

What if my form doesn't use a standard <form> tag?

The SDK supports SPAs and monitors for dynamically added forms. For fully custom form implementations without a <form> element, contact us and we'll help you integrate.

What happens if a visitor blocks the SDK?

If a browser or extension blocks the Verfi SDK, no session is recorded and no proof field is injected into your form — so the submission simply has no proof URL. Buyers can enforce this at claim time with requireRecording: true, which rejects any claim on a session without a valid recording (409 no_recording). This prevents a blocked session from ever producing a proof link that points to nothing.

Ready to integrate?

Get your API keys and start capturing consent sessions in minutes.

Privacy choices

Allow optional analytics and masked session recordings to help improve Verfi? We exclude credentials, lead details, and evidence playback. Declining does not affect the service. Privacy policy