> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gethuntd.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> How to authenticate with the Huntd API

## API Key Authentication

The Huntd API uses API keys for authentication. All requests must include your API key in the `X-API-Key` header.

## API Key Format

```
hntd_{id}_{secret}
```

Example: `hntd_abc12345_xK9mN2pQ4rS7tU0vW3xY`

<Warning>
  Keep your API key secret. Never expose it in client-side code or public repositories.
</Warning>

## Making Requests

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST https://api.gethuntd.com/api/v1/external/verify-email \
    -H "Content-Type: application/json" \
    -H "X-API-Key: hntd_abc12345_yoursecretkey" \
    -d '{"email": "john@example.com"}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.gethuntd.com/api/v1/external/verify-email', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'X-API-Key': process.env.HUNTD_API_KEY
    },
    body: JSON.stringify({ email: 'john@example.com' })
  });
  ```

  ```python Python theme={null}
  import requests
  import os

  response = requests.post(
      'https://api.gethuntd.com/api/v1/external/verify-email',
      headers={
          'Content-Type': 'application/json',
          'X-API-Key': os.environ['HUNTD_API_KEY']
      },
      json={'email': 'john@example.com'}
  )
  ```
</CodeGroup>

## Obtaining an API Key

Contact your organization administrator to get an API key.

<Note>
  API keys are shown only once when created. If you lose your key, request a new one.
</Note>

## Security Best Practices

* Store API keys in environment variables
* Never commit keys to version control
* Only make API calls from server-side code
* Monitor usage for unexpected activity

## Authentication Errors

| Error Code        | HTTP Status | Description                                         |
| ----------------- | ----------- | --------------------------------------------------- |
| `INVALID_API_KEY` | 401         | API key is missing, invalid, malformed, or disabled |
