> ## Documentation Index
> Fetch the complete documentation index at: https://requestly-mintlify-changelog-requestly-past-week-38456.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Using Variables in API Requests

Once you've defined variables in Requestly—whether global, environment, collection, or subcollection — you can reference them directly in your API requests. This allows you to dynamically inject values into URLs, headers, request bodies, scripts, and more.

## **Use Variables in API Requests**

### **Step 1: Create or Open a Request**

Create or open an existing request in the **API Client**.

<img src="https://mintcdn.com/requestly-mintlify-changelog-requestly-past-week-38456/nQKn76nGsBkay95C/images/using-variables-in-api-requests/51b2389d-2186-42d7-99b8-a1fb295df6bb.png?fit=max&auto=format&n=nQKn76nGsBkay95C&q=85&s=d2a3d40abce58bd03017cfdfc070b2cf" align="center" fullwidth="false" width="2048" height="1065" data-path="images/using-variables-in-api-requests/51b2389d-2186-42d7-99b8-a1fb295df6bb.png" />

### **Step 2: Replace Static Values**

Replace static values with your environment variables using the `{{variable_name}}` syntax.

<img src="https://mintcdn.com/requestly-mintlify-changelog-requestly-past-week-38456/nQKn76nGsBkay95C/images/using-variables-in-api-requests/f597030e-3b81-4656-8267-182280d2ee76.png?fit=max&auto=format&n=nQKn76nGsBkay95C&q=85&s=3c9b56d1f29829beecc46d6651baa245" align="center" fullwidth="false" width="2048" height="1065" data-path="images/using-variables-in-api-requests/f597030e-3b81-4656-8267-182280d2ee76.png" />

### **Step 3: View Variable Values**

Hover over a variable to see its resolved value.

<img src="https://mintcdn.com/requestly-mintlify-changelog-requestly-past-week-38456/nQKn76nGsBkay95C/images/using-variables-in-api-requests/0f1df5b5-d0e1-4cd5-b270-3f6ac6e40507.png?fit=max&auto=format&n=nQKn76nGsBkay95C&q=85&s=a5d660dc1a3d87b462da4f31a4d67628" align="center" fullwidth="false" width="2048" height="1065" data-path="images/using-variables-in-api-requests/0f1df5b5-d0e1-4cd5-b270-3f6ac6e40507.png" />

## **Test Your Setup**

### **Step 1: Execute the Request**

Click **Send** to execute the request.

### **Step 2: Verify Resolved Values**

Check the resolved values in the **Request Preview** to ensure that variables are substituted correctly.

<img src="https://mintcdn.com/requestly-mintlify-changelog-requestly-past-week-38456/nQKn76nGsBkay95C/images/using-variables-in-api-requests/9c19eb9d-51f8-4a32-b8db-77fcd3d27a2a.png?fit=max&auto=format&n=nQKn76nGsBkay95C&q=85&s=ae402abd8b66fa452660d8837b32ba19" align="center" fullwidth="false" width="2048" height="1065" data-path="images/using-variables-in-api-requests/9c19eb9d-51f8-4a32-b8db-77fcd3d27a2a.png" />

<Tip>
  If a variable isn't resolving, verify that the variable name matches exactly (case-sensitive) and is present in the selected environment.
</Tip>
