API Reference
API Reference
Programmatic access to trak.sh via REST API. Pro plan required.
Overview
The trak.sh API lets you create, list, delete links and fetch analytics programmatically. All endpoints require a Pro plan and API key authentication.
Base URL: https://trak.sh/api/v1
Endpoints
| Method | Path | Description |
|---|---|---|
| POST | /api/v1/links | Create a link |
| GET | /api/v1/links | List your links |
| DELETE | /api/v1/links/:slug | Delete a link |
| GET | /api/v1/links/:slug/analytics | Get analytics |
Authentication
All requests require a Bearer token in the Authorization header:
Authorization: Bearer trak_YOUR_API_KEYSee Authentication for setup details.
Rate limits
API requests are not currently rate-limited for Pro users. This may change in the future.
Errors
All error responses follow this format:
{
"error": "Human-readable error message"
}| Status | Meaning |
|---|---|
| 400 | Invalid request (bad URL, invalid slug format) |
| 401 | Missing or invalid API key |
| 404 | Link not found |
| 409 | Slug already taken |
| 500 | Server error |