Creating an API Token
Navigate to API Tokens
Sign in to your Documenso account and navigate to:Settings → API TokensOr for team tokens:Team Settings → API Tokens
You must be a team admin to create team API tokens.
Create New Token
Click the Create Token button and provide:
- Token Name: A descriptive name to identify the token (minimum 3 characters)
- Expiration: Optional expiration date for security
Choose a descriptive name like
production-api, staging-integration, or zapier-webhook to easily identify tokens later.Copy Your Token
After creation, your token will be displayed once. Copy it immediately and store it securely.The token format will be:
Token Creation Implementation
The token generation process uses a secure alphanumeric ID generator:Source: packages/lib/server-only/public-api/create-api-token.ts
Expiration Options
When creating a token, you can optionally set an expiration date for enhanced security:No Expiration
No Expiration
Token remains valid indefinitely until manually deleted.Best for:
- Production integrations requiring long-term stability
- Service accounts with token rotation policies
1 Month
1 Month
Token expires after 30 days.Best for:
- Short-term projects
- Development and testing
3 Months
3 Months
Token expires after 90 days.Best for:
- Quarterly rotations
- Medium-term integrations
6 Months
6 Months
Token expires after 180 days.Best for:
- Semi-annual security reviews
- Standard production workflows
1 Year
1 Year
Token expires after 365 days.Best for:
- Annual security audits
- Long-term stable integrations
Managing Tokens
View Existing Tokens
You can view all your API tokens in the settings page. For each token, you’ll see:- Token Name: The descriptive name you provided
- Created Date: When the token was created
- Expiration Date: When the token expires (if set)
- Status: Active or expired
The actual token value is never displayed after creation - only metadata about the token.
Delete a Token
To revoke a token:- Navigate to Settings → API Tokens
- Find the token you want to delete
- Click Delete
- Confirm the deletion
Using Your Token
Once created, include your token in theAuthorization header of all API requests:
Environment Variable Setup
Store your API token as an environment variable for security:Token Security Best Practices
Never Expose Tokens
Never Expose Tokens
- Don’t commit tokens to version control (add
.envto.gitignore) - Don’t include tokens in client-side JavaScript
- Don’t log tokens in application logs
- Don’t share tokens in screenshots or documentation
Use Environment Variables
Use Environment Variables
Store tokens in environment variables instead of hardcoding:
Implement Token Rotation
Implement Token Rotation
Regularly rotate API tokens:
- Create a new token
- Update your application to use the new token
- Verify the new token works
- Delete the old token
Use Separate Tokens Per Environment
Use Separate Tokens Per Environment
Create different tokens for:
- Development
- Staging
- Production
Monitor Token Usage
Monitor Token Usage
Regularly review your API tokens:
- Remove unused tokens
- Check for expired tokens
- Audit token access patterns
- Investigate unexpected usage spikes
Set Expiration Dates
Set Expiration Dates
Always set expiration dates for tokens when possible:
- Reduces risk from compromised tokens
- Forces regular security reviews
- Encourages token rotation practices
Troubleshooting
401 Unauthorized Error
401 Unauthorized Error
Cannot Create Team Token
Cannot Create Team Token
Cause: Insufficient permissionsSolution: You must be a team admin to create team API tokens. Contact your team admin to:
- Upgrade your role to admin, or
- Create the token on your behalf
Lost Token
Lost Token
Cause: Token not saved after creationSolution: Tokens cannot be retrieved after creation. You must:
- Delete the lost token
- Create a new token
- Update your application with the new token
Schema Reference
The API token creation request and response schemas:Request Schema
Response Schema
Next Steps
Authentication
Learn how to use your token for API authentication
Rate Limits
Understand rate limits and how they affect your tokens
