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

# registerRequestListener

> Start listening for requests that match a URL pattern.

Begins capturing the first request that matches. Pair with `awaitListener` to
read the captured request/response in a later step.

## Parameters

| Parameter   | Type      | Required | Description                                                           |
| ----------- | --------- | -------- | --------------------------------------------------------------------- |
| `substring` | `string`  | No       | Match URLs that contain this substring.                               |
| `glob`      | `string`  | No       | Match URLs against a glob pattern.                                    |
| `regex`     | `string`  | No       | Match URLs against a regular expression.                              |
| `domain`    | `string`  | No       | Match all URLs under the given domain.                                |
| `key`       | `string`  | Yes      | Identifier used by `awaitListener` to pick up the captured request.   |
| `method`    | `string`  | No       | Restrict the listener to a specific HTTP method.                      |
| `saveAs`    | `string`  | No       | Name of the variable to write this step's return value to.            |
| `retries`   | `number`  | No       | Number of times to retry the step on failure before failing the test. |
| `skipped`   | `boolean` | No       | Skip this step at execution time.                                     |

## Examples

```yaml theme={null}
- registerRequestListener:
    key: response
    regex: .+jsonplaceholder.+
```

```yaml theme={null}
- registerRequestListener:
    key: create_test
    substring: /api/tests
    method: post
```

## Related

* [Network requests](/guides/page-interactions/network-requests)
* [Test format](/core-concepts/test-format)
