Overview
Generate a new workspace token for the current workspace without storing it locally. This command is useful for creating tokens for CI/CD systems, scripts, or other automation tools.Syntax
Options
Token expiration time in secondsDefault:
Example:
31536000
(1 year)Example:
86400
(24 hours)Output format for the tokenDefault:
Options:
text
Options:
text
, json
Examples
Create Standard Token
Create Short-Lived Token
Create Non-Expiring Token
JSON Output
Security Considerations
Token Storage: This command displays the full token. Store it securely and never commit it to version control.
Best Practices
- Copy Immediately: Copy the token immediately as it cannot be retrieved again
- Secure Storage: Store tokens in secure credential management systems
- Regular Rotation: Rotate tokens regularly using
ntcli token refresh
- Scope Limitation: Use workspace-specific tokens rather than global tokens
CI/CD Integration
GitHub Actions
Script Usage
Error Handling
Authentication Required
Authentication Required
Error:
Authentication required. Try running ntcli token refresh
Solution: Ensure you have a valid workspace token:Workspace Not Selected
Workspace Not Selected
Error:
No workspace selected
Solution: Select a workspace first:Invalid Expiration
Invalid Expiration
Error:
Invalid expiration time
Solution: Use a valid expiration time in seconds: