Skip to content

SDK method

captureLead

Standalone, dependency-free, anonymous lead capture.

Signature

ts
captureLead(options: CaptureLeadOptions): Promise<CaptureLeadResponse>

Parameters

NameTypeRequiredDescription
formSlugstringyesThe hosted form's URL slug (`/forms/<slug>`).
emailstringyesThe subscriber's email address.
mergeFieldsRecord<string, string>noPer-form merge-field values, keyed by merge tag (`{ FNAME: "Ada" }`).
hpstringnoHoneypot value — leave unset/empty; a bot fills it and the lead is silently dropped.
hoststringnoYour instance domain — the bare origin (`https://acme.com`); the mount is derived.
baseUrlstringno—
fetchtypeof fetchnoOverride `fetch` (tests / custom runtimes). Defaults to global `fetch`.

Returns

Promise<CaptureLeadResponse>

Example

ts
import { captureLead } from "tinbox/sdk";
await captureLead({ host: "https://acme.com", formSlug: "newsletter", email: "ada@example.com" });