> For the complete documentation index, see [llms.txt](https://docs.avoautomation.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avoautomation.com/avo-assure/actions/apis/assertion/header-value.md).

# Header value

This is a pre-built action available under **@Assertion** element type. This action checks whether the value of a specified header in the API response matches the expected value or regular expression pattern. The output variable stores the validation result as **True** or **False**.

## Syntax

**Input Value:** `<Header name>;<Header value>;<Match type>`

{% hint style="info" %}
**Note:** The match type must be either **Equals** or **Regex**.
{% endhint %}

| Argument                                  | Description                                                                                                                                                                                                                                                                                     |
| ----------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <p>\<Header name> </p><p>(Required) </p>  | Enter the exact name of the response header whose value you want to check.                                                                                                                                                                                                                      |
| <p>\<Header value> </p><p>(Required) </p> | Enter the expected header value or the regular expression pattern to use for checking the header value.                                                                                                                                                                                         |
| <p>\<Match type> </p><p>(Required) </p>   | <p>Specify how the header value should be checked.  </p><ul><li><strong>Equals</strong> checks whether the actual header value exactly matches the expected value. </li><li><strong>Regex</strong> checks whether the header value matches the specified regular expression pattern. </li></ul> |

**Output Value**: `<Actual header value (optional)>;<Keyword status (optional)>`

| Argument                                     | Description                                                                                       |
| -------------------------------------------- | ------------------------------------------------------------------------------------------------- |
| <p>\<Actual header value> <br>(Optional)</p> | The output variable stores the actual value of the specified header returned in the API response. |
| <p>\<Keyword status> <br>(Optional)</p>      | The output variable stores the result of the check as **True** or **False**.                      |

### **Example 1: Checking a Header Value**

In this example, we explain how to verify that the value of the **Content-Type** header matches the expected value.

* **Action**: Header value
* **Input Value**: Content-Type;application/json;Equals
  * The first value **Content-Type** specifies the name of the response header to check.
  * The second value **application/json** specifies the expected value of the response header.
  * The third value **Equals** specifies that the actual header value must exactly match the expected value.

```
API Response Headers:
Content-Type: application/json 
Content-Length: 245 
Cache-Control: no-cache 
StatusCode: 200
```

* **Output Value**: {Actual Value};{Status}
  * The first output variable **{Actual Value}** stores the actual value as **application/json**.
  * The second output variable **{Status}** stores the execution result:
    * **True**: The actual header value matches the expected value.
    * **False**: The actual header value does not match the expected value.&#x20;
* **Logical Explanation**: The **Header value** action takes the header name **Content-Type**, expected value **application/json**, and match type **Equals** from the **Input Value** column. The action gets the actual value of the **Content-Type** header from the API response and compares it with the expected value. Since the actual value is **application/json**, the **{Actual Value}** variable stores **application/json** and the **{Status}** variable stores the result as **True**.&#x20;

<img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FRuWIihVaop8wzcgOYYJc%2Fimage?alt=media&amp;token=8c5bf0eb-faf9-4bb9-bd29-8517ba998574" alt="image" height="192" width="939">

### **Example 2: Checking a Header Value Using Regex**

In this example, we explain how to verify that the **Server** header value follows the expected format when the server version may change.

* **Action**: Header value
* **Input Value**: Server;nginx\\/\[0-9]+\\.\[0-9]+\\.\[0-9]+;Regex
  * The first value **Server** specifies the name of the response header to check.
  * The second value **nginx/\[0-9]+.\[0-9]+.\[0-9]+** specifies the regular expression pattern that the header value must match. The pattern checks that the value starts with **nginx/** followed by a version number such as **1.20.1**.
  * The third value **Regex** specifies that the actual header value should be checked against the regular expression pattern.

```
API Response Headers:
Server: nginx/1.20.1 
Date: Wed, 09 Sep 2026 05:43:54 GMT 
Content-Type: application/json
```

* **Output Value**: {Actual Value};{Status}
  * The **{Actual Value}** variable stores the actual value returned for the **Server** header. In this example, it stores **nginx/1.20.1**.
  * The **{Status}** variable stores the result of the validation.
    * **True**: The actual header value matches the specified regular expression pattern.
    * **False**: The actual header value does not match the specified regular expression pattern.
* **Logical Explanation**: The **Header value** action takes the header name **Server**, regular expression pattern **nginx/\[0-9]+.\[0-9]+.\[0-9]+**, and match type **Regex** from the **Input Value** column. The Action gets the actual value of the **Server** header and checks it against the specified pattern. Since **nginx/1.20.1** matches the pattern, the **{Actual Value}** variable stores **nginx/1.20.1** and the **{Status}** variable stores the result as **True**.

<img src="https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FbY3ApX65BdnFEZK2fQ78%2Fimage?alt=media&amp;token=af80b509-a843-4f9f-b4b5-8e174e3b6b8c" alt="image" height="192" width="939">


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avoautomation.com/avo-assure/actions/apis/assertion/header-value.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
