> ## Documentation Index
> Fetch the complete documentation index at: https://formpaste.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Redirects

> Send visitors to a thank-you page after a no-JS form submit, using the redirect field.

<Info>**Free** - included on every plan.</Info>

For plain HTML forms without JavaScript, `/submit` supports redirecting the
visitor's browser to a URL of your choice after a successful submission —
typically a "thanks for reaching out" page.

## Using it

Add a `redirect` field to your form alongside `access_key`:

```html theme={null}
<form action="https://api.formpaste.com/submit" method="POST">
  <input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
  <input type="hidden" name="redirect" value="https://example.com/thank-you">
  <input type="email" name="email" placeholder="Your email" required>
  <textarea name="message" placeholder="Your message" required></textarea>
  <button type="submit">Send</button>
</form>
```

On success, instead of returning the usual `200` JSON body, `/submit`
responds with `303 See Other` and a `Location` header pointing at the
`redirect` URL, so the browser navigates there.

## The domain restriction

The `redirect` URL must be on one of the form's [allowed domains](/docs/features/custom-domains).
This stops `access_key` (which lives in public page source) from being used
to turn your form into an open redirector to an arbitrary URL. A `redirect`
outside the allowlist is rejected:

| Code               | HTTP | Meaning                                        |
| ------------------ | ---- | ---------------------------------------------- |
| `invalid_redirect` | 400  | The redirect URL is not allowed for this form. |

## AJAX / JS forms don't need this

If you're submitting with `fetch` (see the React, Next.js, Vue, and Svelte
snippets in [Framework snippets](/docs/framework-snippets)), skip the `redirect`
field entirely. `/submit` returns its normal JSON response —

```json theme={null}
{ "success": true, "message": "Submission received.", "id": "sub_..." }
```

— and you handle the "thanks" state in your own UI instead of a full page
navigation.
