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

# Authentication

> Learn how to authenticate your requests to the Catalog API

All Catalog API requests require authentication using an API key. This page explains how to obtain and use your API key.

## Get your API key

To access the Catalog API, you need an API key. [Contact our team](mailto:founders@getcatalog.ai) to get started.

<Note>
  API keys are tied to your account and should be kept secure. Never expose your API key in client-side code or public repositories.
</Note>

## Using your API key

Include your API key in the `x-api-key` header with every request:

<CodeGroup>
  ```powershell cURL theme={null}
  curl -X POST https://api.getcatalog.ai/v2/agentic-search-mini \
    -H "Content-Type: application/json" \
    -H "x-api-key: YOUR_API_KEY" \
    -d '{"query": "black dress"}'
  ```

  ```javascript JavaScript theme={null}
  const response = await fetch('https://api.getcatalog.ai/v2/agentic-search-mini', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': 'YOUR_API_KEY'
    },
    body: JSON.stringify({
      query: 'black dress'
    })
  });

  const data = await response.json();
  ```

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

  response = requests.post(
      'https://api.getcatalog.ai/v2/agentic-search-mini',
      headers={
          'Content-Type': 'application/json',
          'x-api-key': 'YOUR_API_KEY'
      },
      json={'query': 'black dress'}
  )

  data = response.json()
  ```
</CodeGroup>

## Authentication errors

If authentication fails, the API returns a `401 Unauthorized` response. There are two possible error messages:

### Missing API key

If no API key is provided, you'll receive:

```json theme={null}
{
  "error": "API key required (x-api-key header or Authorization: Bearer)",
  "status": 401
}
```

### Invalid API key

If an invalid API key is provided, you'll receive:

```json theme={null}
{
  "error": "Invalid API key",
  "status": 401
}
```

**Common causes:**

* Missing `x-api-key` header or `Authorization: Bearer` header
* Invalid or expired API key
* Typo in the API key value

<Tip>
  Double-check that your API key is correctly copied and that you're using either the `x-api-key` header or the `Authorization: Bearer` header format.
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/v2/quickstart">
    Make your first API request
  </Card>

  <Card title="API Reference" icon="book" href="/v2/api-reference/overview">
    Explore all available endpoints
  </Card>
</CardGroup>
