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

# run

> Start a run of a workflow.

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
nelkap.run<T extends WorkflowHandler>(
  workflow: T,
  payload?: Parameters<T>[0],
  options?: { tags?: string[] },
): Promise<{ runId: string }>
```

## Parameters

**workflow** `WorkflowHandler` *required*

A workflow function passed to [`registerWorkflows`](https://docs.nelkap.com/reference/register-workflows).

**payload** `Parameters\<T\>[0]`

Any JSON value. The workflow gets it as its argument.

**options.tags** `string[]`

Tags to find the run by. Up to 10, each up to 128 characters.

## Returns

**runId** `string`

The id of the new run.

## Errors

| Error | When |
| - | - |
| `Error` | The function wasn't passed to `registerWorkflows`. |
| `NelkapError` `workflowNotFound` | The project has no enabled workflow with this name. |
| `NelkapError` `badRequest` | The payload or a tag breaks a rule above. |

Any call can also get the errors listed in [Errors](https://docs.nelkap.com/reference/errors.md#api-errors).

## Example

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
const { runId } = await nelkap.run(onboardUser, 'user_42', { tags: ['beta'] });
```


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