# await_input

The `await_input` step.

Pauses the job as `awaiting_input` until a value such as a one-time code is supplied, then stores it in `vars.<name>`. The string form names the input.

Type: `string or object`

## Keys

| Key | Type | Description |
|---|---|---|
| `await_input.collect` | `"api" \| "hosted"` | How the value is collected: `api` (the default), through the resume endpoint, or `hosted`, on a page Kaabist hosts. |
| `await_input.expires` | `string` | How long the job waits for the value, as a duration such as `24h`. Defaults to `24h`, at most `7d`. |
| `await_input.hosted` | `object` | Settings for `collect: "hosted"`; lint warns `W007` when a hosted input has no `notify`. |
| `await_input.hosted.notify` | `"email" \| "none"` | Who is told the hosted page is waiting: `email` or `none`. |
| `await_input.hosted.to` | `string` | The address the notification goes to, a template. |
| `await_input.name` | `string` | The variable the value lands in, as `vars.<name>`. Must match `^[a-zA-Z_][a-zA-Z0-9_]{0,63}$`. |
| `await_input.pattern` | `string` | A regular expression the supplied value must match. |
| `await_input.prompt` | `string` | The question shown to whoever supplies the value, a template. |
| `await_input.ttl` | `string` | How long the browser is held open while waiting, as a duration such as `5m`. Defaults to `5m`, at most `15m`; after that the job is checkpointed and the browser released. |
| `await_input.type` | `"string" \| "number" \| "secret"` | The value's type: `string` (the default), `number` or `secret`. |

Every step also takes the [common step keys](https://docs.kaab.ist/reference/dsl/steps#common-keys): `expect`, `id`, `if`, `name`, `on_error`, `optional`, `retry`, `side_effect`, `timeout_ms`, `x_kaab`.

## Example

```json
{
  "await_input": {
    "name": "code",
    "prompt": "Enter the code we e-mailed you",
    "type": "string",
    "pattern": "^[0-9]{6}$",
    "ttl": "5m",
    "expires": "24h",
    "collect": "hosted",
    "hosted": {
      "notify": "email",
      "to": "{{inputs.email}}"
    }
  }
}
```

From the contract fixture `hosted-await-input`, a program the test suite validates.
