# Show what a CLI sign-in code asks for.

> https://koi.dog/docs/api/cli-sign-in/inspect-device-login/

`POST /api/v1/auth/device/inspect` · Key: `session only`

Use the `koidog_session` cookie at `https://app.koi.dog/api/v1` with `Origin: https://app.koi.dog`.

## Headers.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `Idempotency-Key` | `string` | no | Retry the same request with the same key. [Retry rules](https://koi.dog/docs/api/#retries). |

## Body.

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `userCode` | `string` | yes | The short code the terminal shows, as the person typed it in the browser. 8 to 16 characters. |

## Response.

200 OK · JSON object

- **422 validation_failed**: Each schema error appears in `details`.

## Request.

```sh
# The dashboard session only: an API key is refused (403 session_required).
curl -X POST https://app.koi.dog/api/v1/auth/device/inspect \
    -H "Cookie: koidog_session=$KOIDOG_SESSION" \
    -H "Origin: https://app.koi.dog" \
    -H "Idempotency-Key: $(uuidgen)" \
    -H "Content-Type: application/json" \
    -d '{
      "userCode": "<user code>"
    }'
```

```js
// The dashboard session only: an API key is refused (403 session_required).
const res = await fetch("https://app.koi.dog/api/v1/auth/device/inspect", {
  method: "POST",
  headers: {
    Cookie: `koidog_session=${process.env.KOIDOG_SESSION}`,
    Origin: "https://app.koi.dog",
    "Idempotency-Key": crypto.randomUUID(),
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    userCode: "<user code>",
  }),
});
console.log(await res.json());
```

```python
import os
import uuid

import requests

# The dashboard session only: an API key is refused (403 session_required).
r = requests.post(
    "https://app.koi.dog/api/v1/auth/device/inspect",
    headers={
        "Cookie": f"koidog_session={os.environ['KOIDOG_SESSION']}",
        "Origin": "https://app.koi.dog",
        "Idempotency-Key": str(uuid.uuid4()),
    },
    json={
        "userCode": "<user code>",
    },
)
r.raise_for_status()
print(r.json())
```

## Response example.

```json
{
  "hostname": "string",
  "os": "macos",
  "network": "string",
  "createdAt": "string",
  "expiresAt": "string",
  "workspaceId": "string",
  "workspaceName": "string",
  "decisionNonce": "string",
  "state": "pending"
}
```
