---
title: "Approve CLI access to a project"
method: POST
path: "/auth/cli/device/approve"
tags: ["Identity"]
---

# Approve CLI access to a project

`POST /auth/cli/device/approve`

## Request

- Base URL: `https://api.pyai.com`
- URL: `https://api.pyai.com/auth/cli/device/approve`
- Auth: API key in cookie `pyai_session`

Requires an explicit browser action, application/json, an allowed console Origin, and an owner/admin membership in the active project's organization. Approves the displayed scopes and a thirty-day credential. No API key is created until the waiting CLI exchanges the grant.

## Headers

- `Origin` string, uri, required

## Request body

- object
  - `user_code` string, required
  - `project_id` string, required

## Response `200`

Approved.

- object
  - `status` 'approved', required

## Other responses

- `400`: CLI login error. Branch on the final component of the problem type URI.
- `401`: CLI login error. Branch on the final component of the problem type URI.
- `403`: CLI login error. Branch on the final component of the problem type URI.
- `415`: CLI login error. Branch on the final component of the problem type URI.
- `429`: CLI login error. Branch on the final component of the problem type URI.

---

[API](https://skmtc.dev/pyai/apis/pyai-api.md) · [All operations](https://skmtc.dev/pyai/apis/pyai-api/llms.txt) · [OpenAPI document](https://skmtc.dev/pyai/apis/pyai-api/revisions/819d8e7c4d09?raw)
