Trainly supports two authentication modes depending on your use case.
API Key Authentication
Recommended for most users. API keys are the primary authentication method for sending traces to Trainly.
Getting Your API Key
- Open the Trainly Dashboard
- Navigate to your project settings
- Copy your API Key (starts with
tk_) and Project ID (starts with proj_)
Python SDK
Or set environment variables:
React SDK
Security Best Practices
Never commit API keys to source control. Always use environment variables.
- Store keys in environment variables (
TRAINLY_API_KEY)
- Use
.env files locally and secrets managers in production
- Keep API keys server-side whenever possible — avoid exposing them in client-side bundles
- Rotate keys regularly from the dashboard settings page
- Use separate keys for development and production environments
V1 OAuth Authentication
Use V1 OAuth when you are building a multi-user application and need:
- Per-user data isolation — each user’s traces are scoped to their identity
- Embedded Trainly in your product — end-users authenticate with your existing auth provider
Supported Providers
React SDK
Python SDK
Feature Limitations
V1 OAuth mode has some restrictions compared to API key authentication:
Choosing an Auth Mode