# Linkly — how to use (mcp.ai)

Connect your Linkly account and use 17 tools for URL shortener straight from your AI agent. Connect with your own API key. Easily create tracking links, add retargeting tags, do smart redirects and more.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_linkly?ms=1787291160000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `linkly_create_or_update_link`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/linkly`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/linkly/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/linkly/create/or/update/link` — Tool to create a new shortened link or update an existing one in Linkly. Use when you need to generate a trackable short URL with custom parameters, UTM tracking, retargeting pixels, or Open Graph met
  - body: { id?: integer, url?: string, name?: string, slug?: string, rules?: object[], domain?: string, gtm_id?: string, enabled?: boolean, cloaking?: boolean, og_image?: string, og_title?: string, utm_term?: string, block_bots?: boolean, ga4_tag_id?: string, utm_medium?: string, utm_source?: string, fb_pixel_id?: string, utm_content?: string, utm_campaign?: string, workspace_id?: integer, hide_referrer?: boolean, forward_params?: boolean, og_description?: string }
- `POST https://api.mcp.ai/api/linkly/delete/link` — Tool to delete a specific link by ID from a workspace. Use when you need to permanently remove a link. This action is permanent and cannot be undone.
  - body: { id: integer, workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/delete/links` — Tool to delete one or more links by their IDs. This action is permanent and cannot be undone. Use when you need to remove links from a workspace.
  - body: { ids: integer[], workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/export/links` — Tool to export all links in a workspace as JSON or CSV. Use when you need to retrieve all links for backup, analysis, or migration purposes.
  - body: { format?: string, search?: string, workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/get/click/counters` — Tool to retrieve click analytics grouped by a specific dimension (counter). Returns aggregated counts for each unique value of the selected dimension. Use when you need to analyze click patterns by co
  - body: { end?: string, bots?: boolean, start?: string, format?: string, unique?: boolean, counter: string, country?: string, link_id?: string, link_ids?: string, workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/get/clicks` — Tool to retrieve click analytics for a workspace. Filter by link, date range, country, and more. Returns time-series data suitable for charting.
  - body: { end?: string, isp?: string, bots?: boolean, pivot?: string, start?: string, format?: string, unique?: boolean, browser?: string, country?: string, link_id?: string, referer?: string, link_ids?: string, platform?: string, timezone?: string, frequency?: string, workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/get/link` — Tool to retrieve detailed information about a specific link by its ID. Use when you need to fetch link configuration, UTM parameters, or click statistics.
  - body: { id: string, workspace_id?: string }
- `POST https://api.mcp.ai/api/linkly/get/link/by/id` — Tool to retrieve details for a specific link by ID. Use when you need to fetch information about a shortened link, including its destination URL, click statistics, and configuration settings.
  - body: { id: integer }
- `POST https://api.mcp.ai/api/linkly/list/domains` — Tool to retrieve all custom domains configured for a workspace. Use when you need to see available domains for creating short links.
  - body: { page?: integer, page_size?: integer, workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/list/link/webhooks` — Tool to retrieve all webhook subscriptions for a specific link. Use when you need to see what webhooks are configured for a link.
  - body: { link_id: integer }
- `POST https://api.mcp.ai/api/linkly/list/links` — Tool to get a paginated list of all links in a workspace. Supports search, sorting, and pagination. Returns link details including click statistics. Use when you need to retrieve or search through lin
  - body: { page?: integer, search?: string, sort_by?: string, sort_dir?: string, page_size?: integer, workspace_id: string }
- `POST https://api.mcp.ai/api/linkly/list/workspace/webhooks` — Tool to list all webhook subscriptions for a specific workspace. Use when you need to retrieve or view the configured webhooks for a workspace.
  - body: { workspace_id: integer }
- `POST https://api.mcp.ai/api/linkly/list/workspaces` — Tool to retrieve all workspaces the authenticated user has access to. Use this to discover available workspace IDs for other API calls.
- `POST https://api.mcp.ai/api/linkly/subscribe/webhook/to/link` — Tool to subscribe a webhook URL to receive notifications when a specific link is clicked. Use when you need to track click events for a shortened link.
  - body: { url: string, link_id: integer }
- `POST https://api.mcp.ai/api/linkly/subscribe/webhook/to/workspace` — Tool to subscribe a webhook URL to receive click notifications from a Linkly workspace. Use when you need to set up real-time notifications for link clicks. The webhook will receive POST requests cont
  - body: { url: string, workspace_id: integer }
- `POST https://api.mcp.ai/api/linkly/unsubscribe/webhook/from/link` — Tool to remove a webhook subscription from a link. Use when you need to stop receiving webhook events for a specific link.
  - body: { hook_id: string, link_id: integer }
- `POST https://api.mcp.ai/api/linkly/unsubscribe/webhook/from/workspace` — Tool to remove a webhook subscription from a workspace. Use when you need to unsubscribe a webhook URL from receiving events for a specific workspace.
  - body: { hook_id: string, workspace_id: integer }

## Example prompts
- "What can I do in Linkly?"
- "Show me a summary of my Linkly account"

## More
- Page: https://mcp.ai/linkly
- Agent spec (llms.txt): https://mcp.ai/linkly/llms.txt
- Postman collection: https://mcp.ai/linkly/postman.json
