# Public forms (/docs/guides/public-forms)



A public form turns one published version of a decision into a web page. Whoever has the link
fills in the version's input fields and sends them; the platform runs that exact version and
records the run as an ordinary [execution](/docs/integrate/executing). Use it to let testers try
a version, or to collect answers from customers or applicants.

## Publish a form [#publish-a-form]

A form belongs to a **concrete version**, never to "latest": the link keeps running the version
it was published from. Open the version on the decision's page and choose **Publish form**
(**Configure form** once it exists). The dialog shows the form's link, `/forms/<token>`, with
buttons to copy it and to open it. The token is generated once and stays the same while you change
settings. **Unpublish form** closes the link.

Submissions are checked against the version's input schema before they count: a mistyped field is
returned to the visitor to fix and does not use a slot.

## What the visitor sees [#what-the-visitor-sees]

| Setting        | What it does                                                                                           |
| -------------- | ------------------------------------------------------------------------------------------------------ |
| Show result    | After sending, shows the decision and its outputs. On by default.                                      |
| Execution path | Shows each step with its status and duration. Conditions, intermediate values and errors stay private. |
| Show flow      | Adds a **View flow** button: the decision drawn with the path taken lit up. Names and branches only.   |

Everything shown is an allowlist. Node and edge ids are replaced by aliases local to the response,
and if you change the settings while a submission is still running, the visitor sees what the
settings say when it finishes.

## What a submission does [#what-a-submission-does]

* **Create cases**: a submission that raises an alert or a review opens a case in the inbox. Off by
  default.
* **Run actions**: delivers the run's actions (webhooks, emails, connector calls) through the
  outbox, as an API call would. Off by default, so a test link never reaches real systems.
* **Environment**: the environment whose credentials the submissions use and under which they are
  recorded. Choosing a protected environment needs the permission to deploy there, because anonymous
  traffic would otherwise use its credentials.

A submission spends the project's execution limits like any other run.

## Availability [#availability]

* **Password**: at least 8 characters. The visitor enters it to open the form and receives an
  authorization valid for one hour. Changing or removing the password, or unpublishing, invalidates
  authorizations already issued.
* **Closes on**: after this moment the link stops accepting responses.
* **Submission limit**: up to 1,000,000. The form closes by itself once it has received that many;
  the dialog shows the count so far.

A form past its date or out of submissions answers as closed, just like an unpublished one.

## For end users [#for-end-users]

Set the audience to **For end users** when the form goes to customers rather than testers. The
version number and test wording are hidden and a confirmation replaces the form after sending.
You can then set:

* **Title** and **Introduction**, **Button label** and **Confirmation message**; leave any empty
  for the default.
* **Redirect after sending**: an `https` address. The visitor is sent there with `?execution_id=`
  appended.
* **Prefill from the link**: fields named in the query start with those values, for example
  `?amount=500`, and nested ones by their path, `?user.email=ana@example.com`.

## Abuse protection [#abuse-protection]

Requests are rate-limited. The defaults can be changed in the API's environment:

| Variable                                | Default | Limit                                      |
| --------------------------------------- | ------- | ------------------------------------------ |
| `PUBLIC_FORM_READS_PER_MINUTE`          | `60`    | Opening a form, per client IP.             |
| `PUBLIC_FORM_UNLOCKS_PER_MINUTE`        | `5`     | Password attempts, per form and IP.        |
| `PUBLIC_FORM_SUBMISSIONS_PER_IP_MINUTE` | `10`    | Submissions, per form and IP.              |
| `PUBLIC_FORM_SUBMISSIONS_PER_MINUTE`    | `100`   | Submissions, per form across all visitors. |

A submission larger than `EXECUTION_PAYLOAD_LIMIT_BYTES` is refused.

## Where submissions go [#where-submissions-go]

Every submission is an execution with source `PUBLIC_FORM`, so it appears in the decision's
executions with its input and trace; **View submissions** in the dialog takes you there.

## API [#api]

Managing a form: `GET` and `PUT /api/v1/decisions/:key/versions/:version/public-form`. The
visitor side needs no authentication: `GET /api/v1/public/forms/:token`, `POST …/:token/unlock`
and `POST …/:token/submissions`. See the API reference for the schemas.
