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

# step.wait

> Pause the run until an event arrives with its key.

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
nelkap.step.wait<T = unknown>(wakeOn: string): Promise<T>
```

## Parameters

**wakeOn** `string` *required*

The key to wait on, up to 256 characters. The wait takes it as its name, cut to 128 characters.

## Returns

The payload of the event that woke the run, or `null` if it had none.

## Behavior

* The run waits, and the call ends. An event [emitted](https://docs.nelkap.com/reference/emit.md) with the same `wakeOn` wakes it, and Nelkap calls your app again.
* A run can wait up to a year. After that, it fails.

## Errors

| Error | When |
| - | - |
| `NelkapError` `badRequest` | The key breaks a rule above. |
| `Error` | It was called outside a run. |

## Example

```ts theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
const review = await nelkap.step.wait<{ approved: boolean }>(`refund_${orderId}`);
```


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