> 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-exists.md).

# Header exists

This is a pre-built action available under **@Assertion** element type. This Action checks whether a specific header name is available in the API response. The output variable stores the validation result as **True** or **False**.

## Syntax

**Input Value**: `<HeaderKey1>,<HeaderKey2(Optional)>,....,<HeaderKeyn(Optional)>`&#x20;

| Argument                                                           | Description                                                                                                                                                                                |
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| \<HeaderKey1>,\<HeaderKey2(Optional)>,....,\<HeaderKeyn(Optional)> | <p>Enter the exact name of the response header that you want to check. </p><p><br><strong>Note</strong>: You can also provide multiple response headers by separating with comma (,). </p> |

**Output Value**: `<Keyword Status(optional)>`

| Argument                     | Description                                                                         |
| ---------------------------- | ----------------------------------------------------------------------------------- |
| \<Keyword Status> (Optional) | The action status variable stores the result of the check as **True** or **False**. |

### **Example: Checking Whether a Header Exists**

In this example, we explain how to verify that the Content-Type header is present in the API response.

* **Action**: Header exists
* **Input Value**: Content-Type
  * The input value **Content-Type** specifies the name of the response header to check.

API Response Headers:

Content-Type: application/json \
Content-Length: 245 \
Cache-Control: no-cache \
StatusCode: 200

* **Output Value**: {Status}
  * The output variable **{Status}** stores the result with the following possible values:
    * **True**: The specified header is available in the API response.
    * **False**: The specified header is not present in the API response.
* **Logical Explanation**: The **Header exists** action takes the header name **Content-Type** from the **Input Value** column and checks whether the header is present in the API response. The action does not check the header value. Since the **Content-Type** header is available, the **{Status}** variable stores **True**.

![](https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2FXKzlOIw03zySCsD1ONAD%2Funknown.png?alt=media\&token=c5d81c7f-305b-409c-8b3e-cd43901755ec)

### **Example 2: Checking Multiple Headers**

In this example, we explain how to verify that multiple response headers are present in the API response.

* **Action**: Header exists
* **Input Value**: Content-Type,Authorization,Cache-Control
* The input values **Content-Type**, **Authorization**, and **Cache-Control** specify the names of the response headers to check. Each header name is separated by a comma.

API Response Headers

Content-Type: application/json \
Authorization: Bearer token123 \
Cache-Control: no-cache \
StatusCode: 200&#x20;

* **Output Value:** {Status}
  * The output variable **{Status}** stores the result with the following possible values:
    * **True**: All the specified headers are present in the API response.
    * **False**: One or more of the specified headers are not present in the API response.
* **Logical Explanation:** The **Header exists** action takes the multiple header names **Content-Type**, **Authorization**, and **Cache-Control** from the **Input Value** column and checks whether each header is present in the API response. The action does not check the values of the headers. Since all the specified headers are available in the API response, the **{Status}** variable stores **True**.

![](https://2174257472-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fk8QZzXZMIJSStKAzDSTu%2Fuploads%2F94OKrVZdv8Y0zlJ49JeY%2Funknown.png?alt=media\&token=35aab3c2-4c5d-42f5-abdf-be374359209f)


---

# 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
