Token Types
Personal Access Token (PAT)
Full workspace access for administrative operations. Use cases:- Managing bots and integrations
- Workspace administration
- CI/CD pipelines
- Development tools
bp_pat_...
Creating a PAT:
- Go to your Botpress Dashboard
- Navigate to Settings > Personal Access Tokens
- Click “Create Token”
- Set permissions and expiration
- Copy the token (shown only once)
Bot Token
Bot-scoped access for runtime operations. Use cases:- Bot runtime operations
- Sending/receiving messages
- Managing conversations and users
- Calling actions
bp_bot_...
Getting a bot token:
Bot tokens are automatically provided in bot handlers via the client prop. For standalone use:
Integration Token
Integration-scoped access. Use cases:- Integration runtime operations
- Webhook handling
- Creating messages from external platforms
bp_int_...
Using Tokens
Environment Variables
Store tokens securely in environment variables:.env
In Bot Handlers
Tokens are automatically available in handlers:In Integration Handlers
Token Scopes
Different tokens have different permissions:Personal Access Token
allowed
Create, update, delete workspaces
allowed
Create, update, delete bots
allowed
Create, update, delete integrations
allowed
Manage workspace users and permissions
allowed
View and manage billing
Bot Token
allowed
Create, read, update, delete conversations
allowed
Send and receive messages
allowed
Create and manage users within the bot
allowed
Read and write bot, user, and conversation state
allowed
Call integration actions
allowed
Read and write table data
allowed
Upload and manage files
denied
Cannot modify bot configuration
Integration Token
allowed
Create conversations for the integration
allowed
Send messages to bots
allowed
Create users
allowed
Create events
allowed
Read/write integration, conversation, and user state
Security Best Practices
1. Never Commit Tokens
Add.env to .gitignore:
.gitignore
2. Use Environment Variables
3. Rotate Tokens Regularly
Create new tokens periodically and revoke old ones.4. Use Minimal Scopes
Use bot tokens for runtime operations instead of PATs when possible.5. Secure Token Storage
In production:- Use secret management services (AWS Secrets Manager, Azure Key Vault, etc.)
- Encrypt tokens at rest
- Use ephemeral tokens when possible
6. Monitor Token Usage
Track API calls to detect unusual activity:Token Revocation
Revoke compromised tokens immediately:- Go to Botpress Dashboard
- Navigate to Settings > Personal Access Tokens
- Find the token
- Click “Revoke”
Troubleshooting
401 Unauthorized
403 Forbidden
See Also
- Client Overview - Client initialization
- Client Methods - API operations reference