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 all personal access tokens for your account
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
--namestringYesHuman-readable label for the token. Must be unique within your account.
--scopestringYesRW (read and write) or RO (read only).
--orgstringNoRestrict the token to a single organization slug. Omit to allow access to all orgs.
--expirystringNo90dToken lifetime. One of: 30d, 60d, 90d, 180d, 365d, never.
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 all personal access tokens associated with your account. 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.


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