Shorten any URL and get click tracking stats. Supports custom slugs. Payment via x402 — no API key required.
| Method | Path | Description | Payment |
|---|---|---|---|
POST | /shorten | Create a short URL | $0.002 |
GET | /s/:id | Redirect to original URL | Free |
GET | /stats/:id | Get click stats | Free |
GET | /health | Health check | Free |
Send a JSON body to POST /shorten:
| Field | Type | Required | Description |
|---|---|---|---|
url | string | Yes | The URL to shorten (http or https) |
custom_slug | string | No | Custom short ID (alphanumeric, hyphens, underscores, 1-64 chars) |
{
"id": "BFIBLUoa",
"short_url": "https://pylon-url-shortener-api.fly.dev/s/BFIBLUoa",
"original_url": "https://example.com/very/long/path",
"created_at": "2026-02-17T18:00:00.000Z"
}
$0.002 USDC per shorten request — redirects and stats are free.
curl -X POST "https://pylon-url-shortener-api.fly.dev/shorten" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/very/long/path"}'
import { wrapFetch } from "@x402/fetch";
const fetchWithPayment = wrapFetch(fetch, wallet);
const res = await fetchWithPayment(
"https://pylon-url-shortener-api.fly.dev/shorten",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ url: "https://example.com" }),
}
);
const data = await res.json();
console.log(data.short_url);