Getting Your API Credentials
Before initializing the client, you need to obtain your API credentials from Elementary Cloud.Generate an Access Token
You can generate tokens directly from the Elementary UI:- Go to User → Personal Tokens or Account → Account Tokens
- Click Generate token
- (Optional) Add a name/description for the token
- Copy the token and store it securely — it is shown only once
Security
- User tokens are user-scoped bearer tokens and inherit your workspace permissions
- Account tokens are account-scoped bearer tokens with “Can View” permissions
- Treat tokens like passwords — do not share or commit them to version control
- Keep them secret, rotate regularly, and revoke immediately if compromised
Client Initialization
The SDK usesElementaryCloudClient to send data to Elementary Cloud:
project_idis your Python project identifier (chosen by you, used to deduplicate and identify reported assets)api_keyis your API token (generated from the steps above)urlis the full SDK ingest endpoint URL:{base_url}/sdk-ingest/{env_id}/batch- Example:
https://app.elementary-data.com/sdk-ingest/a6b2425d-36e2-4e13-8458-9825688ca1f2/batch
- Example:
Test Context
Tests are run within anelementary_test_context which automatically captures test results:
Test Decorators
The SDK provides decorators to define tests:@boolean_test- For tests that return True/False (pass/fail)@expected_range- For tests that return numeric values within a range@expected_values- For tests that return values matching a list of expected values@row_count- For tests that return a Sized object (DataFrame, list, etc.) to check row count
Context Manager Approach
You can also use context managers for inline tests:Supported Objects
The SDK supports three types of objects:Table Assets
Register tables and views in your data warehouse
Tests
Define data quality tests
Test Executions
Report test execution results
Sending Results
After running tests in a context, send results to Elementary Cloud:Error Handling
The SDK handles errors automatically, but you can wrap calls in try-except blocks:Best Practices
- Run multiple tests in one context - All tests in a single
elementary_test_contextare automatically batched - Use descriptive test names - Clear names help identify tests in the Elementary UI
- Include asset metadata - Add descriptions, owners, tags, and dependencies to assets
- Handle errors gracefully - Wrap
send_to_cloudcalls in try-except blocks
Next Steps
- Test Decorators - Complete reference for all test decorators
- Table Assets - Learn about table asset structure
- Tests - Understand test definitions
- Test Executions - See how to report test results

