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

# Workflows

> Name your workflows, and tell Nelkap what starts them and how many go at once.

## Its payload

Your workflow gets the run's payload as its argument: any JSON value, like a string or an object.

What your workflow returns isn't kept. Keep what matters in its [steps](https://docs.nelkap.com/concepts/steps.md).

## Register your workflows

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
nelkap.registerWorkflows([
  { name: 'onboardUser', handler: onboardUser, events: ['user.created'] },
  { name: 'sendWeeklyReport', handler: sendWeeklyReport, cron: '0 9 * * 1' },
  { name: 'importContacts', handler: importContacts, concurrency: 5 },
]);
```

* `name` is how Nelkap knows the workflow. It must be unique within the project.
* `events` and `cron` start runs on their own. See [Start runs](https://docs.nelkap.com/guides/start-runs.md).
* `concurrency` sets how many runs go at once. See [below](#concurrency).

## Your list is the project's list

When your app starts, the SDK sends this list to Nelkap, and it becomes your project's workflows:

* A new workflow is added.
* A workflow already there takes its new events, cron, and concurrency.
* A workflow left out is turned off. Its runs still waiting to start, sleeping, or waiting are canceled.

So register every workflow of the project, in one call. A new name is a new workflow: renaming one turns the old name off.

## Concurrency

`concurrency` sets how many runs of the workflow go at once. The rest wait their turn, in the order they came. A sleeping or waiting run doesn't take a turn.

Your plan also sets how many runs your workspace has going at once. See [Limits](https://docs.nelkap.com/limits.md).


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