Overview
The Authorization endpoints handle authentication and authorization for the Digitzs API. A two-step process is required:- Generate an app key using your API credentials
- Create an access token using the app key
Access tokens expire after one hour and must be refreshed regularly.
Authorization Flow
Endpoints
Create API Key
Generate an app key for token creation
POST /auth/keyCreate App Token
Generate an access token (expires in 1 hour)
POST /auth/tokenQuick Start
Step 1: Create App Key
Step 2: Create App Token
Step 3: Use Token in Requests
Best Practices
Secure Storage
Secure Storage
Store your API key and app key securely:
- Use environment variables
- Never commit credentials to version control
- Use secret management services in production
Token Caching
Token Caching
Cache access tokens and reuse them:
- Tokens are valid for 1 hour
- Track token expiration time
- Refresh tokens proactively before expiration
Error Handling
Error Handling
Implement robust error handling:
- Catch 401 errors and refresh tokens automatically
- Implement retry logic with exponential backoff
- Log authentication failures for monitoring
Key Rotation
Key Rotation
Rotate app keys periodically:
- Creating a new app key invalidates the old one
- Plan key rotation during low-traffic periods
- Update all services using the old key
Common Issues
Token Format: The Authorization header must be formatted as
Bearer {token} with:- A capital “B” in “Bearer”
- A space between “Bearer” and your token
Token Expiration: Implement automatic token refresh 5 minutes before expiration to avoid service interruptions.
Security Considerations
HTTPS Only
Always use HTTPS for API requests to protect credentials in transit
Credential Rotation
Rotate API keys and app keys regularly as part of security best practices
Limited Scope
Use separate API keys for different environments (dev, staging, production)
Monitoring
Monitor authentication failures and unusual access patterns
Next Steps
1
Get Credentials
Contact Digitzs to receive your API key and application ID
2
Test Authentication
Follow the quick start guide to test the authentication flow
3
Implement Token Management
Build token caching and refresh logic into your application
4
Start Using the API
Begin making authenticated requests to other endpoints

