# Headers

This endpoint allows users to retrieve a JSON response of the headers their application is sending, aiding in troubleshooting authentication issues, particularly with the Authorization header. 

> [!TIP]
> The values in sensitive headers such as `Authorization` are partially redacted in the response for security purposes.

## Endpoint

```
https://api.marketdata.app/headers/
```
#### Method
```
GET
```
## Request Example

### HTTP

**GET** [https://api.marketdata.app/headers/](https://api.marketdata.app/headers/)

### JavaScript

```js title="headersCheck.js"
import { MarketDataClient } from "@marketdata/sdk";

const client = new MarketDataClient();

try {
  const h = await client.utilities.headers();
  console.log(h["user-agent"]);
  console.log(h["accept-encoding"]);
} catch (error) {
  console.error(error);
}
```

### TypeScript

```typescript title="headersCheck.ts"
import { MarketDataClient } from "@marketdata/sdk";
import type { HeadersResponse } from "@marketdata/sdk";

const client = new MarketDataClient();

try {
  const h: HeadersResponse = await client.utilities.headers();
  console.log(h["user-agent"]);
  console.log(h["accept-encoding"]);
} catch (error) {
  console.error(error);
}
```

### Python

```python title="headersCheck.py"
import requests

url = "https://api.marketdata.app/headers/"
response = requests.get(url)

print(response.text)
```

### PHP

```php title="headersCheck.php"
use MarketDataApp\Client;

$client = new Client();
$headers = $client->utilities->headers();

// Display all headers
echo $headers;
```

### Java

```java title="HeadersCheck.java"
import com.marketdata.sdk.MarketDataClient;

public class HeadersCheck {
  public static void main(String[] args) {
    try (MarketDataClient client = new MarketDataClient()) {
      System.out.println(client.utilities().headers().values());
    }
  }
}
```

### Kotlin

```kotlin title="HeadersCheck.kt"
import com.marketdata.sdk.MarketDataClient

fun main() {
    MarketDataClient().use { client ->
        println(client.utilities().headers().values())
    }
}
```

## Response Example

```json
{
    "accept": "*/*",
    "accept-encoding": "gzip",
    "authorization": "Bearer *******************************************************YKT0",
    "cache-control": "no-cache",
    "cf-connecting-ip": "132.43.100.7",
    "cf-ipcountry": "US",
    "cf-ray": "85bc0c2bef389lo9",
    "cf-visitor": "{\"scheme\":\"https\"}",
    "connection": "Keep-Alive",
    "host": "api.marketdata.app",
    "postman-token": "09efc901-97q5-46h0-930a-7618d910b9f8",
    "user-agent": "PostmanRuntime/7.36.3",
    "x-forwarded-proto": "https",
    "x-real-ip": "53.43.221.49"
}
```

## Response Attributes

### Success

- **Headers** `object`

  A JSON object representing the headers received from the user's request. This object includes standard and custom headers along with their respective values.

### Error

- **s** `string`

  Status will be `error` if the request produces an error response.

- **errmsg** `string`
  An error message.

This endpoint is particularly useful for debugging issues related to authentication by allowing users to see exactly what headers are being sent to the API.
