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

# Authentication

> How to authenticate with the Factagora API

## API Keys

All requests to the Factagora API must include an API key as a Bearer token in the `Authorization` header.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

API keys follow the format `fag_...`. Get your free API key at [Settings → API Keys](https://factagora.com/en/playground/tokens).

<Info>
  **A default API key is issued automatically on your first sign-in to Factagora.** You can copy it from [Settings → API Keys](https://factagora.com/en/playground/tokens), or create additional keys for separate environments (e.g., development vs. production).
</Info>

## Example Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X GET "https://api.factagora.com/api/v1/fact-search?q=bitcoin" \
    -H "Authorization: Bearer fag_your_api_key"
  ```

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

  response = requests.get(
      "https://api.factagora.com/api/v1/fact-search",
      params={"q": "bitcoin"},
      headers={"Authorization": "Bearer fag_your_api_key"}
  )
  print(response.json())
  ```

  ```typescript TypeScript theme={null}
  const response = await fetch(
    "https://api.factagora.com/api/v1/fact-search?q=bitcoin",
    {
      headers: { Authorization: "Bearer fag_your_api_key" },
    }
  );
  const data = await response.json();
  ```
</CodeGroup>

## Error Responses

| Status | Error                  | Description                         |
| ------ | ---------------------- | ----------------------------------- |
| `401`  | `Missing Bearer token` | `Authorization` header not provided |
| `401`  | `Invalid API key`      | The provided API key is not valid   |
