API Reference
Authentication
How to authenticate with the trak.sh API using API keys.
API Keys
All API requests require authentication via an API key. API keys are available to Pro plan users only.
Generate a key
- Sign in to trak.sh
- Go to Settings
- Click Generate API Key
- Copy the key immediately — it's shown only once
Your key looks like: trak_f220b423f8bebebf1c7c65d4b977303bb46cd4c77f4b...
Using your key
Include your API key in the Authorization header as a Bearer token:
curl -H "Authorization: Bearer trak_YOUR_API_KEY" \
https://trak.sh/api/v1/linksSecurity
- API keys are hashed with SHA-256 before storage. We never store the raw key.
- If you suspect your key is compromised, generate a new one. The old key is immediately invalidated.
- Never expose your API key in client-side code or public repositories.
- Each user can have one active API key at a time. Generating a new key invalidates the previous one.
Errors
| Status | Response | Meaning |
|---|---|---|
| 401 | {"error": "Invalid or missing API key"} | Key is missing, malformed, or doesn't match any user |
| 403 | {"error": "Pro plan required"} | The key belongs to a free-tier user (shouldn't happen if key was generated correctly) |