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

# Your first API flow

> Build and run a visual API flow in minutes

# Your first API flow

API flows let you chain multiple API requests together on a visual canvas. Data flows between requests automatically.

## Steps

<Steps>
  <Step title="Create an API flow">
    In your project folder, click **+** and select **API Flow**. Give it a name like "User API Test".
  </Step>

  <Step title="Add your first block">
    Click **API** in the toolbar to add a request block. Click the block to open the side panel.

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

  <Step title="Configure the request">
    In the side panel, set:

    * **Method**: `GET`
    * **URL**: `https://jsonplaceholder.typicode.com/users/1`

    Click **Send** to test the request. The response appears in the Response tab.

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

  <Step title="Add a second block">
    Click **API** again to add another block. It auto-connects to the first one.

    Set:

    * **Method**: `POST`
    * **URL**: `https://jsonplaceholder.typicode.com/posts`
    * **Body**:

    ```json theme={null}
    {
      "title": "Test Post",
      "body": "Hello from TestBrick",
      "userId": 1
    }
    ```

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/canvas-two-blocks.png" alt="Two connected blocks" />
  </Step>

  <Step title="Run the flow">
    Click **Run All** in the toolbar. Watch each block execute sequentially — blocks pulse purple while running, then turn green (pass) or red (fail).

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/canvas-running.png" alt="Flow running with purple animation" />
  </Step>

  <Step title="Share the results">
    After the run completes, click **Share** to copy a shareable link. Anyone with the link can see every request, response, and assertion result.

    <img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/share-page.png" alt="Shared results page" />
  </Step>
</Steps>

## Using data from previous blocks

When one block's response contains data you need in the next block, type `{{` in any field to see available variables:

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

* **URL**: `https://api.example.com/users/{{node_abc.body.id}}`
* **Headers**: `Bearer {{node_abc.body.token}}`
* **Body**: `{"userId": "{{node_abc.body.id}}"}`

The autocomplete dropdown shows all available data from previous blocks and environment variables.

<Tip>
  You don't need to memorize variable names. Just type `{{` and pick from the dropdown — it shows the actual values from the last run.
</Tip>

## What's next

<CardGroup cols={2}>
  <Card title="Environment variables" icon="sliders" href="/api-flows/environments">
    Use variables like `{{baseUrl}}` to switch between dev, staging, and production
  </Card>

  <Card title="Assertions" icon="check-double" href="/api-flows/assertions">
    Validate response status codes, body content, headers, and timing
  </Card>
</CardGroup>
