---
title: "autumnHandler"
description: "Server-side handler for managing Autumn API endpoints and customer authentication"
---
import LearnHooksTip from '/snippets/learn-hooks-tip.mdx';
The `autumnHandler` creates server-side endpoints that handle communication between your frontend React hooks and Autumn's API. It manages customer authentication and proxies requests securely using your secret key.
## Usage
```ts
// app/api/autumn/[...all]/route.ts
import { autumnHandler } from "autumn-js/next";
import { auth } from "@clerk/nextjs/server";
export const { GET, POST } = autumnHandler({
identify: async () => {
const { userId } = await auth();
return { customerId: userId };
},
});
```
## Parameters
Function that receives the incoming request and returns customer identification data.
The unique identifier for the customer.
Additional metadata about the customer (e.g., `name`, `email`).
Autumn API secret key. Defaults to `AUTUMN_SECRET_KEY` environment variable.
Override the Autumn API URL. Use when self-hosting.
Path prefix for routes. Defaults to `/api/autumn`.
If true, suppresses console warnings and logs.