- Personal Access Tokens (recommended for API access)
- Bearer Tokens (JWT) (used for dashboard authentication)
Personal Access Tokens
Personal Access Tokens (PATs) are the recommended way to authenticate API requests. They provide secure, long-lived credentials for programmatic access.Creating a Personal Access Token
Generate Token
Click Create Token and provide:
- Name: A descriptive name for the token
- Expiration: Token validity period (1-365 days)
Using the Token
Include the token in theAuthorization header with the Token prefix:
Managing Tokens via API
Create a Personal Access Token
You need to be authenticated (with an existing token or JWT) to create new tokens programmatically.
Create Token
The unique identifier of the user
Name of the token
Expiration time in days (1-365)
List Personal Access Tokens
List Tokens
Example
Token ID
Token name
When the token expires (ISO 8601 format)
Last time the token was used (ISO 8601 format)
Delete a Personal Access Token
Delete Token
Example
Bearer Token (JWT)
Bearer tokens are JWT tokens obtained through OAuth2 authentication flow. They’re primarily used by the NetBird dashboard.Using Bearer Tokens
Include the JWT in theAuthorization header with the Bearer prefix:
Authentication Errors
401 Unauthorized
Missing or invalid authentication credentials
403 Forbidden
Authenticated but insufficient permissions
Best Practices
Rotate tokens regularly - Set appropriate expiration periods and rotate tokens before they expire
Use minimal permissions - Create service users with limited roles for automation
Store securely - Never commit tokens to version control; use environment variables or secret managers
Monitor usage - Check the
last_used field to identify unused tokensRevoke compromised tokens - Immediately delete any tokens that may be compromised