# Connect a website

Every website or tool that sends submissions to a form is a source. Each source has its own endpoint address, so you can see where submissions come from, pause one, or replace it without touching the others.

**On this page you will learn**

- What a source is and where to find its endpoint
- Step by step setup for each supported platform
- How field names, allowed websites and file uploads work
- What visitors see after they submit
- How to test the connection before you go live
- How to fix the most common problems

## What a source is

A source connects one website, app or tool to one form. When you add it, Formpik makes a unique key and an endpoint address built from it. Your website posts each submission to that address, and Formpik stores it under the form and runs the form's live flows.

1. **Your website**: Posts the answers to the source endpoint.
2. **Source**: Checks the key, allowed websites, pauses and limits.
3. **Form**: Stores the answers and any files as a submission.
4. **Flows**: Every live flow of the form runs on it.
5. **Destinations**: Email, chat and webhooks get the result.

The endpoint answers your website first, then runs the flows, so a slow destination never slows down your form.

A source has one of three statuses:

| Status | What it means |
| --- | --- |
| `Waiting for first submission` | The source was added but nothing has arrived yet. |
| `Receiving` | At least one submission arrived. The source shows when the last one came in. |
| `Paused` | The endpoint refuses every submission with a 403 until you resume it. |

## Add a source

1. **Open the form**

   Open the form and go to its **Connect** tab, or open the **Sources** page.
2. **Choose a platform**

   Pick where the form lives: Webflow, Framer, WordPress, Wix, Squarespace, HTML form, JavaScript or API, Zapier or Make. The platform decides which setup steps and which snippet you get.
3. **Name it and add the website**

   The name is shown on every submission, so you know where it came from. The website is optional. When the form already limits its allowed websites, the website you enter is added to that list.
4. **Copy the endpoint**

   Formpik shows the endpoint address with a copy button, the setup steps, a ready snippet and the table of field names your website must send.

*Endpoint*

```
POST https://formpik.com/api/in/YOUR_SOURCE_KEY
```

