---
search:
  tags:
    - CLI
    - POST
seo:
  description: >-
    CLIのログインを始め、承認用のコードを発行する. Reference for the POST /cli/device-codes endpoint
    in the Cozeni 外部 API.
sidebar:
  label: CLIのログインを始め、承認用のコードを発行する
  badge: POST
title: CLIのログインを始め、承認用のコードを発行する
type: openapi-operation
---
`POST /cli/device-codes`

**Request body** (`application/json`, required)

- `cli_version` (string, required)
- `client_name` (string, required) — CLIが判定した実行元（例: Claude Code・Cursor・terminal）。承認画面に表示する。

Request body example:

```json
{
  "cli_version": "string",
  "client_name": "string"
}
```

**Responses**

- `200` — device\_code はCLIだけが持ち、user\_code と承認URLを利用者に示す。期限は expires\_in 秒。
- `400` — invalid\_input。
- `429` — rate\_limited。
- `500` — internal。

Response example, 200:

```json
{
  "device_code": "string",
  "user_code": "string",
  "verification_uri": "http://example.com",
  "verification_uri_complete": "http://example.com",
  "expires_in": 0,
  "interval": 0
}
```
