Skip to content
nikcli
Docs
Documentation

Accounts & Users

The nikcli account behind a server (login and its completion step) and the local UserDB records the server owns.

Playground

Send these requests to your own running server. Values stay in this browser.

Not connected
How this works

Start a server with nikcli serve --hostname 127.0.0.1 --port 4096. Requests go straight from this page to that address — the browser allows it because loopback counts as a secure origin, and the server allows it because nikcli-ai.dev is in its CORS allowlist.

To try things without touching your real sessions or config, start the server with NIKCLI_TEST_HOME pointed at a throwaway directory — see the guided tour.

Operations

6 endpoints, generated from the server's own OpenAPI document. Every path also accepts the directory and workspace query parameters that select which instance handles the request.

get /account getAccount
post /account/login postAccountLogin
post /account/login/complete postAccountLoginComplete
post /user/register postUserRegister
post /user/login postUserLogin
patch /user/{id} patchUser:id
get /account # getAccount
Parameters
Name In Type Required
directory query string optional
workspace query string optional
Responses
200 Account / null / session payload, shape depends on the call. application/json
unknown
502 AccountError application/json
{
  error: string
}
Example response from schema
null

Generated from the response schema — field values are placeholders, the shape is real.

SDK example
getAccount
ts
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.getAccount({
  ...
})
Try it
post /account/login # postAccountLogin
Parameters
Name In Type Required
directory query string optional
workspace query string optional
Responses
200 Account / null / session payload, shape depends on the call. application/json
unknown
502 AccountError application/json
{
  error: string
}
Example response from schema
null

Generated from the response schema — field values are placeholders, the shape is real.

SDK example
postAccountLogin
ts
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.postAccountLogin({
  ...
})
Try it
post /account/login/complete # postAccountLoginComplete
Parameters
Name In Type Required
directory query string optional
workspace query string optional
Request body · required · application/json
{
  deviceCode: string
  expiresIn?: 
    | number
    | "Infinity" | "-Infinity" | "NaN"
}
Responses
200 Account / null / session payload, shape depends on the call. application/json
unknown
502 AccountError application/json
{
  error: string
}
Example response from schema
null

Generated from the response schema — field values are placeholders, the shape is real.

SDK example
postAccountLoginComplete
ts
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.postAccountLoginComplete({
  ...
})
Try it
post /user/register # postUserRegister
Parameters
Name In Type Required
directory query string optional
workspace query string optional
Request body · required · application/json
{
  username: string
  email: string
  password: string
  displayName?: string | null
}
Responses
200 UserSession application/json
{
  token: string
  user: PublicUser
}
Example response from schema
{
  "token": "",
  "user": {
    "id": "",
    "username": "",
    "email": "",
    "display_name": "",
    "role": "admin",
    "created_at": 0,
    "updated_at": 0
  }
}

Generated from the response schema — field values are placeholders, the shape is real.

SDK example
postUserRegister
ts
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.postUserRegister({
  ...
})
Try it
post /user/login # postUserLogin
Parameters
Name In Type Required
directory query string optional
workspace query string optional
Request body · required · application/json
{
  email: string
  password: string
}
Responses
200 UserSession application/json
{
  token: string
  user: PublicUser
}
Example response from schema
{
  "token": "",
  "user": {
    "id": "",
    "username": "",
    "email": "",
    "display_name": "",
    "role": "admin",
    "created_at": 0,
    "updated_at": 0
  }
}

Generated from the response schema — field values are placeholders, the shape is real.

SDK example
postUserLogin
ts
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.postUserLogin({
  ...
})
Try it
patch /user/{id} # patchUser:id
Parameters
Name In Type Required
id path string required
directory query string optional
workspace query string optional
Request body · required · application/json
{
  displayName?: string | null
  password?: string | null
  role?: "admin" | "user" | null
}
Responses
200 PublicUser application/json
{
  id: string
  username: string
  email: string
  display_name: string | null
  role: "admin" | "user"
  created_at: 
    | number
    | "Infinity" | "-Infinity" | "NaN"
  updated_at: 
    | number
    | "Infinity" | "-Infinity" | "NaN"
}
Example response from schema
{
  "id": "",
  "username": "",
  "email": "",
  "display_name": "",
  "role": "admin",
  "created_at": 0,
  "updated_at": 0
}

Generated from the response schema — field values are placeholders, the shape is real.

SDK example
patchUser:id
ts
import { createNikcliClient } from "@nikcli-ai/sdk/httpapi"

const client = createNikcliClient()
await client.patchUser:id({
  ...
})
Try it

Schemas

The 4 schemas reachable from these endpoints. Each is shown one level deep; nested types link to their own entry below. Names ending in _2, _3 and so on are the OpenAPI emitter disambiguating same-named schemas declared by different HttpApi groups — they are distinct shapes, not duplicates.

AccountError
{
  error: string
}
AccountResponseEncoded
unknown
PublicUser
{
  id: string
  username: string
  email: string
  display_name: string | null
  role: "admin" | "user"
  created_at: 
    | number
    | "Infinity" | "-Infinity" | "NaN"
  updated_at: 
    | number
    | "Infinity" | "-Infinity" | "NaN"
}
UserSession
{
  token: string
  user: PublicUser
}