onepin login / logout / whoami

login

Synopsis

onepin login [--key KEY] [--base-url URL]

Description

Authenticates with the OnePin API and saves credentials to ~/.onepin/credentials.

  1. Resolves the key from --key or prompts interactively (input is hidden).
  2. Validates the key by calling GET /api/v1/auth/whoami.
  3. Writes ~/.onepin/credentials with mode 0600 (parent dir 0700).
  4. Prints the authenticated identity and the path where credentials were saved.

Flags

FlagDescription
--key TEXTSupply the API key non-interactively
--base-url TEXTOverride the API base URL (default: https://api.onepin.ai)

Examples

Interactive:

$onepin login
$# OnePin API key: ········
$# ✓ Logged in.
$# Workspace: 3fa85f64-5717-4562-b3fc-2c963f66afa6
$# Scopes: workflows:read, workflows:write, voices:read
$# Saved to: ~/.onepin/credentials

Non-interactive (CI):

$onepin login --key "$ONEPIN_API_KEY"

Custom base URL (local dev):

$onepin login --key "$ONEPIN_API_KEY" --base-url http://localhost:8000

JSON output:

$onepin login --key "$ONEPIN_API_KEY" --json
1{
2 "user_id": "usr_01HZ...",
3 "workspace_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
4 "scopes": ["workflows:read", "workflows:write", "voices:read"],
5 "key_name": "ci-pipeline"
6}

Errors

ConditionMessageExit
Invalid or revoked keyInvalid API key. Generate one at https://app.onepin.ai/settings/api-keys1
Network unreachableCannot reach https://api.onepin.ai — check your connection1
Key missing op_live_ prefixKey must start with op_live_1
  • logout — remove saved credentials
  • whoami — verify current credentials without re-saving

logout

Synopsis

onepin logout

Description

Removes the [default] section from ~/.onepin/credentials. Does not revoke the key — revoke it in the dashboard if needed.

Example

$onepin logout
$# ✓ Credentials removed from ~/.onepin/credentials

whoami

Synopsis

onepin whoami

Description

Displays the authenticated identity for the current credentials without modifying any local state.

Example

$onepin whoami
User: ada@example.com
User ID: usr_01JXXXXXXXXXXXXXXXXXXXXX
Workspace: 3fa85f64-5717-4562-b3fc-2c963f66afa6
Key name: ci-pipeline
Scopes: workflows:read, workflows:write, voices:read

v0.2: The workspace display name is not yet returned by the API. The workspace UUID is shown instead.

JSON output:

$onepin whoami --json
1{
2 "user_id": "usr_01JXXXXXXXXXXXXXXXXXXXXX",
3 "workspace_id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
4 "key_name": "ci-pipeline",
5 "scopes": ["workflows:read", "workflows:write", "voices:read"]
6}