> For the complete documentation index, see [llms.txt](https://docs.stoobly.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.stoobly.com/core-concepts/mock-api/scenarios.md).

# Scenarios

A Stoobly cenario is a sequence of requests that describes a workflow

{% 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="https://3980092275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MLvhXOE-py5MDUOXDKD%2Fuploads%2Fgit-blob-eeebc3a897fba0d888f9654b5c29192a46df65eb%2Fscenarios-index-create.PNG?alt=media" 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="https://3980092275-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MLvhXOE-py5MDUOXDKD%2Fuploads%2Fgit-blob-b1658076a5a4547b50e0778f2128a50efe9a8ca5%2FScreenshot%202023-05-03%20021848%20-%20scenario%20key.png?alt=media" 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=`.
