Skip to main content
The wit token command lets you create and manage Personal Access Tokens (PATs) for authenticating with the wit platform API and CLI.

Overview

Personal Access Tokens are used to:
  • Authenticate CLI commands with the wit server
  • Access the wit API programmatically
  • Automate tasks in CI/CD pipelines
  • Grant limited access to third-party tools

Commands

create

Create a new personal access token.

Options

Examples

Example Output

Save your token immediately after creation. For security reasons, the full token is only shown once and cannot be retrieved later.

list

List all your personal access tokens.

Example Output


revoke

Revoke (delete) a personal access token.

Arguments

Examples

Example Output


scopes

List all available token scopes and their descriptions.

Example Output


Token Scopes

Scopes limit what a token can do. Always use the minimum scopes needed.

Scope Combinations

Common scope combinations for different use cases:

Using Tokens

Environment Variable

Set the WIT_TOKEN environment variable:

Authorization Header

Use the token in API requests:

Git Credential Helper

Configure git to use your token:

Security Best Practices

Set expiration dates for tokens, especially those used in CI/CD:
Only grant the permissions the token actually needs:
Create new tokens and revoke old ones periodically:
Use environment variables or secret management tools instead of hardcoding tokens in code.
Regularly audit and revoke tokens that are no longer needed:

Workflow Examples

CI/CD Setup

Automation Script

Token Rotation


Requirements

The token command requires:
  1. Database connection: Set DATABASE_URL environment variable
  2. User authentication: Set WIT_USER_ID environment variable
When using wit up to start the platform, these are configured automatically. The WIT_USER_ID can be obtained from the web UI after logging in.