# Assign

{% hint style="info" %}
**Use Case**

* Set initial values for aliases in a request
* Allows customization of a request beyond its initial recorded state
  {% endhint %}

Think of aliases as template variables within a request which are resolved before a request is replayed. For example, let's say we use the following option:

```
--assign ":userId=1"
```

and we are about to replay:

```
GET /users/1
```

and we have defined the endpoint as such (where :userId is an [alias](/experimental/experimental-features/aliases.md)):

```
GET /users/:userId
```

Then the replayed request will actually be:

```
GET /users/1
```

This concept works for query params, headers and body params (for requests that have a parseable body).

## CLI Examples

```shell
stoobly-agent scenario run --assign ":userId=1" "<SCENARIO-KEY>"
```

```shell
stoobly-agent scenario test --assign ":userId=1" "<SCENARIO-KEY>"
```

```shell
stoobly-agent request run --assign ":accessToken=secretToken" "<REQUEST-KEY>"
```

```shell
stoobly-agent request test --assign ":accessToken=secretToken" --assign ":userId=1" "<REQUEST-KEY>"
```

## Configuring Resolve Strategy

Now let's say we assign two values to the alias :userId, for example:

```shell
stoobly-agent scenario run --assign ":userId=1" --assign ":userId=2" "<SCENARIO-KEY>"
```

In this case, how do we determine which value gets resolved first?


---

# 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/experimental/experimental-features/api-testing/configuration/assign.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.
