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

# 인증

> Financial Context 시장 데이터 요청 인증하기

Financial Context는 외부 시장 데이터 호출에 두 가지 자격 증명을 허용합니다.

* Financial Context 계정 설정에서 만든 API key
* 승인된 CLI, MCP 또는 agent 클라이언트용 OAuth bearer token

API 요청에는 이러한 Financial Context 자격 증명을 사용하세요.

## API Key Header

```bash theme={null}
curl "https://openapi.fcontext.com/api/market-data/quote?symbols=AAPL.US" \
  -H "x-api-key: YOUR_FCONTEXT_API_KEY"
```

`x-api-key`는 서버 간 통합에 권장되는 header입니다.

## OAuth Bearer Token

```bash theme={null}
curl "https://openapi.fcontext.com/api/market-data/quote?symbols=AAPL.US" \
  -H "Authorization: Bearer YOUR_ACCESS_TOKEN"
```

Bearer token에는 `market_data` scope의 시장 데이터 접근 권한이 필요합니다.

## JavaScript 예시

```javascript theme={null}
const response = await fetch("https://openapi.fcontext.com/api/market-data/quote?symbols=AAPL.US", {
  headers: {
    "x-api-key": process.env.FCONTEXT_API_KEY,
  },
});

if (!response.ok) {
  throw new Error(`Request failed with ${response.status}`);
}

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

## Python 예시

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

response = requests.get(
    "https://openapi.fcontext.com/api/market-data/quote",
    params={"symbols": "AAPL.US"},
    headers={"x-api-key": os.environ["FCONTEXT_API_KEY"]},
    timeout=30,
)
response.raise_for_status()
data = response.json()
```

## 오류 응답

| 상태    | 의미                            |
| ----- | ----------------------------- |
| `401` | 자격 증명이 없거나 만료되었거나 유효하지 않음     |
| `402` | 유료 플랜 또는 남은 데이터 요청 한도가 필요함    |
| `403` | 자격 증명은 유효하지만 시장 데이터 접근 권한이 없음 |

키를 주기적으로 교체하고 더 이상 사용하지 않는 키는 폐기하세요.
