Skip to main content
The Botpress API uses token-based authentication. Different token types provide different levels of access.

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
Format: bp_pat_... Creating a PAT:
  1. Go to your Botpress Dashboard
  2. Navigate to Settings > Personal Access Tokens
  3. Click “Create Token”
  4. Set permissions and expiration
  5. 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
Format: 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
Format: 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:
  1. Go to Botpress Dashboard
  2. Navigate to Settings > Personal Access Tokens
  3. Find the token
  4. Click “Revoke”
After revocation, the token becomes invalid immediately.

Troubleshooting

401 Unauthorized

403 Forbidden

See Also