Documentation Index
Fetch the complete documentation index at: https://docs.zuba.com/llms.txt
Use this file to discover all available pages before exploring further.
Overview
The Zuba API uses OAuth 2.0 Client Credentials flow for secure M2M (machine-to-machine) authentication. You’ll exchange your Client ID and Client Secret for a short-lived JWT access token, which you’ll use to authenticate API requests.Getting Your API Credentials
Step 1: Generate Credentials
- Log in to your Zuba Dashboard (use
dash-test.zuba.comfor test environment) - Navigate to API Settings
- Click Generate API Key or Create API Credentials
- Important: Copy and save your credentials immediately - you won’t be able to see the Client Secret again!
- Client ID: Your application’s public identifier (e.g.,
ao6CMrtuM0pdUtAbcYRr5nlJCma90B2S) - Client Secret: Your application’s secret key (e.g.,
aS-abvckfP2ZoDh9...) - Token URL: Auth0 endpoint to exchange credentials for tokens (e.g.,
https://zuba-test.us.auth0.com/oauth/token) - Audience: API identifier (typically
https://api.zuba.com)
Authentication Flow
Step 2: Request an Access Token
Exchange your Client ID and Client Secret for a JWT access token:access_token is a JWT that’s valid for 24 hours (86400 seconds). You’ll need to request a new token when it expires.
Step 3: Use the Access Token
Include the access token in theAuthorization header of every API request:
Token Management
Token Expiration
Access tokens expire after 24 hours. Implement token caching and refresh logic to avoid requesting a new token for every API call:Example: Token Cache
Environments
Zuba provides separate environments for development and production:| Environment | Dashboard | Token URL | API Base URL |
|---|---|---|---|
| Test | https://dash-test.zuba.com | https://zuba-test.us.auth0.com/oauth/token | https://api-test.zuba.com |
| Production | https://dash.zuba.com | https://zuba.us.auth0.com/oauth/token | https://api.zuba.com |
Always test with the Test environment before moving to production. Use separate credentials for each environment.
Authentication Errors
Token Request Errors
| Error | Cause | Solution |
|---|---|---|
access_denied / Unauthorized | Invalid Client ID or Client Secret | Verify credentials are correct and not expired |
invalid_grant | Invalid grant_type | Ensure grant_type is “client_credentials” |
invalid_audience | Wrong audience value | Use the correct audience for your environment |
API Request Errors
| HTTP Status | Error | Cause | Solution |
|---|---|---|---|
401 | Unauthorized | Missing, invalid, or expired token | Request a new access token and retry |
403 | Forbidden | Token lacks required permissions | Contact support to verify account permissions |
Security Best Practices
Environment Variables
Environment Variables
Never hardcode credentials in your application code. Use environment variables:
.env
HTTPS Only
HTTPS Only
Always use HTTPS for both token requests and API calls. Never send credentials or tokens over HTTP.
Credential Rotation
Credential Rotation
Regularly rotate your credentials:
- Generate new credentials in the dashboard
- Update your environment variables
- Deploy the changes
- Delete the old credentials in the dashboard
Token Storage
Token Storage
- Store tokens in memory, not in databases or files
- Never log tokens in application logs
- Clear tokens when they expire
- For serverless environments, request a new token for each execution (they’re cached by Auth0)
Least Privilege
Least Privilege
Request only the permissions your application needs. Contact support to configure specific scopes for your credentials.
Testing Authentication
Test your authentication setup before making actual API calls:Next Steps
Quickstart Guide
Start making your first API calls
API Reference
Explore all available endpoints