Lead Forms & Capture API

Capture leads from any standalone website and route submissions directly into SiteFabric CRM pipelines with built-in schema validation and spam protection.

Lead Capture Endpoint

Requires Authorization: Bearer sf_tok_... (or JWT). Call from your server-side Route Handler so your token is never exposed to browser clients.

POST/api/v1/public/websites/:key/forms/:formKey/submissions

Submit a Public Lead Form

Validates incoming form fields against the published FormVersion, checks honeypot spam protection and consent, stores the submission, and automatically creates a CRM Lead in the website pipeline.

Bearer JWT / sf_tok_
ParameterInTypeDescription
key*pathstringWebsite slug key (e.g. acme).
formKey*pathstringPublished form key (e.g. contact, quote).
values*bodyRecord<string, unknown>Key/value map of submitted form fields.
consentGrantedbodybooleanRequired when form.requireConsent is true.
honeypotbodystringMust be empty for human submissions.
Request
bash
curl -X POST "https://api.sitefabric.space/api/v1/public/websites/acme/forms/contact/submissions" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"values":{"name":"Jane Doe","email":"jane@example.com","phone":"+1-555-0199","message":"Need a quote for 3 locations"},"consentGranted":true,"honeypot":""}'
Response200 OK
json
{
  "submissionId": "674f1c2e9a1b2c3d4e5f6f01",
  "leadId": "674f1c2e9a1b2c3d4e5f6f02",
  "status": "accepted"
}

Form Management Endpoints

POST/api/v1/forms

Define a Lead Form

Creates a versioned lead capture form schema for a website.

Bearer JWT / sf_tok_forms:define
Request
bash
curl -X POST "https://api.sitefabric.space/api/v1/forms" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token" \
  -H "Content-Type: application/json" \
  -d '{"websiteId":"674f1c2e9a1b2c3d4e5f6a7b","key":"quote","name":"Request a Quote","requireConsent":true,"fields":[{"name":"name","label":"Full Name","type":"text","required":true},{"name":"email","label":"Email","type":"email","required":true}]}'
Response200 OK
json
{
  "id": "674f1c2e9a1b2c3d4e5f6f10",
  "key": "quote",
  "name": "Request a Quote",
  "status": "draft"
}
POST/api/v1/forms/:id/publish

Publish a Lead Form

Publishes the form so it can immediately accept submissions on the public capture endpoint.

Bearer JWT / sf_tok_forms:publish
ParameterInTypeDescription
id*pathObjectIdForm ID.
Request
bash
curl -X POST "https://api.sitefabric.space/api/v1/forms/674f1c2e9a1b2c3d4e5f6a7b/publish" \
  -H "Accept: application/json" \
  -H "Authorization: Bearer sf_tok_your_auth_token"
Response200 OK
json
{
  "id": "674f1c2e9a1b2c3d4e5f6f10",
  "status": "published",
  "publishedVersion": 1
}