# Scenarios

{% hint style="info" %}
**Use Cases:**

* Replaying or testing requests in a sequence
* Documenting common workflows
* Sharing those workflows with others
  {% endhint %}

## What is a Scenario?

Take for example in a new user registration flow for some hypothetical application, the following HTTP requests are sent:

1. `POST /user` to create the new user
2. `GET /user/{user_id}` to retrieve data about the user
3. `GET /products` to retrieve a store's list of products to present to the user

This sequence of requests is specific for that workflow, has a defined order and can tied together. This enables you to group requests together, share them with other engineers or even replay the whole sequence. This is what we define as a scenario.

## How To Create Scenarios

If using the UI, navigate to the Scenarios page and click on the **CREATE** button on the top left corner.

<figure><img src="/files/k2imLjoV24V1V7ThBVc9" alt=""><figcaption><p>Scenarios Create</p></figcaption></figure>

For our full guide, see [How to Create Scenarios ](#how-to-create-scenarios).

## Scenario Key

Every Scenario will have a unique identifier for your Stoobly context. This can be retrieved from the UI or the CLI.

### From the UI

Navigate to the scenarios page then click on a scenario. This will open the scenario details page from the right side. At the top there will be a **Key** field which is the scenario key.

<figure><img src="/files/wcv51BhrBYmSPOa4MLd9" alt=""><figcaption><p>Scenario Key in the details page</p></figcaption></figure>

### From the CLI

Run the following command to view your scenarios:

```
$ stoobly-agent scenario list

  id  name                  requests_count  description      is_deleted  key
   1  My First Scenario                  1                            0  eyJwIjogMCwgImkiOiAzfQo=
```

Here in our example we have a single scenario. The scenario Key can be found in the `key` column which is `eyJwIjogMCwgImkiOiAzfQo=`.


---

# 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/core-concepts/mock-api/scenarios.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.
