API Documentation

The API runs locally at http://localhost:5043.

Endpoints

Method Route Authentication Purpose
GET /api/health Public Returns API health status.
GET /api/urls Clerk JWT Lists links owned by the current user.
POST /api/urls Clerk JWT Creates a short link.
GET /api/urls/{code} Clerk JWT Reads an owned link.
GET /u/{code} Public Redirects to the original URL.

POST /api/urls accepts JSON with an originalUrl and optional customCode.

{
  "originalUrl": "https://example.com/a/long/path",
  "customCode": "example-link"
}

Rules:

A successful request returns 201 Created with the created short-link response.

Authentication

Private endpoints require a Clerk JWT. The API accepts the token through the standard Authorization: Bearer <token> header. It also supports X-Clerk-Session-Token, which the API converts to a bearer token for validation.

The API scopes list and individual-link operations to the authenticated user’s sub claim.

Responses

Back to documentation home