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 guide 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.
Using API Keys with the SDK
When using the NomadicML Python SDK, provide your API key when initializing the client:
Advanced Configuration
You can customize the SDK’s behavior with additional parameters:
Configuration Parameters
Parameter | Default | Description |
---|---|---|
api_key | None | Your NomadicML API key (required) |
base_url | "https://fdixgrmuam.us-west-2.awsapprunner.com" | API endpoint URL |
timeout | 30 | Request timeout in seconds |
API Key in HTTP Requests
For direct API calls (not using the SDK), include your API key in the request headers:
Example using curl:
Verifying Authentication
To verify that your API key is valid and working correctly, use the verification endpoint:
SDK Method:
HTTP Request:
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
Troubleshooting
Common authentication issues:
Invalid API Key
If you receive an AuthenticationError
:
- Double-check that you’re using the correct API key
- Verify the key hasn’t expired
- Check if the key has been revoked
Connection Issues
If you’re unable to connect to the API:
- Verify your internet connection
- Check if you’re behind a firewall that blocks outgoing connections
- Try using a different network
Next Steps
Now that you understand authentication, explore the API endpoints: