Build on opn.onl

Your links,
now programmable.

A clean REST API and an official MCP server. Shorten, measure and manage links from your own code — or hand the keys to your AI assistant. Same API, hosted or self-hosted.

shorten.sh
# one POST. one short link.
curl -X POST https://l.opn.onl/links \
  -H "Authorization: Bearer opn_•••" \
  -H "Content-Type: application/json" \
  -d '{"original_url":"https://example.com"}'

 { "short_url": "https://l.opn.onl/abc123" }

Two ways in

Write code, or speak to it.

Every account ships with both. A plain HTTPS API for your services, and a Model Context Protocol server so assistants like Claude can manage links for you.

REST API

JSON over HTTPS, authenticated with a personal API key. Create and manage links, pull analytics, generate QR codes. Fully documented with OpenAPI.

MCP server

The opn-mcp server exposes your account to AI assistants over the Model Context Protocol — seven tools, zero glue code. Listed in the official MCP registry.

REST in 60 seconds

A key and a curl.

  1. 01

    Create an API key

    Open Settings → API Keys and generate a token. It looks like opn_… and is shown once.

  2. 02

    Send it as a Bearer token

    Pass Authorization: Bearer opn_… on every request. The same key works for every endpoint your account can reach.

  3. 03

    Shorten, measure, automate

    Create links, read analytics and render QR codes straight from your code, CI or cron.

bash
# Create a key under Settings → API Keys, then:
export OPN_API_KEY="opn_your_api_key"

curl -X POST https://l.opn.onl/links \
  -H "Authorization: Bearer $OPN_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
        "original_url": "https://example.com/a/very/long/link",
        "custom_code": "launch"
      }'

# → { "short_url": "https://l.opn.onl/launch", "code": "launch" }

Let your assistant drive

Add the MCP server in one block.

Drop this into your MCP client config (Claude Desktop, Cursor, and friends). npx fetches opn-mcp — no install, no build. Then just ask: “shorten this and show me the clicks.”

shorten_urllist_linksget_link_statsupdate_linkdelete_linkget_qr_codecheck_url_health
claude_desktop_config.json
{
  "mcpServers": {
    "opn": {
      "command": "npx",
      "args": ["-y", "opn-mcp"],
      "env": {
        "OPN_API_KEY": "opn_your_api_key"
      }
    }
  }
}

Self-hosting? Add "OPN_BASE_URL": "https://links.yourdomain.com" to point it at your own instance.

The surface

Endpoints you’ll reach for.

The essentials are below. The full contract — every field, every response — lives in the interactive API reference.

POST/links

Shorten a URL — custom alias, password, expiry, click cap, routing.

GET/links

List every link on your account, with live click counts.

PUT/links/:id

Update a link — destination, alias, limits or rules.

DELETE/links/:id

Delete a link and stop its redirect.

GET/links/:id/stats

First-party click analytics — geo, device, referrer, timeline.

GET/links/:id/qr

Branded QR for a link — brand colour + logo, PNG or SVG.

POST/links/health-check

Check a destination is reachable before you share it.

Same API on your own metal.

Nothing here is tied to our servers. Host opn.onl yourself and point your code at your own base URL, or set OPN_BASE_URL for the MCP server. Same keys, same endpoints, same tools — your infrastructure.

Ship your first
short link in a minute.

Generate a key, copy the curl, and you’re live. Free, open source, and yours to host.