The source key is the last part of the address. It is made of lowercase letters and digits. Your plan sets how many sources a workspace can have, see [Plans and limits](https://formpik.com/docs/plans).

> **New endpoint URL replaces the key**
>
> **New endpoint URL** gives the source a new key. The old address stops working right away and answers 404, so update your website at the same time. Removing a source does the same and keeps the submissions it already sent.

## Platform guides

These are the same steps the Connect tab shows for each platform.

### Webflow

Point a native Webflow form at your endpoint. The Connect tab gives you the .

1. **Step 1**

   In the Webflow Designer, select the Form Block and open its settings.
2. **Step 2**

   Set Action to your endpoint URL and Method to POST.
3. **Step 3**

   Give every input a Name that matches a field key listed below.
4. **Step 4**

   In Site settings, open Custom code and paste the script below into Footer code. Your Form Block's own success and error messages then show, and its Redirect URL works.
5. **Step 5**

   Publish the site and send one test submission.

> **Webflow tip**
>
> Add the Formpik script once in Footer code, so Webflow's own success and error states show and visitors stay on the page. Without it, visitors leave the page after they submit. See After someone sends a form.

### Framer

Send Framer form submissions to a webhook. The Connect tab gives you the cURL command.

1. **Step 1**

   Select your form in Framer and open the form's settings.
2. **Step 2**

   Choose to send submissions to a webhook and paste your endpoint URL.
3. **Step 3**

   Name each input after a field key listed below.
4. **Step 4**

   Publish and submit the form once to see it arrive.

> **Framer tip**
>
> The Connect tab shows a cURL command for Framer sources. Run it once to check the address and the field names before you publish.

### WordPress

Use the HTML snippet or your form plugin webhook. The Connect tab gives you the HTML snippet.

1. **Step 1**

   Add the HTML snippet below to a Custom HTML block, or paste the endpoint URL into your form plugin's webhook settings.
2. **Step 2**

   Keep every input name exactly the same as the field keys below.
3. **Step 3**

   Update the page and send one test submission.

> **WordPress tip**
>
> If you paste the endpoint into a form plugin's webhook settings, map each plugin field to a field key from the table below. If you use the HTML snippet, the names are already right.

### Wix

Embed the HTML snippet with an Embed HTML element. The Connect tab gives you the HTML snippet.

1. **Step 1**

   Add an Embed HTML element where the form should appear.
2. **Step 2**

   Paste the HTML snippet below into it.
3. **Step 3**

   Publish the site and send one test submission.

> **Wix tip**
>
> The HTML snippet is a complete form with every field of your form, the spam trap and the submit button.

### Squarespace

Paste the HTML snippet into a Code block. The Connect tab gives you the HTML snippet.

1. **Step 1**

   Add a Code block to the page.
2. **Step 2**

   Paste the HTML snippet below and save.
3. **Step 3**

   Publish and send one test submission.

> **Squarespace tip**
>
> The HTML snippet is a complete form. Style it with your own CSS inside the same Code block.

### HTML form

Any website: set the form action to your endpoint. The Connect tab gives you the HTML snippet.

1. **Step 1**

   Set your form's action to the endpoint URL and its method to POST.
2. **Step 2**

   Name each input after a field key listed below.
3. **Step 3**

   Keep the script line and the two message lines from the snippet, so visitors stay on the page and see the right message.
4. **Step 4**

   Add a hidden _redirect input if visitors should land on your own thank-you page instead.

> **HTML form tip**
>
> Add `enctype="multipart/form-data"` to the form tag when the form has a file field. The generated snippet does this for you.

### JavaScript or API

Send JSON from your app, backend or a custom form. The Connect tab gives you the JavaScript snippet.

1. **Step 1**

   Send a POST request with a JSON body to the endpoint URL.
2. **Step 2**

   Use the field keys below as JSON property names.
3. **Step 3**

   A 200 response means the submission was accepted and your flows are running.

> **JavaScript or API tip**
>
> Your code gets JSON back with `ok`, the submission `id` and your form's success message. See [Send a submission](https://formpik.com/docs/api/submit) for every option.

### Zapier or Make

Forward data from any app that Zapier or Make supports. The Connect tab gives you the cURL command.

1. **Step 1**

   Add a Webhooks step that sends a POST request at the end of your Zap or scenario.
2. **Step 2**

   Paste the endpoint URL and map your data to the field keys below.
3. **Step 3**

   Run it once to send a test submission.

> **Zapier or Make tip**
>
> Send the request as JSON from your Zap or scenario. A request without an `Origin` or `Referer` header always passes the allowed websites check.

## Generated snippets

For a Contact form with a name, an email, a topic, a message and a file, the Connect tab generates these snippets. Yours use your own fields and your own endpoint:

*HTML*

```html
<form action="https://formpik.com/api/in/YOUR_SOURCE_KEY" method="POST" enctype="multipart/form-data">
  <label for="full_name">Full name</label>
  <input id="full_name" name="full_name" type="text" required>
  <label for="email">Email</label>
  <input id="email" name="email" type="email" required>
  <label for="topic">What can we help with?</label>
  <select id="topic" name="topic" required>
    <option value="">Choose one</option>
    <option value="sales">Sales</option>
    <option value="support">Support</option>
    <option value="other">Something else</option>
  </select>
  <label for="message">Message</label>
  <textarea id="message" name="message" rows="4" required></textarea>
  <label for="brief">Project brief</label>
  <input id="brief" name="brief" type="file" accept=".pdf">

  <!-- Spam trap: keep it hidden and empty -->
  <input type="text" name="_gotcha" tabindex="-1" autocomplete="off" style="display:none">

  <button type="submit" data-wait="Sending...">Send</button>

  <!-- Shown after sending, by the Formpik script below -->
  <p data-formpik-success hidden>Thanks, we've received your submission.</p>
  <p data-formpik-error hidden></p>
</form>
<script src="https://formpik.com/formpik.js" defer></script>
```

*JavaScript*

```js
const response = await fetch("https://formpik.com/api/in/YOUR_SOURCE_KEY", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({
    "full_name": "Jane Cooper",
    "email": "jane@example.com",
    "topic": "sales",
    "message": "Hi, we would like to talk about a new website for our team. Could you share your availability next week?"
  })
})

if (!response.ok) {
  // Show your own error message here
}
```

*cURL*

```bash
curl -X POST "https://formpik.com/api/in/YOUR_SOURCE_KEY" \
  -H "Content-Type: application/json" \
  -d '{"full_name":"Jane Cooper","email":"jane@example.com","topic":"sales","message":"Hi, we would like to talk about a new website for our team. Could you share your availability next week?"}'
```

The JavaScript and cURL versions send JSON, which cannot carry files, so they leave the file field out.

## Match the field names

Your website must send each answer under the **key** of its field, not its label. In HTML the key is the input's `name`, in JSON it is the property name. The Connect tab lists every key with its type and what it should look like. For the example form:

| Name | Field | Sends | Required |
| --- | --- | --- | --- |
| `full_name` | Full name | Text | Yes |
| `email` | Email | An email address | Yes |
| `topic` | What can we help with? | The value of one option | Yes |
| `message` | Message | Text, line breaks kept | Yes |
| `brief` | Project brief | A file in a multipart upload, up to 10 MB each | No |
| `_gotcha` | Spam trap | Hidden, leave empty | No |

- Fields that take several values, such as checkboxes and multi-selects, end in `[]` in HTML: `interests[]`. A repeated name collects its values into a list too. In JSON, send an array.
- Choice fields send the option **value**, such as `sales`, not the label. Flows and emails show the label.
- Answers with names the form does not know are still stored with the submission.
- With **Learn new fields automatically** on (the default), unknown names are added to the form as new fields when they arrive, up to 50 per submission. Only names made of lowercase letters, digits and underscores, up to 40 characters, are learned: `company_size` is learned, `Company Size` is only stored. Names starting with `_` are never learned.
- See [Field types](https://formpik.com/docs/field-types) for the exact format of every type.

## Allowed websites

Under the form's **Settings**, **Allowed websites** limits which websites may post to it. Formpik reads the website from the request's `Origin` header, or the host of its `Referer`.

- With no websites listed, the form accepts submissions from anywhere.
- A listed website also allows its subdomains: `yourcompany.com` allows `www.yourcompany.com` and `shop.yourcompany.com`. The other way round does not work, so list the main domain.
- You can type a full address such as `https://yourcompany.com/contact`. Only the host is kept.
- Requests without an `Origin` or `Referer`, such as calls from a server, Zapier or cURL, always pass.
- Requests with a valid API key in `Authorization: Bearer` skip the check, and the bot check too.
- Anything else is refused with a 403 that names the website, and browsers get no CORS headers for it.

## File uploads

Files need a multipart upload: an HTML form with `enctype="multipart/form-data"`, or a `FormData` body in JavaScript. JSON cannot carry files.

| Limit | Value |
| --- | --- |
| Files per submission | 10 |
| Size of one file | 10 MB |
| Whole request | 25 MB |
| File name | 120 characters, slashes and line breaks replaced |

- Empty file inputs are ignored, so an optional upload left blank is fine.
- The answer of a file field is the file name, or a list of names for several files.
- Files are stored privately. Open them from the submission in your inbox, where each one opens through a link that works for 15 minutes. Webhooks and the API carry the file names, not the files.
- Files are removed together with their submission, also when it passes the form's retention period.

*JavaScript with files*

```js
const form = document.querySelector("#contact")

form.addEventListener("submit", async event => {
  event.preventDefault()

  const response = await fetch("https://formpik.com/api/in/YOUR_SOURCE_KEY", {
    method: "POST",
    body: new FormData(form)
  })
  const result = await response.json()

  form.querySelector(".status").textContent = result.message
})
```

Leave the `Content-Type` header out with `FormData`. The browser sets it with the boundary of the upload.

## After someone sends a form

What visitors see is set per form, under **After submitting** in its Settings: a message, your own page, or a different page depending on their answers, with an optional short pause on the message first and your own error text.

Without the script, a form that posts to Formpik leaves the page, the way every plain form does. Visitors land on the page those settings pick, and otherwise on a short thank you page, or back on the page they came from with `?submitted=1` added. Webflow's own success and error messages never show, because Webflow only shows them for forms it sends itself.

Add the Formpik script once to keep visitors on the page instead. It sends every form whose action is a Formpik endpoint in the background, shows the button's `data-wait` text while it sends, and then shows the message you designed.

*Before the closing body tag, or Footer code in Webflow*

```html
<script src="https://formpik.com/formpik.js" defer></script>
```

| On your page | What the visitor sees |
| --- | --- |
| Webflow Form Block | Its own success state, with the form hidden, or its own error state. The **Redirect URL** in the Form Block settings still works. |
| `data-formpik-success` and `data-formpik-error` | Inside the form: the message shows and the form is cleared for the next one. Next to the form: the form is hidden, like Webflow. |
| No message elements | A short line under the form with the success message from the form settings, or the reason it was not sent. |
| A page to go to | A matching **Pages by answer** rule wins. Then the redirect set on your website (Webflow's Redirect URL, or a hidden `_redirect` input), then **Go to a page**. With a pause set, the message shows first. |

Messages you wrote stay as they are. Formpik fills in a message element only when it is empty, or the text of an element marked `data-formpik-message` inside it. Put that attribute on the text of a Webflow error block (Element settings, Custom attributes) to show the form's **Error message**, or the exact reason, such as a paused form or too many tries, when you left it empty.

### Your own steps after sending

Most forms need no code: pages by answer and answers in the address cover booking pages, personal thank you pages and prefilled calendars. For anything else, the script sends three events from the form, so one listener covers every form on the page. Each one can be stopped with `event.preventDefault()`, and on success you can change `event.detail.message`, `event.detail.redirect` or `event.detail.delay` before the visitor sees them.

| Event | When | detail |
| --- | --- | --- |
| `formpik:submit` | Before sending. Stop it to run your own checks first. | `values`, `form` |
| `formpik:success` | The submission is saved and your flows are running. | `id`, `message`, `redirect`, `delay`, `values`, `form` |
| `formpik:error` | It was refused or could not be sent. status is 0 when the visitor is offline. | `status`, `message`, `values`, `form` |

*Book a call for big budgets*

```html
<script>
  document.addEventListener("formpik:success", event => {
    if (event.detail.values.budget === "50k_plus") {
      event.detail.redirect = "https://cal.com/yourcompany/intro"
    }
  })
</script>
```

- With Google Tag Manager on the page, every send also adds a `formpik_success` or `formpik_error` event to the data layer, with the form's name, so you can fire a conversion without writing code.
- `Formpik.submit(form)` sends a form from your own code, for example from the last step of a multi-step form. It checks required fields first.
- Forms on another address are picked up when they carry `data-formpik`, and `data-formpik="off"` leaves a form alone.
- Answers still go through your flows on Formpik, so routing, AI, emails and webhooks work the same with or without the script.

> **Allowed websites**
>
> When the form lists allowed websites, add every address the form runs on, including the `webflow.io` staging address, or the error message shows instead. The script lives at `https://formpik.com/formpik.js`.

### Sending with your own JavaScript

Requests that send JSON, send an `X-Requested-With` header, or do not ask for `text/html` (which includes `fetch` with `FormData`) get JSON back instead of a redirect. The Formpik script reads the same answer.

*200 OK*

```json
{
  "ok": true,
  "id": "sub_7k2m9x4q1w3e5r6t",
  "message": "Thanks, we've received your submission."
}
```

`message` is the form's **Success message**. When the form sends visitors to a page, the answer also carries `redirect` and `redirectDelay`. Errors come back with `"ok": false` and a `message` you can show as it is: the form's **Error message** when you set one, otherwise the exact reason. See [Errors and limits](https://formpik.com/docs/api/errors).

## Field errors on your website

Each field can carry rules, such as a length, the countries a visitor may pick, work emails only or dates on weekdays. With **Refuse answers that break the field rules** on, the endpoint refuses a submission that breaks one with a `422` and stores nothing. The answer names every field and what to fix, keyed by the field key:

*422 Unprocessable Content*

```json
{
  "ok": false,
  "message": "Please check the highlighted answers and try again.",
  "reason": "Email: Use your work email address. Preferred date: Pick a Monday, Tuesday, Wednesday, Thursday or Friday",
  "errors": {
    "email": "Use your work email address",
    "preferred_date": "Pick a Monday, Tuesday, Wednesday, Thursday or Friday"
  }
}
```

- The Formpik script shows each message right under its field, marks the input with `aria-invalid` and moves focus to the first one. Put an element with `data-formpik-error-for="email"` in the form to choose where the email message goes, and style `.formpik-field-error` to change how the messages look.
- A message for a field the page does not have is added to the general error message, so the visitor always sees it.
- A classic form post without the script gets a page listing every message with a link back to the form.
- The HTML snippet carries the rules a browser can check by itself, such as lengths, patterns and earliest dates, so most problems show before anything is sent.

### Check answers without sending

Every endpoint has a check-only address next to it. It takes the same answers, runs the same rules and stores nothing, so your page can tell visitors what to fix while they fill in the form. Add `data-formpik-validate="live"` to a form and the script checks each field as the visitor leaves it. `Formpik.validate(form)` checks a whole step of a multi-step form before moving on.

*HTML*

```html
<form action="https://formpik.com/api/in/YOUR_SOURCE_KEY" method="POST" data-formpik-validate="live">
  ...
</form>
<script src="https://formpik.com/formpik.js" defer></script>
```

*JavaScript*

```js
const response = await fetch("https://formpik.com/api/in/YOUR_SOURCE_KEY/validate", {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringify({ email: "jane@gmail.com" })
})

const { valid, errors } = await response.json()
// errors.email is "Use your work email address" when the form wants work emails
```

- `POST https://formpik.com/api/in/YOUR_SOURCE_KEY/validate` answers `{ "ok": true, "valid": false, "errors": { ... } }`, or `"valid": true` with no errors, whether or not the form refuses broken answers.
- `GET https://formpik.com/api/in/YOUR_SOURCE_KEY/rules` lists the fields with their types, options and rules, for code that checks answers in the browser itself.
- **Blocked words** and **One per answer** are checked only when the form is really sent, so neither address reveals your word list or whether someone already signed up.
- Both addresses follow the allowed websites of the form, like the endpoint itself.

## Spam protection

- **Spam trap field** (on by default): keep the hidden `_gotcha` input in your form and leave it empty. People never see it, bots fill it in. A filled trap stores the submission under Spam with the reason, and no flows run.
- **Bot check**: with Cloudflare Turnstile or Google reCAPTCHA chosen in the form settings, add the widget to your page. It sends `cf-turnstile-response` or `g-recaptcha-response` with the form. A missing or failed check also stores the submission as spam.
- Spam is answered like a normal submission, so bots learn nothing. Review it under the **Spam or invalid** filter of the inbox, and choose **Not spam** on anything real, which runs its flows.
- **Limit per visitor** caps submissions from one address per hour (30 by default, 0 turns it off), on top of 120 posts a minute per address for every endpoint.

More in [Spam, privacy and security](https://formpik.com/docs/security).

## Test the connection

1. **Open the endpoint in a browser**

   A GET on the address answers with the form it belongs to, such as `This is the Formpik endpoint for "Contact". Send submissions with POST.` A 404 means the key is wrong.
2. **Send one real submission**

   Submit your live form once, or run the cURL command from the Connect tab. Use answers you recognize.
3. **Check the source**

   The source changes from `Waiting for first submission` to `Receiving` and shows the time of the last submission.
4. **Check the inbox**

   Open **Submissions**. The new submission shows its answers, the page it came from and every flow run with its steps. The inbox refreshes on its own every 30 seconds.

> **Test submissions are different**
>
> Test submissions from the form builder never pass through the endpoint. Their flows are simulated, so nothing is emailed, posted or sent to a webhook, and they do not count toward your monthly submissions. Use a real post to test a destination.

## Troubleshooting

| Symptom | Cause | Fix |
| --- | --- | --- |
| 404 "This form endpoint does not exist" | The key in the address is wrong, was replaced with New endpoint URL, or the source was removed. | Copy the address again from the Connect tab. |
| 403 "Submissions from ... are not allowed" | The page’s website is not in the form’s allowed websites. | Add the main domain under Settings, Allowed websites. Subdomains are included. |
| 403 "This form source is paused" or "This form is paused" | The source is paused, or Accept submissions is off on the form. | Resume the source, or turn Accept submissions back on. |
| The browser console shows a CORS error | The page is not an allowed website, so the preflight is refused. | Add the website to the allowed websites. |
| Answers arrive but not under your fields | The input names differ from the field keys, for example Email instead of email. | Rename the inputs to the keys in the Connect tab. |
| New names are stored but not added as fields | Only lowercase names with letters, digits and underscores are learned, or learning is off. | Use names like company_size, or add the field yourself. |
| The file field only holds a file name | The form was not sent as a multipart upload. | Add enctype="multipart/form-data" to the form, or send FormData. |
| Submissions land under Spam | The spam trap was filled in, for example by autofill on a visible input, or the bot check failed. | Keep _gotcha hidden and empty, and check the bot check widget is on the page. |
| 429 "Too many submissions" | More than 120 posts a minute from one address, the form’s hourly limit per visitor, or the plan’s monthly submissions. | Wait and try again, raise the form’s limit, or change plan. |
| 415 "Send the form as JSON..." | The body type is not JSON, a form post or a multipart upload. | Set Content-Type to application/json, or post a regular form. |
| A second identical submission is missing | The same answers from the same source within 10 seconds count as one. | Nothing to fix. This protects against double clicks. |
| Visitors land on a plain Thank you page | There is no redirect and the browser sent no page address. | Add the Formpik script to keep visitors on the page, or pick Go to a page under After submitting in the form settings. |

## Common questions

### Can one form have several sources?

Yes. Add one source per website or tool. Each gets its own endpoint and its own status, and a flow can be limited to some sources in its trigger.

### Is the endpoint address a secret?

No, it sits in your page’s HTML for everyone to see. Protect a form with allowed websites, the spam trap, a bot check and the limit per visitor. Keep API keys secret instead.

### Do I need an API key to send submissions?

No. An API key is only useful from your own server: it skips the allowed websites check and the bot check. Never put one in a web page. See [API overview](https://formpik.com/docs/api).

### What happens to submissions when I pause a source?

They are refused with a 403 and not stored. Your website shows the error. Submissions that arrived before stay in the inbox.

### Can I send to the endpoint from a mobile app or a backend?

Yes. Send JSON with a POST. A request without an `Origin` or `Referer` header is never blocked by allowed websites.

- [Send a submission](https://formpik.com/docs/api/submit): Every header, body option and answer of the endpoint.
- [Build a flow](https://formpik.com/docs/flows): Route each submission to the right people.
- [Destinations](https://formpik.com/docs/destinations): Connect email, Slack, Teams, Discord and webhooks.
- [Spam and security](https://formpik.com/docs/security): Spam trap, bot checks, limits and privacy.

---

Source: https://formpik.com/docs/sources
