> ## 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.

# 인증

> Factagora API 인증 방법

## API 키

Factagora API로 보내는 모든 요청은 `Authorization` 헤더에 Bearer 토큰 형식의 API 키를 포함해야 합니다.

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

API 키는 `fag_...` 형식을 따릅니다. [설정 → API Keys](https://factagora.com/ko/playground/tokens)에서 무료 API 키를 발급받으세요.

<Info>
  **Factagora에 처음 로그인하면 기본 API 키가 자동으로 발급됩니다.** [설정 → API Keys](https://factagora.com/ko/playground/tokens)에서 키를 복사할 수 있고, 환경별로 분리하려면(예: 개발용·프로덕션용) 추가 키를 생성할 수 있습니다.
</Info>

## 요청 예시

<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>

## 오류 응답

| 상태    | 오류                     | 설명                          |
| ----- | ---------------------- | --------------------------- |
| `401` | `Missing Bearer token` | `Authorization` 헤더가 제공되지 않음 |
| `401` | `Invalid API key`      | 제공된 API 키가 유효하지 않음          |
