Authorization header of every request.
Getting Your API Token
Step 1: Access API Settings
Navigate to your Penbox API settings page:Step 2: Create a New Token
- Click the “Create API Token” button
- Give your token a descriptive name (e.g., “Production Integration”, “Development”, “Analytics Tool”)
- Select the workspace you want to authorize
- Copy the generated token immediately
Token Format
Your API token will look like this:pnbx_ prefix.
Using Your API Token
Include your API token in theAuthorization header of every API request using the Bearer scheme:
Example Requests
Making Authenticated Requests
Every API endpoint requires authentication. Here’s an example creating a form request:Token Scopes and Permissions
Each API token is associated with a specific workspace. The token will have access to:- All forms in the workspace
- All cases in the workspace
- All form templates enabled for the workspace
- All files and attachments in the workspace
- Document intelligence features for the workspace
Tokens are workspace-specific. If you need to access multiple workspaces, create a separate token for each one.
Token Security
Best Practices
Store tokens securely
Store tokens securely
- Never commit tokens to version control (Git, SVN, etc.)
- Store tokens in environment variables or secure credential management systems
- Use secrets management services (AWS Secrets Manager, HashiCorp Vault, etc.)
- Never expose tokens in client-side code or browser JavaScript
Use environment variables
Use environment variables
Store your API token in environment variables:Then load it in your application:
.env
Rotate tokens regularly
Rotate tokens regularly
- Rotate tokens periodically for enhanced security
- Create a new token before revoking the old one to avoid downtime
- Update all applications using the old token
- Revoke the old token once migration is complete
Use descriptive names
Use descriptive names
Give your tokens meaningful names to track usage:
- ✅ “Production API - CRM Integration”
- ✅ “Development Environment”
- ✅ “Analytics Dashboard”
- ❌ “Token 1”, “Test”, “My Token”
Monitor token usage
Monitor token usage
- Track which applications use which tokens
- Monitor for unexpected API usage patterns
- Set up alerts for unusual activity
- Revoke tokens immediately if compromised
What NOT to Do
Managing Tokens
Viewing Active Tokens
Visit app.penbox.io/workspace/settings/api to see all your active API tokens:- Token name
- Creation date
- Last used date
- Associated workspace
Revoking Tokens
To revoke a token:- Go to app.penbox.io/workspace/settings/api
- Find the token you want to revoke
- Click the “Revoke” button
- Confirm the action
Once revoked, a token is immediately invalidated. All API requests using that token will fail with a
401 Unauthorized error.Token Lifecycle
Authentication Errors
Common Error Responses
401 Unauthorized - Missing Token
Authorization header is missing from your request.
Solution: Add the Authorization header with your Bearer token.
401 Unauthorized - Invalid Token
403 Forbidden - No Access
Debugging Authentication Issues
If you’re experiencing authentication issues:-
Verify the token format
- Token should start with
pnbx_ - No extra spaces or newlines
- Complete token copied
- Token should start with
-
Check the Authorization header
- Includes “Bearer ” prefix with a space
- Token immediately after the space
-
Verify token is active
- Check app.penbox.io/workspace/settings/api
- Ensure token hasn’t been revoked
- Confirm token exists in the list
-
Test with cURL
The
-vflag shows detailed request/response information.
Rate Limiting
API tokens are subject to rate limiting to ensure fair usage and system stability.Rate Limit Exceeded
If you exceed the rate limit, you’ll receive a429 Too Many Requests response:
Best Practices for Rate Limiting
- Cache responses when possible
- Implement exponential backoff on errors
- Monitor your usage patterns
- Spread requests over time instead of bursting
- Use webhooks instead of polling when possible
Testing Your Authentication
Quick Test
Test your token with a simple request to list workspaces:Integration Checklist
Before deploying to production:- Token stored securely (environment variable or secrets manager)
- Authorization header correctly formatted
- Error handling implemented for 401/403 responses
- Rate limiting handled with backoff strategy
- Token name clearly identifies the integration
- Monitoring/logging in place for API usage
- Token rotation plan documented
Multiple Environments
For different environments, create separate tokens:Development
Staging
Production
Next Steps
Create Forms
Learn how to create forms
List Workspaces
Retrieve your authorized workspaces
API Overview
Complete API capabilities guide
All Endpoints
Browse all available endpoints
Support
If you encounter issues with authentication:- Check this documentation for troubleshooting steps
- Verify your token at app.penbox.io/workspace/settings/api
- Test with the cURL examples above
- Contact support at [email protected] with:
- Token name (never send the actual token)
- Error messages received
- API endpoint being called
- Request timestamp