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

# Assertions

> Validate API responses — status codes, body content, headers, timing

# Assertions

Assertions validate that your API returns the correct response. Add them to any API request block to automatically verify the results.

## Adding assertions

1. Click a block to open the side panel
2. Go to the **Assert** tab
3. Click **+ Add Assertion**
4. Select the assertion type and enter the expected value

## Assertion types

### Free

| Type                   | Description                     | Example             |
| ---------------------- | ------------------------------- | ------------------- |
| **Status code equals** | Check the HTTP status code      | `200`, `201`, `404` |
| **Body not empty**     | Verify the response has content | —                   |

### Pro

| Type                        | Description                     | Example                                          |
| --------------------------- | ------------------------------- | ------------------------------------------------ |
| **Status code not equals**  | Status is NOT a specific code   | `500`                                            |
| **Body contains**           | Response body includes a string | `"success"`                                      |
| **Body field equals**       | Specific JSON field has a value | Field: `user.email`, Value: `test@test.com`      |
| **Response time less than** | Response arrived within X ms    | `2000`                                           |
| **Header exists**           | A specific header is present    | `content-type`                                   |
| **Header equals**           | Header has a specific value     | Field: `content-type`, Value: `application/json` |

## Results

After running, each assertion shows:

* **Pass** — green checkmark with the actual value
* **Fail** — red X with expected vs actual values

Failed assertions turn the block red on the canvas, making it easy to spot issues.

<img src="https://mintlify.s3.us-west-1.amazonaws.com/testbrick/images/assertion-results.png" alt="Assertion results" />

## Block indicator

Blocks with assertions show a shield icon on the canvas with the assertion count, so you can see at a glance which blocks have validation.

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

<Tip>
  Start with a simple "Status code equals 200" assertion on every block. This catches obvious failures immediately.
</Tip>
