Overview
The Contazen API uses Bearer token authentication. All API requests must include a valid API key in theAuthorization
header.
API Keys
Key Type
Live Keys
Format:
sk_live_
+ 24 charactersUse for production. All actions affect real data and can’t be undone.Creating API Keys
1
Access API Settings
Log in to your Contazen account and navigate to Settings → API Keys
2
Create New Key
Click “Create New API Key” and configure:
- Name: Identify your key (e.g., “Production Server”)
- Permissions: Select required scopes
- IP Restrictions: Optionally limit to specific IPs
3
Copy Your Key
Your secret key will only be shown once. Store it securely in your environment variables.
Testing in Documentation
To test API endpoints directly in this documentation:
- Navigate to any API endpoint page (e.g., List Clients)
- Look for the “Try it” section
- In the Authorization field, enter:
Bearer sk_live_YOUR_API_KEY
- Fill in any required parameters
- Click “Send Request” to test with real data
Making Authenticated Requests
Include your API key in theAuthorization
header:
Security Best Practices
Use Environment Variables
Use Environment Variables
Never hardcode API keys in your source code. Use environment variables instead:
Implement IP Restrictions
Implement IP Restrictions
Limit API key usage to specific IP addresses:
- Single IP:
192.168.1.1
- CIDR range:
192.168.1.0/24
- Multiple IPs: Add one per line
Rotate Keys Regularly
Rotate Keys Regularly
Create a rotation schedule:
- Create new API key
- Update your application
- Monitor for issues
- Revoke old key after confirming
Multi-Work-Point Access
API keys have access to all work points (branches) within the same parent company. This allows you to manage data across multiple locations with a single API key.
work_point_id
parameter:
Authentication Errors
When authentication fails, you’ll receive a401 Unauthorized
response:
Common Error Codes
Code | Description | Solution |
---|---|---|
missing_api_key | No Authorization header | Include the header |
invalid_api_key | Key doesn’t exist | Check your key |
expired_api_key | Key has expired | Create a new key |
ip_restricted | Request from unauthorized IP | Update IP whitelist |
insufficient_permissions | Key lacks required scope | Update key permissions |
Testing Authentication
Verify your setup with this simple test:Troubleshooting
Headers Not Received
Headers Not Received
Some servers strip the Authorization header. Add to
.htaccess
:CORS Issues
CORS Issues
For browser requests, the API includes CORS headers:
Need Help?
If you’re having authentication issues:- Double-check your API key
- Verify you’re using a valid API key
- Check rate limits
- Review IP restrictions
- Contact support with your request ID