CRM Web Forms API
Send website leads to the CRM, and manage the forms they come through.
Admin routes need a session. Public routes need no login: the form's token in the URL is the only gate, so treat it as public.
| Method | Path | Permission | Tool |
|---|---|---|---|
| GET | /crm/lead-forms | crm:read | list_crm_lead_forms |
| POST | /crm/lead-forms | crm:manage_stages | create_crm_lead_form |
| PATCH | /crm/lead-forms/:id | crm:manage_stages | update_crm_lead_form |
| DELETE | /crm/lead-forms/:id | crm:manage_stages | delete_crm_lead_form |
| GET | /public/crm/lead-forms/:token | none | — |
| POST | /public/crm/lead-forms/:token | none | — |
A form in the admin routes carries submit_path, hosted_url (the hosted form page, on the tenant's own domain when it has one) and embed_code (an iframe of that page, ready to paste). To show the form in another language, replace /en/ in the page's address with /it/, /de/, /fr/ or /sq/.
Submit a lead
POST /public/crm/lead-forms/:token takes JSON or form-encoded fields.
| Field | Required | Limit | Notes |
|---|---|---|---|
name | yes | 200 | |
email | yes | 320 | Must be a valid address. |
phone | no | 50 | |
company | no | 200 | |
website | no | 2,048 | |
message | no | 5,000 | |
utm_source, utm_medium, utm_campaign, utm_term, utm_content, gclid, fbclid | no | 500 each | Stored on the deal and shown in its note. |
hp_field | no | 200 | The spam trap. Leave it empty. If it's filled, the reply is still received, but no deal is made. |
Any other field is kept in the deal's note, up to 20 fields and 500 characters each. A field's name must start with a letter or a digit, and only text, numbers and true/false values are kept.
curl -X POST "https://your-app.example/public/crm/lead-forms/<TOKEN>" \
-H "Content-Type: application/json" \
-d '{"name":"Lena Hofer","email":"lena@example.com","message":"We need a new website.","utm_source":"google"}'| Status | Meaning |
|---|---|
| 202 | Accepted. status is received, or duplicate when an open deal already has this email and the message was added to it. |
| 400 | name or email is missing or invalid, or a known field is too long. |
| 404 | Unknown or inactive form. The reply doesn't say which. |
| 429 | More than 20 posts in a minute from one IP address. |
Send this from a server. A browser on another site is blocked by CORS, so to show a form in the visitor's browser, use the hosted page or its embed code.
Read a form's page
GET /public/crm/lead-forms/:token returns what the hosted page shows: name, organisation_name and, where set, legal (the privacy notice and footer). It returns no ids. An unknown or inactive form is a 404.