---
title: Header
summary: >-
  Header objects are used to add, modify, or delete headers from requests and
  responses. The header content can be simple strings or be derived from
  variables inside Varnish. Regular expressions can be used to customize the
  headers even further.
url: https://www.fastly.com/documentation/reference/api/vcl-services/header
---

Header objects are used to add, modify, or delete headers from requests and responses. The header content can be simple strings or be derived from variables inside Varnish. Regular expressions can be used to customize the headers even further.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `action` | string | Accepts a string value. |
| `cache_condition` | string | Name of the cache condition controlling when this configuration applies. |
| `dst` | string | Header to set. |
| `ignore_if_set` | string | Don't add the header if it is added already. Only applies to 'set' action. Numerical value ("0" = false, "1" = true). |
| `name` | string | A handle to refer to this Header object. |
| `priority` | string | Priority determines execution order. Lower numbers execute first. |
| `regex` | string | Regular expression to use. Only applies to <code>regex</code> and <code>regex_repeat</code> actions. |
| `request_condition` | string | Condition which, if met, will select this configuration during a request. Optional. |
| `response_condition` | string | Optional name of a response condition to apply. |
| `src` | string | Variable to be used as a source for the header content. Does not apply to <code>delete</code> action. |
| `substitution` | string | Value to substitute in place of regular expression. Only applies to <code>regex</code> and <code>regex_repeat</code> actions. |
| `type` | string | Accepts a string value. |
| `created_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `deleted_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `service_id` | string | Alphanumeric string identifying the service. (Read-only) |
| `updated_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `version` | string | String identifying a service version. (Read-only) |

## API endpoints

### List Header objects

**GET** `/service/{service_id}/version/{version_id}/header`

Retrieves all Header objects for a particular Version of a Service.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Create a Header object

**POST** `/service/{service_id}/version/{version_id}/header`

Creates a new Header object.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Get a Header object

**GET** `/service/{service_id}/version/{version_id}/header/{header_name}`

Retrieves a Header object by name.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `header_name` | string | path | Yes | A handle to refer to this Header object. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Update a Header object

**PUT** `/service/{service_id}/version/{version_id}/header/{header_name}`

Modifies an existing Header object by name.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `header_name` | string | path | Yes | A handle to refer to this Header object. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Delete a Header object

**DELETE** `/service/{service_id}/version/{version_id}/header/{header_name}`

Deletes a Header object by name.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `header_name` | string | path | Yes | A handle to refer to this Header object. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |
