> For the complete documentation index, see [llms.txt](https://docs.unitlab.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.unitlab.ai/api-sdk-cli/ko/apis/api-authentication.md).

# API 인증

Unitlab HTTP API 요청마다 Authorization 헤더로 워크스페이스 API 키를 보내는 방법과 401, 403 등 인증 및 권한 오류, 서명된 링크를 처리하는 방법입니다.

키는 `Authorization` 헤더에 `Api-Key` 스킴으로 보냅니다.

```bash
curl -s https://api.unitlab.ai/api/sdk/projects/ \
  -H "Authorization: Api-Key $UNITLAB_API_KEY"
```

```python
import os, httpx

api = httpx.Client(
    base_url="https://api.unitlab.ai/api/sdk/",
    headers={"Authorization": f"Api-Key {os.environ['UNITLAB_API_KEY']}"},
    timeout=60,
)
print(api.get("projects/").json())
```

워크스페이스는 키로 결정됩니다. 워크스페이스 매개변수는 없습니다.

키는 **Settings** > **API keys**에서 만들고 관리합니다. [인증과 API 키](https://docs.unitlab.ai/api-sdk-cli/ko/get-started/authentication-and-api-keys.md)를 참고하세요.

## 응답 <a href="#responses" id="responses"></a>

| 상태  | 본문                                                            | 의미                                         |
| --- | ------------------------------------------------------------- | ------------------------------------------ |
| 401 | `{"detail": "Authentication credentials were not provided."}` | 키가 없거나, 잘못되었거나, 비활성화, 삭제, 만료된 키            |
| 403 | `{"detail": "...", "code": "permission_denied"}`              | 키에 이 라우트에 대한 권한이 없거나, 특정 사용자가 만든 키가 필요한 작업 |
| 403 | `{"detail": "...", "code": "workspace_read_only"}`            | 지금은 워크스페이스를 변경할 수 없습니다. 읽기는 가능합니다.         |
| 403 | 그 밖의 `code`                                                   | 요금제 또는 할당량이 해당 작업을 허용하지 않음                 |

## 서명된 링크 <a href="#signed-links" id="signed-links"></a>

일부 응답에는 `source_url`, `file`, `upload_url`처럼 미디어나 다운로드로 연결되는 서명된 링크가 들어 있습니다. 이 링크는 `Authorization` 헤더 **없이** 요청하세요. 링크는 만료되므로 저장해 두지 말고 API에 새 링크를 요청하세요.

## 관련 문서 <a href="#related" id="related"></a>

[API 개요](https://docs.unitlab.ai/api-sdk-cli/ko/apis/api-overview.md) · [오류, 요청 한도, 페이지네이션](https://docs.unitlab.ai/api-sdk-cli/ko/apis/errors-rate-limits-and-pagination.md)
