Authentication
All Tokencraft API requests require authentication using Bearer tokens. This guide explains how to create and use API tokens securely.Creating an API Token
- Log in to your Tokencraft dashboard
- Navigate to API in the sidebar
- Click “New Token”
- Enter a descriptive name for your token
- Click “Create Token”
- Copy the token immediately - you won’t be able to see it again!
Token Format
Tokencraft API tokens follow this format:dtk_1234567890abcdef1234567890abcdef12345678
Using Your Token
Include your API token in theAuthorization header of every request:
Examples
Environment Variables
Store your token as an environment variable for security:Token Permissions
Each API token can access:- All workspaces owned by your account
- All tokensets within those workspaces
- All tokens and modes
API tokens always include read access. Write operations (POST, PATCH, DELETE) are available only on PRO and TEAM plans. If you’re on the FREE plan, write requests will return
403 until you upgrade.Token Management
Viewing Active Tokens
See all your active API tokens in the Settings page:- Token name
- Creation date
- Last used date
- Partial token display (first 12 characters)
Revoking Tokens
To revoke a token:- Go to Settings
- Find the token in the list
- Click the trash icon
- Confirm deletion
Security Best Practices
✅ Do’s
- Store tokens in environment variables
- Use different tokens for different environments (dev, staging, production)
- Rotate tokens regularly
- Revoke tokens immediately if compromised
- Use secret management services (AWS Secrets Manager, HashiCorp Vault, etc.)
❌ Don’ts
- Never commit tokens to version control
- Never share tokens via email or chat
- Never log tokens in plain text
- Never use production tokens in development
- Never hard-code tokens in your application
Error Responses
401 Unauthorized
Missing or invalid token:- Token not provided in Authorization header
- Token format is incorrect
- Token has been revoked
- Token doesn’t exist
- Verify your token is correct
- Check the Authorization header format
- Generate a new token if necessary
429 Too Many Requests
Rate limit exceeded:CI/CD Integration
GitHub Actions
Store your token as a secret:.github/workflows/sync-tokens.yml
GitLab CI
.gitlab-ci.yml
Rate Limiting
Each API token is subject to rate limiting:- 100 requests per minute per token
- Rate limit resets every 60 seconds
- Headers include rate limit information