---
search:
  tags:
    - CLI
    - POST
seo:
  description: >-
    RFC 8628 §3.5 のエラー名を error.code に返す。キーは成功した1回の応答にだけ載り、再取得で… Reference for
    the POST /cli/tokens endpoint in the Cozeni 外部 API.
sidebar:
  label: 承認を確かめ、承認済みならCLI用のAPIキーを発行する
  badge: POST
title: 承認を確かめ、承認済みならCLI用のAPIキーを発行する
type: openapi-operation
---
RFC 8628 §3.5 のエラー名を error.code に返す。キーは成功した1回の応答にだけ載り、再取得できない。

`POST /cli/tokens`

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

- `device_code` (string, required)

Request body example:

```json
{
  "device_code": "string"
}
```

**Responses**

- `200` — 承認済み。期限30日・導入用の4スコープのキー。
- `400` — authorization\_pending（承認前）/ slow\_down（間隔が5秒未満）/ access\_denied（拒否）/ expired\_token（期限切れ・消費済み・不明なコード）/ invalid\_input。
- `429` — rate\_limited。
- `500` — internal。

Response example, 200:

```json
{
  "api_key": "string",
  "key_id": "string",
  "creator_id": "string",
  "environment": "string",
  "expires_at": "2019-08-24T14:15:22Z"
}
```
