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

# Authenticate with The Hog API

> Authenticate to The Hog API with the API key and API secret from your dashboard.

Every request to The Hog API — except the public health endpoint — requires authentication. Use the API key and API secret from the Credentials page in your dashboard. Send the public API key as `X-Access-Key` and the API secret as `X-Secret-Key`.

<Warning>
  Keep your API keys and secret keys secure. Never expose them in client-side code, public repositories, or logs. If a key is compromised, rotate it immediately from your account settings.
</Warning>

## Headers

```bash theme={null} theme={"theme":{"light":"github-light","dark":"github-dark"}}
X-Access-Key: ak_xxxxxxxxxxxxxxxx
X-Secret-Key: sk_xxxxxxxxxxxxxxxx
```

Do not use the `Authorization` header for dashboard-created API credentials.

## Example request

<CodeGroup>
  ```bash curl theme={null} theme={"theme":{"light":"github-light","dark":"github-dark"}}
  curl -X POST https://developer.thehog.ai/api/v1/companies/search \
    -H "X-Access-Key: ak_xxxxxxxxxxxxxxxx" \
    -H "X-Secret-Key: sk_xxxxxxxxxxxxxxxx" \
    -H "Content-Type: application/json" \
    -d '{"query": "Salesforce", "limit": 5}'
  ```

  ```python Python theme={null} theme={"theme":{"light":"github-light","dark":"github-dark"}}
  import httpx

  response = httpx.post(
      "https://developer.thehog.ai/api/v1/companies/search",
      headers={
          "X-Access-Key": "ak_xxxxxxxxxxxxxxxx",
          "X-Secret-Key": "sk_xxxxxxxxxxxxxxxx",
          "Content-Type": "application/json",
      },
      json={"query": "Salesforce", "limit": 5},
  )
  print(response.json())
  ```

  ```javascript Node.js theme={null} theme={"theme":{"light":"github-light","dark":"github-dark"}}
  const response = await fetch("https://developer.thehog.ai/api/v1/companies/search", {
    method: "POST",
    headers: {
      "X-Access-Key": "ak_xxxxxxxxxxxxxxxx",
      "X-Secret-Key": "sk_xxxxxxxxxxxxxxxx",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ query: "Salesforce", limit: 5 }),
  });
  const data = await response.json();
  ```
</CodeGroup>

## Authentication errors

| Status code        | Meaning                                        | What to check                                                                                |
| ------------------ | ---------------------------------------------- | -------------------------------------------------------------------------------------------- |
| `401 Unauthorized` | Missing or invalid credentials                 | Verify your API key and API secret are correct and have not been revoked.                    |
| `403 Forbidden`    | Valid credentials but insufficient permissions | Your key does not have access to this endpoint or resource. Check your plan and permissions. |

All error responses follow a consistent shape:

```json theme={null} theme={"theme":{"light":"github-light","dark":"github-dark"}}
{
  "statusCode": 401,
  "error": "Unauthorized",
  "message": "Invalid or missing authentication credentials",
  "path": "/api/v1/companies/search",
  "requestId": "01HZXAMPLE000000000000000",
  "timestamp": "2025-06-01T12:00:00.000Z"
}
```

<Tip>
  Every API response includes an `X-Request-Id` header. Include this value when contacting support — it lets the team trace your specific request.
</Tip>

## Next steps

Once you can authenticate successfully, follow the [quickstart](/quickstart) to make your first company search, find people, and enrich a contact.
