Skip to main content
The Elementary Python SDK uses API key authentication to securely send data to Elementary Cloud.

Getting Your Credentials

Generate an Access Token

You can generate tokens directly from the Elementary UI:
  1. Go to User → Personal Tokens or Account → Account Tokens
  2. Click Generate token
  3. (Optional) Add a name/description for the token
  4. Copy the token and store it securely — it is shown only once

Required Credentials

You’ll need the following:
  • Project ID - Your Python project identifier (this will appear in the metadata of the assets you report)
  • API Key - Your API token (generated from the steps above)
  • URL - The full SDK ingest endpoint URL: {base_url}/sdk-ingest/{env_id}/batch
The same token generation process is used for other Elementary integrations. See the MCP Setup Guide for more details.

Configuring Authentication

Using the Client

When initializing the ElementaryCloudClient, provide your credentials:
from elementary_python_sdk.core.cloud.cloud_client import ElementaryCloudClient

PROJECT_ID = "my-python-project"  # Your Python project identifier (used to deduplicate and identify assets)
API_KEY = "your-api-token"
URL = "https://app.elementary-data.com/sdk-ingest/{env_id}/batch"

client = ElementaryCloudClient(PROJECT_ID, API_KEY, URL)
Note:
  • The URL parameter should be the full endpoint URL including the environment ID. Replace {env_id} with your actual environment ID.
  • PROJECT_ID is your Python project identifier (chosen by you, used to deduplicate and identify reported assets in Elementary Cloud).

Using Environment Variables

For better security, use environment variables:
import os
from elementary_python_sdk.core.cloud.cloud_client import ElementaryCloudClient

PROJECT_ID = os.getenv("ELEMENTARY_PROJECT_ID")
API_KEY = os.getenv("ELEMENTARY_API_KEY")
URL = os.getenv("ELEMENTARY_URL")  # Full endpoint URL: https://app.elementary-data.com/sdk-ingest/{env_id}/batch

client = ElementaryCloudClient(PROJECT_ID, API_KEY, URL)
Set the environment variables:
export ELEMENTARY_PROJECT_ID="your-project-id"
export ELEMENTARY_API_KEY="your-api-token"
export ELEMENTARY_URL="https://app.elementary-data.com/sdk-ingest/{env_id}/batch"

Using a Configuration File

You can also store credentials in a configuration file (not recommended for production):
import json
from elementary_python_sdk.core.cloud.cloud_client import ElementaryCloudClient

with open("elementary_config.json") as f:
    config = json.load(f)

client = ElementaryCloudClient(
    config["project_id"],
    config["api_key"],
    config["url"]  # Full endpoint URL
)

Security Best Practices

Never commit API tokens to version control. Always use environment variables or secrets management systems.
  1. Use environment variables - Store tokens in environment variables, not in code
  2. Use secrets management - For production, use services like AWS Secrets Manager, HashCorp Vault, or similar
  3. Rotate tokens regularly - Periodically rotate your API tokens for better security
  4. Limit token scope - Create API tokens with minimal required permissions
  5. Monitor usage - Regularly check API token usage in your Elementary Cloud account

Troubleshooting

401 Unauthorized

If you receive a 401 error:
  • Verify your API token is correct
  • Check that the token hasn’t been revoked
  • Ensure you’re using the correct URL

404 Not Found

If you receive a 404 error:
  • Verify your URL is correct and includes the correct environment ID
  • Check that the environment exists in your Elementary Cloud account
  • Ensure you have access to the environment