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

# handle

> Answer the calls Nelkap makes to your endpoint.

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
nelkap.handle(request: Request, options?: { waitUntil?: (promise: Promise<unknown>) => void }): Promise<Response>
```

## Parameters

**request** `Request` *required*

The POST request Nelkap sent to your endpoint.

**options.waitUntil** `(promise: Promise\<unknown\>) =\> void`

Your host's `waitUntil`, for hosts that stop all work once the response is sent. It keeps the run going until it finishes or pauses.

## Returns

| Status | Body | When |
| - | - | - |
| 202 | `{}` | The run has started in the background. |
| 401 | `{ "error": "secretInvalid" }` | The request doesn't carry your project's secret, or no secret is set. |
| 404 | `{ "error": "workflowNotFound" }` | This client didn't register the workflow. |

## Example

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
import { nelkap } from './nelkap';

export const handleNelkap = async (request: Request): Promise<Response> => {
  return nelkap.handle(request);
};
```

Serve this function as a POST route at your endpoint. See [Serve your workflows](https://docs.nelkap.com/guides/serve.md).


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.