Skip to main content
Version: Laravel: 4.x (current)

Request headers

You can use the @header docblock tag (or the #[Header] attribute) to specify headers for a single endpoint, in the format @header <name> <optional example>:

/**
* @header X-Api-Version
* @header Content-Type application/xml
*/

The header will be included in example requests and response calls.

Alternatively, you can specify headers for multiple endpoints in one go by using the apply.headers section of the route group in scribe.php. For instance, with this config:

config/scribe.php
  'routes' => [
[
'match' => [
'domains' => ['*'],
'prefixes' => ['v2/'],
],
'apply' => [
'headers' => [ 'Api-Version' => 'v2']
]
]
]

In this example, all endpoints that start with v2/ will have the header Api-Version: v2 included in their example requests and response calls.