FormsFort

CLI and SDK

Official FormsFort CLI and TypeScript SDK for agent-led form setup.

CLI and SDK

The official CLI and SDK are designed for AI coding agents and developers who want repeatable form setup.

CLI

pnpm dlx @formsfort/cli create contact --recipient [email protected] --name "Website contact"
pnpm dlx @formsfort/cli snippet quote --access-key YOUR_ACCESS_KEY --framework react --api-url https://api.formsfort.com
pnpm dlx @formsfort/cli test --access-key YOUR_ACCESS_KEY --email [email protected] --origin https://example.com --dry-run
pnpm dlx @formsfort/cli verification status --form-id FORM_ID
pnpm dlx @formsfort/cli verification resend --form-id FORM_ID

Authentication for control-plane commands:

export FORMSFORT_API_TOKEN="workspace-api-token-or-session-token"
# or
export FORMSFORT_SESSION_COOKIE="better-auth.session_token=..."

Create workspace API tokens from the dashboard Forms page. Tokens are scoped to one workspace and only allow the selected forms:read, forms:write, and submissions:test actions.

Public submit and snippet commands only need an access key.

Set FORMSFORT_API_URL or pass --api-url when generating snippets against local, staging, or self-hosted API origins.

formsfort test sends a browser-style Origin header because FormsFort protects true server-side submissions behind paid IP safelists. Pass the deployed site origin when exact allowed domains are enabled.

Use --dry-run before the recipient email is verified. It validates the access key, submitted fields, browser origin, and captcha/source gates without sending email.

Omit --domain during default agent setup. Exact allowed domains are available on Free; add them only when the user explicitly asks for domain lock-down or the production hostnames are known. Wildcard domain patterns such as *.example.com and server IP safelists require a paid/manual plan.

formsfort create queues the recipient verification email when the new form is still pending, then prints the human handoff. Live submissions remain blocked until the recipient verifies the email.

SDK

import { FormsFortClient, formRecipes } from "@formsfort/sdk";

const client = new FormsFortClient({
  apiToken: process.env.FORMSFORT_API_TOKEN,
});

const created = await client.createForm({
  name: "Website contact",
  recipientEmail: "[email protected]",
  subjectDefault: formRecipes.contact.subject,
  fromNameDefault: formRecipes.contact.fromName,
});

console.log(created.form.accessKey);

if (!created.form.recipientVerified) {
  await client.requestRecipientVerification(created.form.id);
}

Submit with SDK

const result = await client.submit(
  {
    access_key: "YOUR_ACCESS_KEY",
    name: "Ada",
    email: "[email protected]",
    message: "Hello",
  },
  {
    dryRun: true,
    origin: "https://example.com",
  },
);

Snippet generation

import { createHtmlSnippet, createReactSnippet } from "@formsfort/sdk";

createHtmlSnippet({ accessKey: "YOUR_ACCESS_KEY", recipe: "contact" });
createReactSnippet({ accessKey: "YOUR_ACCESS_KEY", recipe: "quote" });

On this page