REST API overview
How the app talks to the server in the browser, and how Pro workspaces call Linktrap from scripts.
You do not need to read this page to use Linktrap in the web UI — the dashboard and create flow call the APIs for you. Use this when you integrate from code or debug auth errors.
Base URL
All paths are relative to your deployment origin, e.g. https://your.app.
Authentication modes
| Surface | Auth | Notes |
|---|---|---|
/api/links | Clerk session cookie | Browser or same-origin fetch with credentials. |
/api/links/[id] | Clerk session | PATCH/DELETE only for links in your workspace. |
/api/generate-meta | Clerk session | OpenAI + optional Blob; costs accrue to your keys. |
/api/stripe/checkout, portal | Clerk session | Creates Stripe URLs for the signed-in user's workspace. |
/api/stripe/webhook | Stripe signature | No Clerk; verify STRIPE_WEBHOOK_SECRET. |
/api/v1/links | Authorization: Bearer lt_… | Pro workspace API key; see below. |
/api/workspace/api-keys | Clerk session | Pro only; create/list/revoke keys. |
/api/workspace/custom-domains | Clerk session | Pro only; register hostnames. |
Rate limiting & quota
POST /api/links (and v1 create) apply per-minute rate limits and monthly workspace quotas on the free plan. Errors return 429 or 403 with JSON error messages.
Full v1 reference
Request/response shapes and examples: API v1 reference.