> ## Documentation Index
> Fetch the complete documentation index at: https://docs.testbrick.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Mapping

> Pass data between blocks using variables

# Data Mapping

Data mapping lets you reference data from previous blocks in your current block. When Block 1 returns a user ID, Block 2 can use it in its URL — automatically.

## How it works

1. **Run a block** — the response data becomes available as variables
2. **Type `{{`** in any field (URL, headers, body, auth) — the autocomplete dropdown appears
3. **Pick a value** — it inserts the variable reference
4. **When the flow runs** — the variable resolves to the actual value from the previous block's response

## Autocomplete

Type `{{` in any input field to open the variable picker:

* **Previous block responses** — body fields, status, headers
* **Environment variables** — baseUrl, apiKey, etc.
* **Email block values** — extracted OTP, email subject, from address

Each suggestion shows the actual value from the last run, so you know exactly what you're selecting.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/data-mapping-autocomplete.png" alt="Autocomplete dropdown" />

## Variable syntax

Variables use double curly braces: `{{source.path}}`

### From previous blocks

```
{{node_abc123.body.id}}          → response body field
{{node_abc123.body.user.email}}  → nested field
{{node_abc123.status}}           → response status code
{{node_abc123.headers.x-token}}  → response header
```

### From environment variables

```
{{baseUrl}}     → environment variable
{{apiKey}}      → environment variable
{{testEmail}}   → environment variable
```

### From email blocks

```
{{node_email1.value}}     → extracted value (OTP, link, etc.)
{{node_email1.subject}}   → email subject
{{node_email1.from}}      → sender address
```

## Example

**Block 1: Create User**

```
POST {{baseUrl}}/users
Body: {"email": "test@example.com", "name": "John"}
Response: {"id": "usr_123", "email": "test@example.com"}
```

**Block 2: Get User** (references Block 1's response)

```
GET {{baseUrl}}/users/{{node_block1.body.id}}
→ resolves to: GET https://api.example.com/users/usr_123
```

<Info>
  You don't need to memorize node IDs. The autocomplete dropdown handles this — just type `{{` and pick the value you need.
</Info>

## Where variables work

Variables are supported in:

* URL field
* Header values
* Request body
* Auth token / API key values
