QLK

QLK documentation

QLK is a URL shortening service built to work with AI agents. Agents can create and manage links, read link analytics, and read every link.

Everything here works the same for a person and for an agent. The REST API and the MCP server share one set of API keys and return the same link objects.

Quickstart

  1. Create an account.
  2. Open API keys in the dashboard and create a key. Copy it: it is shown once.
  3. Create your first link:
curl -X POST https://qlk.app/api/v1/links \
  -H "Authorization: Bearer qlk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/spring-sale", "title": "Spring sale", "description": "Landing page for the spring sale."}'

The response is the new link:

{
  "id": "lnk_8f3k2n5q7r9t1v4x",
  "slug": "k7Xp2Qm",
  "short_url": "https://qlk.app/k7Xp2Qm",
  "url": "https://example.com/spring-sale",
  "title": "Spring sale",
  "description": "Landing page for the spring sale.",
  "clicks": 0,
  "expires_at": null,
  "created_at": "2026-11-21T10:00:00.000Z",
  "updated_at": "2026-11-21T10:00:00.000Z"
}

Authentication

Send your API key as a bearer token on every request to the REST API and the MCP server:

Authorization: Bearer qlk_your_api_key

A key acts as the account that created it. Revoke a key in the dashboard to cut off any agent using it. Requests without a valid key get 401 with the error code unauthorized.

Connect an agent with MCP

QLK runs a Model Context Protocol server over Streamable HTTP at https://qlk.app/api/mcp.

Claude Code:

claude mcp add --transport http QLK https://qlk.app/api/mcp --header "Authorization: Bearer qlk_your_api_key"

Any client that reads an mcpServers config (Claude Desktop, Cursor, VS Code and others):

{
  "mcpServers": {
    "QLK": {
      "type": "http",
      "url": "https://qlk.app/api/mcp",
      "headers": { "Authorization": "Bearer qlk_your_api_key" }
    }
  }
}

Tools

Tool What it does
create_link Shorten a URL. Takes url and optional slug, title, description, expires_at.
list_links List links, newest first. Takes optional limit, cursor, search.
get_link Fetch one link by id or slug.
update_link Change destination, title, description or expiry.
delete_link Delete a link and its click history. Cannot be undone.
get_link_analytics Read click analytics for a link over the last days days.

Tools take a link argument that accepts either the id (lnk_...) or the slug.

Field Type Notes
id string Stable identifier, starts with lnk_.
slug string The path of the short link. 3-32 letters, digits, hyphens or underscores. Case-sensitive. Cannot change.
short_url string The link to share.
url string Destination. Must be http or https, up to 2048 characters.
title string or null Up to 200 characters.
description string or null Up to 500 characters. Shown to agents that read the link.
clicks integer Followed redirects since the link was created.
expires_at string or null ISO 8601. After this time the link answers 410.
created_at, updated_at string ISO 8601, UTC.

Wherever a path takes {link}, pass the id or the slug.

POST /links

Body field Required Notes
url yes Destination URL.
slug no Custom slug. Omit to get a generated 7-character slug.
title no
description no
expires_at no ISO 8601 time with offset, in the future.

Returns 201 with the link. Returns 409 slug_taken if the slug is in use.

GET /links?limit=20&cursor=...&search=...

Newest first. limit is 1-100 (default 20). search matches slug, URL or title. The response is { "links": [...], "next_cursor": "..." }. Pass next_cursor back as cursor for the next page; null means there are no more.

GET /links/{link}

PATCH /links/{link}

Send any of url, title, description, expires_at. Send null to clear title, description or expires_at. The slug cannot change, so a shared link never moves.

curl -X PATCH https://qlk.app/api/v1/links/k7Xp2Qm \
  -H "Authorization: Bearer qlk_your_api_key" \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com/summer-sale"}'

DELETE /links/{link}

Deletes the link and its click history. The short link answers 404 from then on. Returns { "id": "lnk_...", "deleted": true }.

Analytics

GET /links/{link}/stats?days=30

days is 1-365 (default 30). Days are UTC calendar days and the window includes today.

{
  "link": { "id": "lnk_8f3k2n5q7r9t1v4x", "slug": "k7Xp2Qm", "...": "..." },
  "period": { "days": 30, "from": "2026-10-23", "to": "2026-11-21", "timezone": "UTC" },
  "total_clicks": 128,
  "visitors": { "human": 97, "ai_agent": 22, "bot": 9 },
  "timeseries": [{ "date": "2026-10-23", "clicks": 3 }],
  "top_referrers": [{ "referrer": "news.ycombinator.com", "clicks": 41 }],
  "top_countries": [{ "country": "US", "clicks": 60 }],
  "top_agents": [{ "agent": "ClaudeBot", "clicks": 12 }]
}
  • visitors splits clicks by who followed the link. ai_agent covers AI crawlers and AI assistants fetching for a person, recognised by user agent. bot covers other automated clients such as link previewers and scripts.
  • top_agents names the AI agents and bots that were recognised.
  • top_countries uses two-letter country codes and is filled in only where the hosting platform reports a country.
  • A click record holds a time, visitor type, agent name, device class, referring host and country. It holds no IP address and no full user agent.

A short link normally answers with a 302 redirect. An agent can read the link instead of following it. Reading is public, needs no API key and does not count as a click.

Ask for JSON, with a header or a suffix:

curl -H "Accept: application/json" https://qlk.app/k7Xp2Qm
curl https://qlk.app/k7Xp2Qm.json
{
  "short_url": "https://qlk.app/k7Xp2Qm",
  "destination": "https://example.com/spring-sale",
  "title": "Spring sale",
  "description": "Landing page for the spring sale.",
  "expires_at": null,
  "created_at": "2026-11-21T10:00:00.000Z"
}

Ask for Markdown with Accept: text/markdown or the .md suffix.

Browsers always get the redirect. A HEAD request returns the redirect without counting a click. A link that does not exist answers 404; an expired link answers 410.

Errors

Errors use standard HTTP status codes and one JSON shape:

{
  "error": {
    "code": "invalid_request",
    "message": "Request validation failed",
    "details": [{ "field": "url", "message": "Must be a valid http or https URL" }]
  }
}
Status Code Meaning
400 invalid_request The body or query is not valid. details lists each field.
401 unauthorized Missing or invalid API key.
404 not_found No such link on this account.
409 slug_taken The requested slug is in use.
500 internal_error Something failed on our side.

MCP tools report the same failures as tool errors with a readable message.