URL Shortener API

Shorten any URL and get click tracking stats. Supports custom slugs. Payment via x402 — no API key required.

POST https://pylon-url-shortener-api.fly.dev/shorten

Endpoints

MethodPathDescriptionPayment
POST/shortenCreate a short URL$0.002
GET/s/:idRedirect to original URLFree
GET/stats/:idGet click statsFree
GET/healthHealth checkFree

Parameters

Send a JSON body to POST /shorten:

FieldTypeRequiredDescription
urlstringYesThe URL to shorten (http or https)
custom_slugstringNoCustom short ID (alphanumeric, hyphens, underscores, 1-64 chars)

Response

{
  "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"
}

Pricing

$0.002 USDC per shorten request — redirects and stats are free.

Code Examples

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