Leads from your website via the API
Ten minutes to turn every form submission on your site into a card in the CRM pipeline: the key, the board, the first request, wiring the form.
Every enquiry from a form on your site, a landing page or another system can become a card in a Witstally CRM pipeline on its own. One public API endpoint does it, POST /api/v1/public/leads. Setup takes about ten minutes and needs no developer until the last step.
Who can do this. The workspace Owner or the Full Access role can create API keys. Pipelines (boards) are visible to every board member.
How it works
A key belongs to one workspace (legal entity). It reaches exactly the boards that list this workspace among the board’s organisations. A new lead is tagged with your workspace and lands in the board’s first stage, together with the organisation, the contact and the message from the form.
Step 1. Prepare the pipeline
- Open CRM → Consolidated Board and pick the board that should receive enquiries, or create one, say “Website leads”.
- In the board’s settings add your workspace to the board’s organisations. Without this the API answers with
no_board. - Copy the board id from the address bar:
app.witstally.com/crm/board/{boardId}. You will send it with every request.
With several products, make a board per product and send a different boardId from different pages of the site.
Step 2. Create an API key
- Settings → API keys → New key.
- A name, for example “Website form”.
- Tick
leads:writeonly and press Create key. - Copy the key right away: only its fingerprint is stored, it will not be shown again.
Why leads:write alone: it is the one scope that grants no reading. Such a key can only create leads, so it is safe to put straight into the page’s code. If it ever leaks, revoke it on the same page and create a new one.
Step 3. Send the first lead
curl -X POST https://api.witstally.com/api/v1/public/leads \
-H "X-Authorization-Key: wsk_YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{
"company": "Acme Ltd",
"contactName": "Jane Doe",
"email": "jane@acme.example",
"phone": "+441234567890",
"message": "Please call me about the Professional plan",
"source": "website",
"externalId": "form-2026-10-12-001",
"boardId": "YOUR_BOARD_ID"
}'
The reply is 201 with the lead, including boardName and stageName. Open the board: the “Acme Ltd” card sits in the first stage, the Organisation block shows Acme Ltd, the contacts show Jane Doe, and the message is the first comment. The card’s timeline says “Lead created via API (website)”.
Request fields
| Field | Meaning |
|---|---|
boardId | the board; required when the workspace is on more than one board |
title | card title; defaults to the company, then the contact, then the email or phone |
company | the client organisation; matched by name or created |
contactName, email, phone | the card’s contact |
message | the form text; becomes the first comment. A good place for the language, the page URL and UTM tags |
source | where the lead came from: website, landing, a system name; lowercase |
externalId | your own id of the submission; with source it prevents duplicates |
expectedValue, currency | expected amount and currency, when known |
utmSource, utmMedium, utmCampaign | UTM tags of the visit that produced the lead; stored on the card and used for attribution in Verimetriq when the visitor cannot be matched by cookie |
At least one of title, company, contactName, email, phone must be present.
Step 4. Wire the form on the site
A minimal example for any site. Add it after your existing form submission, so nothing that already works changes:
const utm = new URLSearchParams(location.search);
const lead = {
email: form.email.value,
phone: form.phone.value,
message: `${form.text.value}\nPage: ${location.href}`,
source: 'website',
externalId: crypto.randomUUID(),
boardId: 'YOUR_BOARD_ID',
utmSource: utm.get('utm_source') || undefined,
utmMedium: utm.get('utm_medium') || undefined,
utmCampaign: utm.get('utm_campaign') || undefined,
};
fetch('https://api.witstally.com/api/v1/public/leads', {
method: 'POST',
headers: {
'X-Authorization-Key': 'wsk_YOUR_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify(lead),
keepalive: true,
}).catch(() => {});
On a site builder without code access, Zapier, Make or n8n make the same call: an HTTP request module with the X-Authorization-Key header.
Duplicates and retries
Sending the same source + externalId pair again returns 200 with the existing lead and creates nothing. Retries are therefore safe: generate externalId once per click on “Send” and repeat the request until you get a 2xx.
When something goes wrong
| Reply | Cause | What to do |
|---|---|---|
401 | wrong or revoked key | check the header and the key |
403 | the key lacks leads:write | create a key with that scope |
400 | fields missing; details names them | usually boardId |
422 no_board | the workspace is on no board | step 1 |
429 | more than 300 requests a minute | wait for Retry-After |
The full API reference, with the other resources, is at api.witstally.com/api/v1/public/docs.