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

# 계정

> 로그인, 로그아웃, 그리고 활성 CLI 계정 컨텍스트 확인

CLI는 인증이 필요한 명령에 API 키를 사용합니다. `youka login`으로 한 번 저장해두거나, CI 및 기타 비대화형 환경에서는 `YOUKA_API_KEY`로 제공할 수 있습니다.

`youka login`은 저장하기 전에 API를 통해 키를 검증한 다음, 진단을 위해 확인된 계정 이메일을 `~/.youka/config.json`에 캐시합니다.

## `login`

API 키를 `~/.youka/config.json`에 저장합니다.

```bash theme={null}
youka login [token]
```

<ParamField path="token" type="string">
  Youka 대시보드에서 복사한 API 키입니다. 생략하면, CLI가 대화형 터미널에서
  입력을 요청합니다.
</ParamField>

### 예시

<CodeGroup>
  ```bash token theme={null}
  youka login yk_live_abcd1234
  ```

  ```bash with-api theme={null}
  youka login yk_live_abcd1234 --api https://staging-api.youka.test --json
  ```
</CodeGroup>

<Tip>CI에서는 설정 파일을 작성하는 것보다 `YOUKA_API_KEY`를 사용하는 것을 권장합니다.</Tip>

## `logout`

저장된 API 키를 `~/.youka/config.json`에서 제거합니다.

```bash theme={null}
youka logout
youka logout --json
```

## `whoami`

확인된 키 소스, API URL, 그리고 계정 식별 정보를 확인합니다.

```bash theme={null}
youka whoami
youka whoami --json
```

응답 예시:

```json theme={null}
{
  "ok": true,
  "data": {
    "authenticated": true,
    "tokenPresent": true,
    "authStatus": "verified",
    "identitySource": "live",
    "keySource": "config",
    "apiUrl": "https://api.youka.io/ko/api/v1",
    "apiUrlSource": "default",
    "email": "user@example.com",
    "userId": "user_123",
    "apiKeyId": "key_123",
    "org": null,
    "configPath": "/Users/you/.youka/config.json",
    "apiKeyPreview": "yk_l...1234"
  }
}
```

### 확인 순서

| Field   | Order                                                                         |
| ------- | ----------------------------------------------------------------------------- |
| API key | `YOUKA_API_KEY`, then `~/.youka/config.json`                                  |
| API URL | `--api`, then `YOUKA_API_BASE_URL`, then `~/.youka/config.json`, then default |

저장된 config 키가 활성화되어 있을 때, `whoami`는 API로 신원을 검증하고 라이브 조회를 사용할 수 없는 경우에만 캐시된 계정 이메일로 폴백합니다. `YOUKA_API_KEY` 토큰에는 캐시된 config 신원을 사용하지 않습니다.

## 다음 단계

* [Global options](/ko/cli/global-options) - 모든 명령에서 공통으로 사용하는 플래그
* [Projects](/ko/cli/projects) - 노래방 프로젝트 생성 및 처리
