The TracePilot SDK requires only an API key to get started. Beyond that, you can point the SDK at a self-hosted ingest server and take advantage of TypeScript’s type system to catch configuration mistakes at compile time. This page covers all configuration options and the recommended patterns for each.Documentation Index
Fetch the complete documentation index at: https://tracepilot.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
API key
Your API key authenticates every request the SDK sends to the TracePilot ingest endpoint. Keys always begin withtp_live_. Retrieve yours from the TracePilot dashboard.
Recommended pattern
Store the key in an environment variable namedTRACEPILOT_API_KEY and reference it with process.env:
! non-null assertion tells TypeScript you have verified the variable is set. For stricter runtime validation, check the value explicitly:
Loading with dotenv
.env file:
.env
Custom ingest endpoint
By default, the SDK sends trace data to the TracePilot cloud. If you run a self-hosted TracePilot server, pass your server’s ingest URL as the second argument to the constructor:TypeScript setup
The SDK ships with full TypeScript types. No additional@types packages are required. Install the SDK and you’re ready:
strictNullChecks in your tsconfig.json:
tsconfig.json
strict mode enabled, TypeScript will warn you if process.env.TRACEPILOT_API_KEY could be undefined, prompting you to add the runtime check shown above.
Environment variable reference
| Variable | Required | Description |
|---|---|---|
TRACEPILOT_API_KEY | Yes | Your tp_live_... API key from the dashboard. |
TRACEPILOT_ENDPOINT | No | Custom ingest URL for self-hosted deployments. |