> ## 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.

# API Request Blocks

> Configure HTTP requests — method, URL, headers, body, and auth

# API Request Blocks

API request blocks make HTTP requests to your API endpoints. Each block can be configured with a method, URL, headers, body, and authentication.

## Adding a block

Click **API** in the toolbar to add a new request block. It automatically connects to the last block in your flow.

Click the block on the canvas to open the side panel where you configure everything.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/request-block-panel.png" alt="Request block with side panel" />

## Method & URL

Select the HTTP method and enter the URL:

* **GET** — fetch data
* **POST** — create data
* **PUT** — replace data
* **PATCH** — update data
* **DELETE** — remove data

URLs support environment variables: `{{baseUrl}}/users`

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/method-url-bar.png" alt="Method and URL bar" />

## Headers

Add request headers as key-value pairs. Click **+ Add Header** to add more.

Common headers are auto-detected:

* `Content-Type: application/json` is set automatically when you have a JSON body

Header values support variables: `Bearer {{token}}`

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/headers-tab.png" alt="Headers configuration" />

## Body

For POST, PUT, and PATCH requests, enter the request body. JSON is the default format.

```json theme={null}
{
  "email": "{{testEmail}}",
  "name": "John Doe",
  "role": "admin"
}
```

The body field supports variable autocomplete — type `{{` to see available data.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/body-autocomplete.png" alt="Body editor with autocomplete" />

## Authentication

The Auth tab supports three types:

| Type             | Fields              | Example                  |
| ---------------- | ------------------- | ------------------------ |
| **Bearer Token** | Token value         | `{{authToken}}`          |
| **API Key**      | Header name + value | `X-API-Key: {{apiKey}}`  |
| **Basic Auth**   | Username + password | Standard HTTP basic auth |

Auth values support variables — reference tokens from previous blocks.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/auth-tab.png" alt="Auth tab" />

## Block title

Give your block a descriptive name (optional). It shows on the canvas above the method and URL, making complex flows easier to read.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/block-title.png" alt="Block with title" />

<Tip>
  Good block names: "Create User", "Login", "Verify OTP", "Get Profile". These make the flow self-documenting.
</Tip>

## Running a single block

Click **Send** in the side panel to run just that block. The response appears in the Response tab immediately. This is useful for testing individual requests before running the full flow.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/response-tab.png" alt="Response tab" />
