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

# Vercel Functions

> Learn how to ingest your first submission using Vercel Functions

### Prerequisites

To get the most out of this guide, you'll need to:

* [Create a Formizee account](https://dashboard.formizee.com)
* [Have a form created](/guides/create-your-first-form)

Make sure you have the latest version of the [Vercel CLI](https://vercel.com/docs/cli#installing-vercel-cli) installed.

## 1. Create a Next.js function

Create a route file under `app/api/ingest/route.ts` if you're using the [App Router](https://nextjs.org/docs/app/building-your-application/routing/route-handlers).

Then update the **Endpoint URL** with your Form URL.

```ts route.ts {1} theme={"system"}
const ENDPOINT_URL = "https://api.formizee.com/v1/f/enp_123456";

export async function POST() {
	const res = await fetch(ENDPOINT_URL, {
		method: "POST",
		headers: {
			"Content-Type": "application/json",
		},
		body: JSON.stringify({
			name: "example",
			email: "example@mail.com",
		}),
	});
	const data = await res.json();
	return new Response(JSON.stringify(data), {
		headers: {
			"Content-Type": "application/json",
		},
	});
}
```

## 2. Ingest submissions locally

<CodeGroup>
  ```bash pnpm theme={"system"}
  pnpm run dev
  ```

  ```bash npm theme={"system"}
  npm run dev
  ```

  ```bash bun theme={"system"}
  bun run dev
  ```

  ```bash yarn theme={"system"}
  yarn run dev
  ```
</CodeGroup>

Open the endpoint URL to ingest a submission: `http://localhost:3000/api/ingest`.

## 3. Ingest submissions in production

Deploy function to vercel

```bash theme={"system"}
vercel
```

## 4. Try it yourself

<Card title="Formizee Vercel Functions Example" icon="link" href="https://github.com/formizee/formizee-vercel-functions-example">
  See the full source code
</Card>
