SDK method
captureLead
Standalone, dependency-free, anonymous lead capture.
Signature
ts
captureLead(options: CaptureLeadOptions): Promise<CaptureLeadResponse>Parameters
| Name | Type | Required | Description |
|---|---|---|---|
formSlug | string | yes | The hosted form's URL slug (`/forms/<slug>`). |
email | string | yes | The subscriber's email address. |
mergeFields | Record<string, string> | no | Per-form merge-field values, keyed by merge tag (`{ FNAME: "Ada" }`). |
hp | string | no | Honeypot value — leave unset/empty; a bot fills it and the lead is silently dropped. |
host | string | no | Your instance domain — the bare origin (`https://acme.com`); the mount is derived. |
baseUrl | string | no | — |
fetch | typeof fetch | no | Override `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" });