reqsh 0.3.3

Interactive HTTP shell for API workflows
Documentation
---
title: Variables
description: Store and interpolate variables in requests using {{name}} syntax.
order: 5
---

# Variables

Variables let you store reusable values and interpolate them into requests using `{{name}}` syntax.

## Setting Variables

Use the `var set` command to store a value.

```sh
reqsh> var set token eyJhbGciOiJIUzI1NiJ9
reqsh> var set base_url https://api.example.com
reqsh> var set user_id 42
```

## Using Variables

Reference variables anywhere in your request using double curly braces.

```sh
reqsh> GET /users/{{user_id}}
.....> Authorization: Bearer {{token}}
.....> ###
```

Variables work in:

- **Paths**: `GET /users/{{user_id}}`
- **Headers**: `Authorization: Bearer {{token}}`
- **Bodies**: `{"id": "{{user_id}}"}`
- **Query params**: `page={{page}}`

## Listing Variables

View all stored variables in the current session.

```sh
reqsh> var list
token = eyJhbGciOiJIUzI1NiJ9
base_url = https://api.example.com
user_id = 42
```

## Removing Variables

Remove a variable when it's no longer needed.

```sh
reqsh> var remove token
```

## Example Workflow

```sh
reqsh> var set token eyJhbGciOiJIUzI1NiJ9
reqsh> var set api https://api.example.com
reqsh> GET {{api}}/users/{{token}}
.....> ###
HTTP/1.1 200 OK 142ms
content-type: application/json

{ ... }
```