# Variables

It’s hard to imagine a programming language without being able to use variables.

In HTTL, you can store the response of a query in a variable and use it in subsequent queries.

### Example

```
post /login {
  email: "email",
  password: "password",
}
as auth

Authorization: Bearer {auth.token}

post /users {
  name: "rob",
  job: "engineer",
}
```

**Note**  
HTTL stores the response body in a variable instead of the entire response object.  
This design choice keeps the language simple and easy to use.  
Future releases will include more advanced features for working with the response object.

### Usage

You can use variables in the following places:

- Headers:

```
Authorization: Bearer {auth.token}
```

- Query parameters:

```
get /users?token={auth.token}
# or
get /{auth.url}?token={auth.token}
```

- Request body:

```
post /users {
    name: "rob",
    token: auth.token, # you don't need to use curly braces here
    audit: "Token used {auth.token}" # string interpolation is supported
}
```

Last updated on April 2, 2025
