trak.sh docs
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

  1. Sign in to trak.sh
  2. Go to Settings
  3. Click Generate API Key
  4. 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/links

Security

  • 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

StatusResponseMeaning
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)

On this page