Authentication
How to authenticate with the NomadicML API
Authentication
To use the NomadicML API, you need to authenticate your requests using an API key. This page explains how to obtain and use API keys with both the SDK and direct API calls.
Obtaining an API Key
You can generate API keys from the NomadicML web platform:
- Log in to your account at drivemonitor.nomadicml.com
- Navigate to your profile by clicking your avatar in the top-right corner
- Select API Keys from the menu
- Click Generate New Key
- Enter a name for your key (to help you identify its purpose later)
- Select the expiration period (default is 90 days)
- Click Create Key
The full API key is only shown once when generated. Make sure to copy and store it securely. If you lose your key, you’ll need to generate a new one.
API Key Security
Follow these best practices to keep your API keys secure:
- Never share your API keys publicly
- Don’t commit API keys to source code repositories
- Use environment variables or secure secret management tools
- Set appropriate expiration dates for your keys
- Rotate keys periodically
- Create separate keys for different applications or environments
Using API Keys with the SDK
When using the NomadicML Python SDK, provide your API key when initializing the client:
API Key in HTTP Requests
For direct API calls, include your API key in the request headers:
Example using curl:
Example using JavaScript fetch:
Verifying Authentication
To verify that your API key is valid and working correctly, use the verification endpoint:
SDK Method:
HTTP Request:
A successful response will include basic information about your account and API key permissions.
API Key Permissions
API keys can have different permission scopes:
- read: Access to view videos and analysis results
- write: Permission to upload videos and modify resources
- admin: Full access to all API functionality
By default, new API keys have read and write permissions. If you need admin permissions, contact NomadicML support.
Managing API Keys
You can manage your API keys through the web platform:
Viewing Keys
The API Keys page shows all your current keys, including:
- Name
- Key prefix (first 8 characters)
- Creation date
- Expiration date
- Last used date
- Status (active/inactive)
Revoking Keys
To revoke an API key:
- Go to the API Keys page
- Find the key you want to revoke
- Click the Revoke button
- Confirm the action
Once revoked, a key cannot be reactivated. You’ll need to generate a new key if needed.
Troubleshooting
Common authentication issues:
Invalid API Key
If you receive a 401 Unauthorized error:
- Double-check that you’re using the correct API key
- Verify the key hasn’t expired
- Check if the key has been revoked
Missing API Key
If you receive a 403 Forbidden error:
- Ensure you’ve included the API key in the request headers
- Check the header format is correct (
X-API-Key: your_api_key
)
Permission Issues
If you receive a 403 Forbidden error with an authorization message:
- Verify that your API key has the necessary permissions for the operation
- Contact NomadicML support if you need additional permissions
Next Steps
Now that you understand authentication, explore the API endpoints: