Skip to main content
Every request needs two pieces: an API key and an organization id. The API key alone is not sufficient — the auth layer keys auth records by (org_id, api_key_hash) and can’t reverse-lookup the org from the key without scanning.

Get your credentials

Both values come from the XTrace web app:
  1. Sign in at app.xtrace.ai
  2. Open Settings → API Keys (or your organization page)
  3. Copy your Org id and create a new API key (xtk_…)
Treat the API key like a password — anyone with it can read and write memories under your org. Store it in a secrets manager or environment variable, never in source control.

Headers

Both required on every request. Missing or mismatched values:

Using the SDK

The SDK builds both headers from constructor options:
That’s it — every method call on the client carries the right headers.

Storing credentials

Never commit API keys to source control. Use environment variables, a secrets manager (AWS Secrets Manager, GCP Secret Manager, 1Password CLI), or a .env file that’s in .gitignore.
A typical setup:
.env

Rotating a key

If a key leaks, treat it like any other credential incident:
  1. Issue a new key from your org admin tool
  2. Roll the new key into your environment / secrets manager
  3. Revoke the old key
Keys are long-lived; there is no automatic expiry in v1.

Browser vs server

The SDK works in both Node 18+ and modern browsers (it uses native fetch). Don’t ship API keys to a browser — proxy memory-API calls through your own backend so the key never leaves the server.