# How to Update Requests

## Prerequisites

1. [Run the agent](/guides/how-to-run-the-agent.md)
2. [Configure the proxy](/guides/proxy-configuration.md)
3. [Record request(s)](/guides/how-to-record-requests.md)

## Why Update Requests?

At some point in time, API providers will change the contract of a request. For example, maybe a component in the request or its response needs to be updated. When this happens we should also update the Stoobly request.

## Updating Requests

{% hint style="warning" %}
Before updating a request, it is recommended to create a [snapshot](/core-concepts/mock-api/snapshots.md) in case changes need to be reverted.
{% endhint %}

There are three main strategies to update request(s):

### Editing

* [Edit individual requests from the UI](/guides/how-to-update-requests/editing-from-the-ui.md)
* [Edit request snapshots](/guides/how-to-update-requests/editing-with-snapshots.md)

### Replaying

* [Replay individual requests](/guides/how-to-replay-requests.md)
* [Replay scenarios](/guides/how-to-update-requests/how-to-update-scenarios/updating-with-replay.md)

### Overwriting

* [Overwriting scenarios](/guides/how-to-update-requests/how-to-update-scenarios/updating-with-overwrite.md)

## Persisting Changes

{% content-ref url="/pages/Tyk5SmKa5es0I3YjLQA0" %}
[How to Snapshot Requests](/guides/how-to-mock-apis/how-to-snapshot-requests.md)
{% endcontent-ref %}

## Reverting Changes

In case you update a request with unintended consequences, you can reset it to the last snapshot state. For more information see our documentation on the snapshots feature:

{% content-ref url="/pages/WFKkQFPE0l9Zauwmdgd6" %}
[Snapshots](/core-concepts/mock-api/snapshots.md)
{% endcontent-ref %}

### Command

```bash
stoobly-agent request reset "<REQUEST-KEY>"
```

### Options

```bash
$ stoobly-agent request reset --help

Usage: stoobly-agent request reset [OPTIONS] REQUEST_KEY

  Reset a request to its snapshot state

Options:
  --force     Toggles whether resources are hard deleted.
  -h, --help  Show this message and exit.
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.stoobly.com/guides/how-to-update-requests.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
