# Editing with Snapshots

## Prerequisites

1. [Snapshot requests](/guides/how-to-mock-apis/how-to-snapshot-requests.md)
2. (Optional) Use a version tool such as Git to backup changes

## Updating Requests by Editing Snapshots

{% stepper %}
{% step %}
**Find request snapshots that match a pattern**

Run the following CLI command:

```bash
stoobly-agent snapshot list --search <PATTERN> --select snapshot --select uuid
```

For example:

```bash
$ stoobly-agent snapshot list --search /api --select snapshot --select uuid
snapshot                                                             uuid
.stoobly/snapshots/requests/19/19cfd765-80bc-4a2c-ad36-c59e7dbb9c92  cd99c578-3a97-11f0-98ef-51122b0b22b6
```

{% endstep %}

{% step %}
**Edit request snapshots**

For each file found, make the desired change to the request snapshot.

In the example from step 1, the request snapshot is stored in `.stoobly/snapshots/requests/19/19cfd765-80bc-4a2c-ad36-c59e7dbb9c92` .
{% endstep %}

{% step %}
**Create new snapshots for each updated request**

Run the following CLI command:

```bash
stoobly-agent snapshot update <SNAPSHOT-UUID>
```

In the example from step 1, the snapshot uuid is `cd99c578-3a97-11f0-98ef-51122b0b22b6`.
{% endstep %}

{% step %}
**Apply the snapshots**

Run the following CLI command:

```
stoobly-agent snapshot apply
```

{% endstep %}
{% endstepper %}


---

# 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/editing-with-snapshots.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.
