# HeaderVersioningOptions

**Kind:** Interface

**Source:** [`packages/common/interfaces/version-options.interface.ts`](https://github.com/nestjs/nest/blob/master/packages/common/interfaces/version-options.interface.ts#L37)

**Part of:** [Common](subsystem-packages-common)

`HeaderVersioningOptions` configures header-based API versioning. It identifies the HTTP header that contains the requested API version and fixes the versioning strategy to `VersioningType.HEADER`.

## Properties

| Property | Type |
|---|---|
| `type` | `VersioningType.HEADER` |
| `header` | `string` |

## Diagram

```mermaid
graph LR
  Client[HTTP Client] -->|Sends version header| Request[Incoming Request]
  Request --> HeaderName[Configured header]
  HeaderName --> VersionResolver[Header Version Resolver]
  VersionResolver --> Route[Versioned Route Handler]

  Options[HeaderVersioningOptions] -->|type: VersioningType.HEADER| VersionResolver
  Options -->|header: string| HeaderName
```

## Usage

```ts
import { VersioningType } from '@nestjs/common';
import type { HeaderVersioningOptions } from '@nestjs/common/interfaces/version-options.interface';

const versioningOptions: HeaderVersioningOptions = {
  type: VersioningType.HEADER,
  header: 'X-API-Version',
};

// Example request:
// GET /users
// X-API-Version: 2
```

## AI Coding Instructions

- Always set `type` to `VersioningType.HEADER`; this interface is specifically for header-based version resolution.
- Provide a non-empty, stable header name such as `X-API-Version` or `API-Version`.
- Ensure API clients send the configured header with every request to versioned endpoints.
- Keep the configured header name consistent across application bootstrap configuration, gateways, and API documentation.
- Do not use this interface when version information is supplied through a URI, media type, or custom extractor.
