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:

  1. Log in to your account at drivemonitor.nomadicml.com
  2. Navigate to your profile by clicking your avatar in the top-right corner
  3. Select API Keys from the menu
  4. Click Generate New Key
  5. Enter a name for your key (to help you identify its purpose later)
  6. Select the expiration period (default is 90 days)
  7. 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:

from nomadicml import NomadicML

# Initialize the client with your API key
client = NomadicML(api_key="your_api_key")

# Verify authentication
auth_info = client.verify_auth()
print("Authentication successful:", auth_info)

Advanced Configuration

You can customize the SDK’s behavior with additional parameters:

client = NomadicML(
    api_key="your_api_key",
    base_url="https://custom-endpoint.example.com",  # Custom API endpoint
    timeout=60,  # Custom timeout in seconds
)

Configuration Parameters

ParameterDefaultDescription
api_keyNoneYour NomadicML API key (required)
base_url"https://fdixgrmuam.us-west-2.awsapprunner.com"API endpoint URL
timeout30Request timeout in seconds

API Key in HTTP Requests

For direct API calls (not using the SDK), include your API key in the request headers:

X-API-Key: your_api_key

Example using curl:

curl -X GET "https://fdixgrmuam.us-west-2.awsapprunner.com/api/video/status/12345" \
  -H "X-API-Key: your_api_key"

Verifying Authentication

To verify that your API key is valid and working correctly, use the verification endpoint:

SDK Method:

auth_info = client.verify_auth()
print(auth_info)

HTTP Request:

curl -X POST "https://fdixgrmuam.us-west-2.awsapprunner.com/api/keys/verify" \
  -H "X-API-Key: your_api_key"

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
try:
    client = NomadicML(api_key="invalid_key")
    client.verify_auth()
except AuthenticationError as e:
    print(f"Authentication failed: {e}")

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: