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.