> ## 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.

# Your Form Endpoint

> Where to find your endpoint and how to submit to it.

Every Formbase form is identified by a unique ID. Your submit endpoint is always the base URL of your Formbase instance plus `/s/<form-id>`.

For the hosted service:

```
https://formbase.dev/s/YOUR_FORM_ID
```

For self-hosting:

```
https://your-domain.com/s/YOUR_FORM_ID
```

## What the endpoint accepts

Formbase accepts the formats that browsers and APIs commonly send:

* `multipart/form-data` (for file uploads)
* `application/x-www-form-urlencoded` (standard HTML forms)
* `application/json` (server submissions and API-style posts)

<Callout type="note">
  The same `/s/<form-id>` path is used for both POST submissions and the built-in success page. Browser posts return a `303` redirect to that page.
</Callout>

## Example submissions

<Tabs>
  <Tab title="HTML">
    ```html index.html theme={null}
    <form action="https://formbase.dev/s/YOUR_FORM_ID" method="POST">
      <input name="name" placeholder="Name" required />
      <input name="email" type="email" placeholder="Email" required />
      <button type="submit">Send</button>
    </form>
    ```

    Use `enctype="multipart/form-data"` when uploading files.
  </Tab>

  <Tab title="Server JSON">
    ```ts theme={null}
    const response = await fetch('https://formbase.dev/s/YOUR_FORM_ID', {
      method: 'POST',
      headers: { 'Content-Type': 'application/json' },
      body: JSON.stringify({ plan: 'pro', userId: '123' }),
    });

    const result = await response.json();
    console.log(result.data);
    ```

    This is the best approach when you need a JSON response.
  </Tab>
</Tabs>

## CORS and preflight

Formbase responds to `OPTIONS` preflight requests on `/s/<form-id>` and allows cross-origin POSTs by default. This makes it easy to post from any frontend.
