# Forms

Contact forms, waitlists and surveys for your site. Every response is kept in Pagebee, on the form's own page. Each form can also email its responses to anyone you choose, open a conversation in your [inbox](/docs/conversations-api), both, or neither.

Forms work with the HTML you already have. Point a form's `action` at Pagebee and it posts there, with no script and no cookie. Or use the form Pagebee hosts for you.

## Make a form

In the dashboard, open a site, then **Forms** and **New form**. Start from a template, then change anything under the form's **Settings**:

- **Contact form:** name, email and message.
- **Waitlist:** an email, and a name if they like.
- **Bug report:** an email, what happened, what they were doing, the page, and how much it's getting in their way. Responses open a conversation in the inbox.
- **Create your own:** one email question, ready for yours.

Or ask your agent. With a dev key, the [MCP](/docs/mcp) tool `create_form` makes one and returns its endpoint. Pass `template` (`contact`, `waitlist`, `bug_report` or `custom`) for a starter, or `fields` for your own questions:

```json
{
  "site_id": "your site id",
  "name": "Waitlist",
  "template": "waitlist",
  "notify_emails": ["you@example.com"],
  "to_inbox": false
}
```

The answer has an `endpoint` like `https://api.pagebee.ai/f/pbf_x7Kq2mP9aLs4Rt8w` and a `hosted_url` on pagebee.ai.

## Put it on your site

Set your form's `action` to the endpoint and its `method` to `post`. Each input's `name` is the question it answers.

```html
<form action="https://api.pagebee.ai/f/pbf_x7Kq2mP9aLs4Rt8w" method="post">
  <input name="name" placeholder="Your name" required>
  <input name="email" type="email" placeholder="Your email" required>
  <textarea name="message" required></textarea>
  <input type="text" name="_gotcha" tabindex="-1" autocomplete="off" style="display:none">
  <button type="submit">Send</button>
</form>
```

After sending, the browser goes to the form's thank-you page if you set one, or to Pagebee's page with your thank-you line.

To stay on the page, send it with `fetch` and ask for JSON:

```js
const res = await fetch("https://api.pagebee.ai/f/pbf_x7Kq2mP9aLs4Rt8w", {
  method: "POST",
  headers: { Accept: "application/json" },
  body: new FormData(form),
});
if (res.ok) showThanks();
else showError((await res.json()).message);
```

A successful response is `201` with `{ "ok": true, "id": "..." }`. A missing answer is `400` with a `message` you can show, like `Fill in Message`.

Prefer not to build anything? Every form has a hosted page at `https://pagebee.ai/f/<key>`. Link to it from anywhere.

## Where responses go

Every response is stored in Pagebee and shown on the form's page, newest first. Each response also lands in the [live feed](/docs/live-feed) as "New response to" the form, without who sent it or what they wrote, and clicking it opens the response. On top of that, each form can:

- **Email each response** to up to 10 addresses. The email lists the answers in the form's order and the page it was sent from. When the person gave an email, replying to the email answers them directly.
- **Open a conversation in the inbox.** The response becomes a conversation named after the form, which you can assign, tag and reply to like any other. Replies go to the person by email.

Use either, both, or neither. With neither, responses wait on the form's page for you to handle however you like. **Send a test email** in the form's settings sends a sample response to every address, so you can check it arrives.

Emails to people outside your workspace count against the workspace's daily support email limit, the same one inbox replies use. Emails to your own members don't. If an email can't go, the response is still kept and says why.

## Questions

Each question has a label, the name it's sent under, an answer type and whether it's required. The types are short text, email, long text, phone, link, number, choice and tick box. Pagebee checks required questions, email addresses, numbers and choices before it keeps a response.

Names match loosely: `Email`, `email` and `e-mail` are the same question. Answers sent under names the form doesn't list are kept too, at the end, so changing your HTML never loses anything.

## Spam and limits

- **The honeypot.** Add a hidden input named `_gotcha`. People never fill it in; bots do. Anything that fills it is told it worked and nothing is kept.
- **Only your pages.** When a browser says which page it's on, that page must be one of the site's hostnames (the same [hostname rules](/docs/environments) as analytics) or Pagebee's hosted form. Responses from a staging or preview host are kept and marked with that environment. Requests from a server, with no page, are accepted as production.
- **Rate limits.** Ten responses a minute from one network to one form, and 120 a minute to a form in total.
- **Sizes.** Up to 50 answers a response and 10,000 characters an answer. Names starting with `_` are controls, never stored.
- **Bodies.** Form-encoded, multipart (what `FormData` sends) or JSON, up to 128 KB. Files aren't taken yet.

Pagebee stores the answers, the page they came from and the time. It never stores an IP address or a user agent, and responses are never joined to analytics.

## Import a list you already have

Moving a waitlist or a sign-up list from somewhere else (a spreadsheet, a CRM, an old site)? Open the form and choose **Import**. Paste CSV or pick a file, say which column holds the email, and optionally the name, the date they signed up and where they came from, then check the list before importing.

- **Dates are kept.** Each person keeps the date in your list, so the form shows when they really joined. Without a date column, they join today.
- **Nobody is told.** Imported people aren't emailed, don't open conversations in the inbox and don't reach the live feed.
- **Duplicates are skipped.** Anyone already on the form, or repeated in the list, is left out, so importing the same file twice adds nothing.
- **Anything that isn't an email is skipped** and listed by row, so you can fix it and import again.
- **Labelled.** Each imported response shows "Imported" and its source, which also goes under the form's `source` question when it has one.

Up to 5,000 rows go in each request; the dashboard splits a bigger file for you. Your agent can do the same with the `import_form_responses` tool, which checks the list first by default.

## Archive, don't delete

A form with responses can't be deleted. Archive it instead: it keeps every response and takes no new ones, and posting to it answers `410`. Unarchive it to take responses again. A form that has never had a response can be deleted.

You can delete a single response, for spam or when someone asks for their data to be erased.

## API

| Method and path | What it does |
| --- | --- |
| `GET /f/:key` | The form's public side: name, site, questions, thank-you line and whether it's closed. Never where responses go |
| `POST /f/:key` | Send a response, form-encoded or JSON |
| `GET /api/properties/:id/forms` | A site's forms, with response counts |
| `POST /api/properties/:id/forms` | Make a form |
| `GET`, `PATCH`, `DELETE /api/forms/:id` | Read, change, archive (`{ "archived": true }`) or delete a form |
| `GET /api/forms/:id/responses` | Responses, newest first. Page with `before` |
| `GET /api/forms/:id/responses/:response` | One response |
| `DELETE /api/forms/:id/responses/:response` | Delete one response |
| `POST /api/forms/:id/responses/import` | Import a list: `{ "rows": [{ "email", "name", "created_at", "source", "answers" }], "dry_run" }`. Answers with how many were imported, the duplicates skipped and the rows that aren't emails |
| `POST /api/forms/:id/test-email` | Send a sample response to every address on the form |

Use a session or an API key (`Authorization: Bearer pb_ak_...`). Making and changing forms, and importing into them, needs a dev key. Responses hold personal data, so reading them needs a support or dev key, as conversations do.
