Skip to content

auth token

Personal Access Token management commands. PATs allow ndcli to authenticate using the NDCLI_TOKEN environment variable instead of the interactive browser-based login — useful for CI/CD pipelines and headless servers.

See the Personal Access Tokens guide for a conceptual overview and security best practices.

CommandDescription
auth token createCreate a new personal access token
auth token listList your personal access tokens
auth token revokeRevoke a personal access token

Create a new personal access token. The full token value is displayed once at creation and cannot be retrieved afterwards.

Terminal window
ndcli auth token create --name <name> --scope <RW|RO> [--org <org>] [--expiry <duration>]
FlagTypeRequiredDefaultDescription
--namestringYes—Human-readable label for the token. Unique within your account for good: the name of a revoked or expired token can’t be used again (ALREADY_EXISTS).
--scopestringYes—RW (read and write) or RO (read only).
--orgstringNo—Restrict the token to a single organization slug. Omit to allow access to all orgs.
--expirystringNo90dToken lifetime. One of: 30d, 60d, 90d, 180d, 365d, never.

An account can have 25 active tokens; revoked and expired tokens don’t count. Past that, create is refused with TOKEN_LIMIT_REACHED until you revoke one.

Terminal window
# Create a read-write token valid for 90 days
ndcli auth token create --name "github-ci" --scope rw --expiry 90d
✓ Personal access token created
⚠ Copy your token now — it will NOT be shown again.
Token: ndpat_Jj8IYRumwQ9GV4nfqrymvLBbUUnY8LAkuEecJnIrk1U
Name: github-ci
Scope: RW
Expires: 2026-08-24
Set NDCLI_TOKEN=<token> to use static auth without interactive login.
Terminal window
# Create a read-only token scoped to one org, never expiring
ndcli auth token create --name "readonly-monitor" --scope ro --org ops --expiry never

List your personal access tokens. With an interactive login, or a token created without --org, it lists every token for your account. With a token restricted to one organization, it lists only the tokens restricted to that same organization. Shows metadata only — the full token value is never displayed after creation.

Terminal window
ndcli auth token list

None. Supports the global -f output format flag (table, json, simple, detailed).

Terminal window
ndcli auth token list
╭──────────────────┬──────────────┬───────┬─────┬────────────┬───────────┬─────────╮
│ NAME │ PREFIX │ SCOPE │ ORG │ EXPIRES │ LAST USED │ STATUS │
├──────────────────┼──────────────┼───────┼─────┼────────────┼───────────┼─────────┤
│ github-ci │ ndpat_Jj8IYR │ RW │ - │ 2026-08-24 │ 2m │ active │
│ readonly-monitor │ ndpat_aB3xYz │ RO │ ops │ Never │ Never │ active │
╰──────────────────┴──────────────┴───────┴─────┴────────────┴───────────┴─────────╯
Total: 2 token(s)
FieldDescription
NAMEThe label assigned at creation.
PREFIXThe first characters of the token (for identification without exposing the secret).
SCOPERW or RO.
ORGOrganization the token is scoped to, or - for all orgs.
EXPIRESExpiration date, or Never.
LAST USEDTime since last authenticated request, or Never if unused.
STATUSactive or expired.

This command works with both interactive (ndcli auth login) and PAT (NDCLI_TOKEN) authentication. A token restricted to one organization lists only the tokens restricted to that same organization.


Permanently revoke a personal access token by name. Any in-flight requests using the revoked token will immediately receive an authentication error.

Terminal window
ndcli auth token revoke <name> [--yes]
ArgumentDescription
<name>Name of the token to revoke (as shown in auth token list).
FlagTypeDefaultDescription
--yesboolfalseSkip the confirmation prompt. Useful for scripting.
Terminal window
# Revoke with confirmation prompt
ndcli auth token revoke github-ci
# Revoke without confirmation (for scripts)
ndcli auth token revoke github-ci --yes