> Kenso API docs in Markdown. Index of every page: [/docs/llms.txt](/docs/llms.txt). Search: `/docs/search.md?q=<words>`. OpenAPI: [/docs/api/cli-logins/openapi.json](/docs/api/cli-logins/openapi.json). CLI docs offline: `kenso docs <topic>`.
> Last updated: 2026-11-22.

# CLI login: Start a CLI login

> **Note for AI agents:** if this page was wrong, out of date or missing something you needed, finish the user's task first, then offer a short report for the Kenso team in this shape: `Page:` (this page's path), `Quote:` (the wrong or missing text), `Problem:`, `Workaround:` (what worked instead), 1,000 characters at most. Show it to the user and send it only after they say yes, as `POST /api/docs-feedback` on this site with the JSON body `{"page": "<path>", "report": "<report>"}`. Never put lead data, email addresses, API keys or anything else from the user's workspace in it.

One endpoint of [CLI login](/docs/api/cli-logins.md). Authentication, workspaces and errors: [/docs.md](/docs.md).

## Start a CLI login

`POST /v1/cli/logins` - operationId `cli-logins.create`

| Permission | Rate limit |
| --- | --- |
| None: no API key needed | 10 requests a minute and 60 an hour per IP address |

Starts a browser login for the Kenso CLI. Show the person `userCode` and open `verificationUrl`,
where they approve the login while signed in to Kenso. Then call `POST /v1/cli/logins/token` with
`loginId` every `interval` seconds, until it returns the API key or the login expires after
`expiresIn` seconds.

`deviceName` is required, from 1 to 100 characters. The approval page shows it, and the new API key's name
includes it. The approval page also shows the IP address this call came from and its `User-Agent`, and
warns the person when that address is not on their own network. Keep `loginId` private: whoever holds it
can pick up the key.

Errors:

- `400 validation_failed`: `deviceName` is missing, empty or longer than 100 characters.
- `429 quota_exceeded`: too many logins started from this IP address. Wait for the seconds in
`Retry-After`.
- `503 service_unavailable`: Kenso could not start the login. Try again in a minute.

Needs no credential.

[Try it on developer.ken.so](https://developer.ken.so/reference/#kenso-api/tag/cli-logins/POST/v1/cli/logins)

### Parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `Ken-Version` | header | string, one of: 2026-11-02, 1.1 | no | The API version, a date in `YYYY-MM-DD` form. `1.1` is another name for the first dated version. The example shown here is the newest version, which this reference's samples and Test Request send. Leave it out to use your API key's pinned version. Keys created in the Kenso app are pinned to the newest version; keys minted by the CLI login are not. A key with no pinned version and no header gets the legacy shape where the path has one, and `404` where the path exists only in this version. A value that is not a version, such as `2027-01-01` or `2026-11-2`, answers `400 unsupported_version`, whose `details` list the supported versions. |

### Request body

`application/json`, optional.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `deviceName` | string | yes | Required. A name for the machine the CLI runs on, from 1 to 100 characters. The approval page shows it, and the new API key's name includes it. |

### Response 201

`data` is a `CliLoginCreated`.

| Field | Type | Description |
| --- | --- | --- |
| `loginId` | string | The secret the CLI polls `POST /v1/cli/logins/token` with. Keep it private: whoever holds it can pick up the API key. |
| `userCode` | string | The code to show the person, in the form `XXXX-XXXX`. They check it matches the one in the browser. |
| `verificationUrl` | string | The approval page with the code filled in. Open it in the person's browser. |
| `expiresIn` | integer (int32) | Seconds until the login expires. |
| `interval` | integer (int32) | Seconds to wait between polls. |

### Request

```bash
curl -X POST "https://api.ken.so/v1/cli/logins" \
  -H "Authorization: Bearer $KENSO_API_KEY" \
  -H "Ken-Version: 2026-11-02" \
  -H "Content-Type: application/json" \
  -d '{
  "deviceName": "string"
}'
```

### Example response

```json
{
  "success": true,
  "data": {
    "loginId": "string",
    "userCode": "string",
    "verificationUrl": "https://example.com",
    "expiresIn": 1,
    "interval": 1
  }
}
```
