Docs · Guides
Forms and surveys
Forms and the sign-up API add subscribers from your website. Surveys ask questions, with skip logic, and write the answers back to your contacts.
Forms
- Open Forms and create one. Choose its fields from First Name, Last Name, Email, Company and Message. Email and first name are required when the form is submitted.
- Choose the list new sign-ups go to, or create one, and which fields are saved on the contact (first name, last name, company).
- Optionally turn on a welcome email: a subject, a body that can use
{{first_name}}and{{last_name}}, a delay in minutes (5 by default) and the address it's sent from. - Press Get Embed Code and paste the snippet into your page: a placeholder
<div>and a script that draws the form. Restyle it with the CSS variables in the snippet.
Each form's page lists its submissions.
Open to any website
The form endpoint accepts submissions from any origin, with no key and no captcha. Anyone who has the form's address can post to it.
The sign-up API
If you'd rather build your own form, send sign-ups to POST /api/subscribe. Create a key under Settings, then Signup forms and API, and send it in the X-API-Key header:
curl -X POST https://crm.example.com/api/subscribe \
-H "Content-Type: application/json" \
-H "X-API-Key: <your API key>" \
-d '{
"email": "jane@example.com",
"first_name": "Jane",
"last_name": "Smith",
"company": "Example Ltd"
}'emailandfirst_nameare required;last_nameandcompanyare optional.- Responses:
200with{"success":true};400for invalid JSON or a missing field;401for a missing or unknown key. - New contacts are added as subscribed. An address that's already a contact isn't changed, but either way the person counts as having signed themselves up, which outlasts an earlier opt-out from prospecting.
- Everyone goes to the default list, the first list the app created (Default Synced List). You can't choose another list through the API yet.
To call it from a browser on your website, a self-hosted copy must list that site in SUBSCRIBE_ALLOWED_ORIGINS (comma-separated, such as https://example.com). With none set, browsers on other sites are refused. Calls from your own server aren't affected. The key is visible to anyone who reads your page's code, so use one just for this.
Build a survey
Open Surveys and start from a blank survey or a starter: NPS with a follow-up, customer satisfaction, product feedback, event feedback or lead qualification.
- Questions: short text, long text, email, number, date, single choice, multiple choice, dropdown, rating (stars, hearts or numbers), NPS, scale and yes/no. Each can be required. Choice questions can shuffle their options, single and multiple choice can offer "Other" with free text, and multiple choice can set minimum and maximum picks.
- Content: headings, text, images, dividers, spacers and raw HTML between questions.
- Skip logic: split the survey into pages, and add rules to a page that jump to another page or end the survey, based on answers (answered, equals, includes, greater than and so on, with all or any).
- Contact fields: save an answer to a built-in or custom contact field, always or only when it's empty.
Survey settings include identifying contacts from the Email question, adding new respondents to a list, allowing more than one response per contact, a Back button, notifications of new responses, a closing date, the thank-you message or a redirect, and the theme, including a progress bar and button labels.
Publish and share a survey
Publish the survey before you share it: draft links show "not found". You can close it and reopen it later. Once it has responses, duplicate it to change its structure.
- Public link at
/s/<survey id>. Responses are anonymous unless the survey has an Email question and identifies contacts. - QR code, downloadable as PNG or SVG.
- Embed on a website: an iframe with a small script that resizes it to fit.
- Send by email: add a Survey block to a campaign. Each recipient gets a personal link, so answers go straight onto their contact. Choose Answer in email to put the first question in the email itself, if it's a rating, NPS, scale, yes/no, or single choice with up to 6 options.
Embed for signed-in users
If the survey sits inside your own app, your server can ask for a personal link for the signed-in user. Their answers go to their contact, and they never see the Email question. Use a key from Signup forms and API, and call this from your server, never the browser:
curl -X POST https://crm.example.com/api/surveys/<survey id>/token \
-H "Content-Type: application/json" \
-H "X-API-Key: <your API key>" \
-d '{ "email": "jane@example.com", "firstName": "Jane", "lastName": "Smith" }'
# 200: { "url": "https://crm.example.com/s/<survey id>?embed=1&t=...",
# "token": "...", "expiresAt": "...", "contact": "existing" }Use the returned url as the iframe's src. It's valid for 24 hours. email is required. If the email isn't a contact yet, one is only created when the survey adds new respondents to a list; contact says which happened. Other responses: 401 bad key, 404 no such survey, 409 survey not published, 429 too many requests.
Results and export
The summary shows responses started and completed, the completion rate, median time, drop-off by page, and a chart or statistics for each question. The Responses tab lists every response, and you can export or delete them. Partial responses are saved, and anonymous respondents can pick up where they left off. Each response records where it came from: email, an answer in the email, the link, an embed or a QR code.
Something wrong or missing? Email pele@magpiecrm.com or open an issue.