Forms
The public forms API behind Zoie's embedded and hosted forms: load a form's definition, submit entries as leads (with an optional per-form API key) and list a business's services.
Zoie forms have a small public API. The embedded form widget and the hosted form page use it, and you can call it yourself, for example to send entries from your own server. There is no public API for building or editing forms. Use the form builder in the app for that (see Creating a form).
All paths are relative to https://api-us.zoie.ai.
| Method | Path | Auth | Purpose |
|---|---|---|---|
GET | /api/v1/public/forms/{form_id} | None | Load a form’s public definition. |
POST | /api/v1/public/submitForm | None, or X-Form-Api-Key once the form has a key | Submit an entry. A real entry creates a lead. |
GET | /api/v1/public/getServiceOptions/{business_id} | None | List the business’s services, for a Service dropdown. |
Before you start
- Form ID. A UUID. It is the
form_idattribute in the form’s embed code and the last part of its share link (…/consultation-form/<business>/<form_id>). - Field keys. Each field is submitted under the lead field it is mapped to (for example
first_name), or under its own field ID if it isn’t mapped. The REST API tab of the Publish Form panel has a Request body template with the right keys for your form. See Embedding forms.
Access rules
Form API key
Generate a key in the form’s Publish Form panel, on the REST API tab. Keys look like zfk_ followed by 43 characters. Zoie stores only a hash, so the full key is shown once. Generate new key replaces the old key straight away. A form has one key at a time, and keys don’t expire. Generating keys is limited to 5 per hour per user by default.
Once a form has a key, every submission to it must send the key in the X-Form-Api-Key header. Without it, the response is 401 with “Invalid or missing API key.”
Keep the key on your server. Never put it in browser code.
Allowed domains
A form with Allowed Domains set (on the Embed Code tab) only loads and accepts entries from those sites. Zoie reads the request’s Origin header, or Referer if there is no Origin. It ignores ports and a leading www., and *.example.com also covers every subdomain. Zoie’s own domains are always allowed. A blocked request gets 403 with the message origin_not_allowed.
- Submissions that carry a valid
X-Form-Api-Keyskip this check, so server-side callers aren’t affected. - Loading the form has no key bypass. A request with no
OriginorReferer, such as one from a server, is refused when the list is set. Take the field keys from the publish panel instead.
A form with an empty list accepts requests from anywhere.
Calling from a browser
These endpoints only answer browsers on Zoie’s own sites and on websites Zoie has registered for a business. On any other site the browser blocks the response with a CORS error. Server-to-server calls don’t send an Origin header and aren’t affected. If an embedded form fails like this on your website, ask Zoie support to register the domain for your business.
Load a form
GET /api/v1/public/forms/{form_id}
Returns the fields and styling the form widget needs to render the form.
| Path parameter | Type | Description |
|---|---|---|
form_id | UUID | The form’s ID. |
curl "https://api-us.zoie.ai/api/v1/public/forms/6f1c2d3e-8a4b-4c1d-9e2f-0a1b2c3d4e5f"const formId = '6f1c2d3e-8a4b-4c1d-9e2f-0a1b2c3d4e5f';
const res = await fetch(`https://api-us.zoie.ai/api/v1/public/forms/${formId}`);
const { data } = await res.json();
console.log(data.fields);Response
200 OK. fields is the array of steps from the builder, and each step has its own fields. Abridged:
{
"success": true,
"data": {
"id": "6f1c2d3e-8a4b-4c1d-9e2f-0a1b2c3d4e5f",
"form_title": "Get Free Consultation",
"form_subtitle": "All-in-One Solutions - Done Right, All in One Place.",
"fields": [
{
"id": 1,
"name": "Step 1",
"isConditional": false,
"conditions": [],
"fields": [
{ "id": "first_name", "label": "First Name", "type": "text", "required": true, "mappedFieldName": "first_name" },
{ "id": "email", "label": "Email Address", "type": "email", "required": true, "mappedFieldName": "email" }
]
}
],
"status": "published",
"primary_color": "#3900DB",
"background_color": "#FBFBFB",
"background_image": null,
"background_type": "color",
"font_family": "Arial",
"overlay_opacity": 10,
"collect_abandoned_leads": false,
"Business": {
"id": 42,
"business_logo": "https://example.com/logo.png",
"business_name": "Bright Smile Dental"
}
}
}
Only these fields are returned. Share URLs, allowed domains and API-key details are never included. Business.id is the ID to pass to List services.
Errors
| Status | message | Cause |
|---|---|---|
403 | origin_not_allowed | The form has Allowed Domains and the request came from somewhere else, or had no Origin or Referer. |
404 | Form not found | No form has this ID. |
500 | Server error | Also returned when form_id isn’t a valid UUID. |
Submit an entry
POST /api/v1/public/submitForm
| Header | Required | Value |
|---|---|---|
Content-Type | Yes | application/json |
X-Form-Api-Key | When the form has a key | The form’s API key. |
Body
| Field | Type | Required | Description |
|---|---|---|---|
formId | string (UUID) | Yes | The form to submit to. |
leadDetails | object | Yes | The entry, keyed by field key. You can also leave this out and put the field keys at the top level of the body, next to formId. |
form_status | string | No | Stored on the lead. The form widget sends Form Sent. Any value containing abandon (for example Abandoned Form) marks a partial capture. |
lead_type | string | No | Defaults to Form_Lead. Leave it out unless you have a reason to change it. |
company_website | string | No | Anti-bot honeypot. Leave it out or empty. If it has a value, Zoie answers with success and saves nothing. |
cf_turnstile_token | string | No | A Cloudflare Turnstile token. It is checked only when Turnstile verification is switched on for the platform, and ignored otherwise. |
Lead fields
These keys in leadDetails fill the matching lead fields:
| Key | Lead field |
|---|---|
first_name or firstname | First name |
last_name or lastname | Last name |
email | |
phone_number or phone | Phone number, normalised to E.164 (for example +15551234567) |
title | Title |
service | Service. If it matches the name of one of the business’s services and you don’t send service_value, that service’s price is copied to the lead’s service value. |
service_value | Service value |
additional_notes, inquiry or message | Notes |
location | Location |
website_name | Website name |
ip_address | The visitor’s IP address. It defaults to the caller’s IP, so a server relaying entries should pass the visitor’s real IP. |
utm_source, utm_medium, utm_campaign, utm_term, utm_network, utm_adgroup, utm_matchtype, utm_device | Campaign tracking |
gclid, gbraid, wbraid | Google Ads click IDs |
ad_consent_state | granted or denied |
appointment_date_time, appointment_date_time_end | ISO 8601 timestamps |
Any other key whose name matches an active custom field (ignoring case) is saved to that custom field. Other keys don’t reach the lead, but the full leadDetails object is kept with the form entry.
Example
curl -X POST "https://api-us.zoie.ai/api/v1/public/submitForm" \
-H "Content-Type: application/json" \
-H "X-Form-Api-Key: $ZOIE_FORM_API_KEY" \
-d '{
"formId": "6f1c2d3e-8a4b-4c1d-9e2f-0a1b2c3d4e5f",
"form_status": "Form Sent",
"leadDetails": {
"first_name": "Jane",
"last_name": "Smith",
"email": "[email protected]",
"phone_number": "+15551234567",
"service": "Teeth Whitening",
"utm_source": "google"
}
}'// Server-side (Node 18+). Never ship the form API key to the browser.
const res = await fetch('https://api-us.zoie.ai/api/v1/public/submitForm', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Form-Api-Key': process.env.ZOIE_FORM_API_KEY,
},
body: JSON.stringify({
formId: '6f1c2d3e-8a4b-4c1d-9e2f-0a1b2c3d4e5f',
form_status: 'Form Sent',
leadDetails: {
first_name: 'Jane',
last_name: 'Smith',
email: '[email protected]',
phone_number: '+15551234567',
service: 'Teeth Whitening',
utm_source: 'google',
},
}),
});
const body = await res.json();
if (!res.ok) throw new Error(body.message);
console.log('Lead', body.data.id);What Zoie does with an entry
- Checks the API key and allowed domains, as described in Access rules.
- Validates the entry against the form: every required field must have a value, and email fields must look like an email address. Conditional fields, and fields on conditional steps, are not checked.
- Runs the anti-bot checks, then checks the phone number, email and IP address against the business’s blocked list.
- Creates the lead with status New, marks it as a duplicate or related lead if the same email or phone number is already in the business, and saves the form entry.
- Starts AI follow-up and sends new-lead notifications, according to the business’s AI and notification settings.
The API doesn’t check whether the form is published. Any existing form ID accepts entries.
Response
201 Created. data is the new lead record, abridged here:
{
"success": true,
"message": "Lead created successfully from form submission.",
"data": {
"id": 18342,
"business_id": 42,
"first_name": "Jane",
"last_name": "Smith",
"email": "[email protected]",
"phone_number": "+15551234567",
"service": "Teeth Whitening",
"service_value": "250",
"lead_type": "Form_Lead",
"lead_status": "New",
"form_status": "Form Sent",
"utm_source": "google",
"is_duplicate": false,
"is_related": false,
"related_group_id": 18342,
"created_on": "2026-10-02T09:14:07.512Z"
}
}
Partial captures
When a visitor has typed something and leaves the page, the widget sends it with form_status: "Abandoned Form". It does this whether or not the form’s abandoned-lead capture setting is on, and the server doesn’t check that setting. A partial capture is stored as an incomplete form entry only. It skips validation and the anti-bot and blocked-list checks, and it doesn’t create a lead or start any AI. The response is 201 with "message": "Abandoned form data saved successfully." and the stored entry in data. See Abandoned form settings.
Errors
Errors have the shape { "success": false, "message": "…" }.
| Status | message | Cause |
|---|---|---|
400 | formId and leadDetails are required (or send a flat body with formId and field keys). | formId is missing. |
400 | Please correct the highlighted fields. | Validation failed. An errors object maps each field key to its problem, for example { "email": "Please enter a valid email address" }. |
400 | Bot verification failed. Please try again. | Turnstile is switched on and the token was missing or invalid. |
401 | Invalid or missing API key. | The form has a key and the header is missing or wrong. |
403 | origin_not_allowed | Blocked by Allowed Domains. |
403 | We could not submit this form. Please contact us directly. | The contact is on the business’s blocked list. The wording doesn’t reveal the block, because the widget shows this message to the visitor. |
404 | Form not found. | No form has this ID. |
413 | Submission payload exceeds maximum allowed size. | leadDetails is over 256 KB. |
429 | Too many requests, please try again later. | Rate limit reached. See Limits. |
500 | An error occurred while submitting the form. | The lead wasn’t created. |
List services
GET /api/v1/public/getServiceOptions/{business_id}
Lists the business’s products and services, newest first. The form widget uses it to fill a Service dropdown. Send the chosen service’s name as service when you submit.
| Parameter | In | Type | Default | Description |
|---|---|---|---|---|
business_id | path | integer | — | The business ID, from Business.id in the form. |
page | query | integer | 1 | Page number. |
limit | query | integer | 10 | Items per page, up to 100. |
curl "https://api-us.zoie.ai/api/v1/public/getServiceOptions/42?page=1&limit=50"const res = await fetch(
'https://api-us.zoie.ai/api/v1/public/getServiceOptions/42?page=1&limit=50'
);
const { data, pagination } = await res.json();{
"success": true,
"data": [
{
"id": 311,
"name": "Teeth Whitening",
"description": "In-office whitening, about 60 minutes.",
"price": "From $299",
"currency_code": "USD",
"type": "Starting at",
"image_url": null
}
],
"pagination": { "totalRecords": 12, "currentPage": 1, "totalPages": 1 }
}
| Field | Description |
|---|---|
price | The price as display text, for example 250 or From $299. It is null when AI Can Share Price is off for that item, which means the business doesn’t publish the price, not that the item is free. See Products and services. |
type | The pricing type shown next to the price: Fixed, Hourly, Starting at or Custom. |
| Status | message | Cause |
|---|---|---|
400 | Invalid business_id. | business_id isn’t a positive whole number. |
500 | Internal server error. | — |
Limits
| Limit | Default |
|---|---|
| Requests to each endpoint | 30 per 15 minutes per IP address, counted separately for each form (or each business, for services). A server relaying entries from one IP can send 30 entries per 15 minutes to each form. |
| Any request to the API | 600 per minute per IP address. |
leadDetails size | 256 KB. |
Responses carry RateLimit and RateLimit-Policy headers. A 429 response also has a Retry-After header (in seconds) and this body:
{
"success": false,
"error": "Too many requests",
"message": "Too many requests, please try again later.",
"limit": "public-lead",
"retryAfter": 840
}
Related
- API overview — every public endpoint in one place
- API keys — generating and rotating form keys
- Embedding forms — the share link, embed code and REST API tab
- Form embeds
- Leads — the other ways to get leads into Zoie