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

# Error Page Redirects

> Send users to a custom error page when submissions fail.

When a submission fails, you may want to show a dedicated error page instead of inline messaging. Formbase responds with standard HTTP status codes, so you can redirect based on the response.

<Steps>
  <Step title="Submit the form">
    Use fetch and inspect the response status.
  </Step>

  <Step title="Redirect on failure">
    ```js theme={null}
    const response = await fetch('https://formbase.dev/s/YOUR_FORM_ID', {
      method: 'POST',
      body: new FormData(formElement),
      redirect: 'manual',
    });

    if (response.status === 303 || response.ok) {
      window.location.href = '/thanks';
      return;
    }

    window.location.href = `/error?reason=submit_failed&status=${response.status}`;
    ```

    Include the status code or a reason string to help with debugging.
  </Step>
</Steps>

<Callout type="note">
  A `404` response usually means the form ID is invalid. A `500` response often indicates a server or storage configuration issue.
</Callout>
