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.
# 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.
REST in 60 seconds
A key and a curl.
- 01
Create an API key
Open Settings → API Keys and generate a token. It looks like opn_… and is shown once.
- 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.
- 03
Shorten, measure, automate
Create links, read analytics and render QR codes straight from your code, CI or cron.
# 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.”
{
"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.
/linksShorten a URL — custom alias, password, expiry, click cap, routing.
/linksList every link on your account, with live click counts.
/links/:idUpdate a link — destination, alias, limits or rules.
/links/:idDelete a link and stop its redirect.
/links/:id/statsFirst-party click analytics — geo, device, referrer, timeline.
/links/:id/qrBranded QR for a link — brand colour + logo, PNG or SVG.
/links/health-checkCheck 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.

