URL Shortener API — Shorten Links Programmatically

Integrate link shortening into your apps, scripts, and workflows. RESTful API with full analytics, campaign management, and webhook support. Free to use.

Get Your Free API Key →

Quick Start — Shorten a Link in Seconds

One API call is all it takes. Here's how to shorten a URL with cURL:

# Shorten a URL curl -X POST https://ylink.pro/api/v1/links \ -H "Authorization: Bearer YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com/very/long/path", "alias": "my-link"}' # Response { "status": "success", "data": { "short_url": "https://ylink.pro/my-link", "original_url": "https://example.com/very/long/path", "clicks": 0, "created_at": "2026-06-17T12:00:00Z" } }

Python Example

import requests response = requests.post( "https://ylink.pro/api/v1/links", headers={"Authorization": "Bearer YOUR_API_KEY"}, json={"url": "https://example.com/long-url"} ) short_url = response.json()["data"]["short_url"] print(f"Shortened: {short_url}")

JavaScript / Node.js Example

const response = await fetch("https://ylink.pro/api/v1/links", { method: "POST", headers: { "Authorization": "Bearer YOUR_API_KEY", "Content-Type": "application/json" }, body: JSON.stringify({ url: "https://example.com/long-url" }) }); const { data } = await response.json(); console.log(`Shortened: ${data.short_url}`);

API Endpoints

The yLink.pro API provides comprehensive endpoints for link management:

POST /api/v1/links Create a new shortened link. Supports custom alias, expiration, password, and geo-targeting.
GET /api/v1/links/{id} Retrieve link details including click count, creation date, and configuration.
GET /api/v1/links/{id}/stats Get detailed analytics: clicks over time, geographic data, devices, referrers.
PUT /api/v1/links/{id} Update link destination, alias, expiration, or other settings.
DELETE /api/v1/links/{id} Delete a shortened link. The short URL will return 404 after deletion.
GET /api/v1/links List all links with pagination, filtering by date, campaign, or tag.
POST /api/v1/qr Generate a QR code for any URL with customization options.

API Features

🔑 Simple Authentication

Bearer token authentication via the Authorization header. Generate keys from your dashboard. Rotate keys anytime without downtime.

📊 Full Analytics Access

Query click data programmatically. Get time-series data, geographic breakdowns, device stats, and referral sources via the stats endpoint.

🔄 Webhooks

Receive real-time notifications when links are clicked. Configure webhook URLs per link or globally. Perfect for triggering automations.

📦 Bulk Operations

Shorten up to 100 URLs in a single API call with the bulk endpoint. Upload CSV files or send JSON arrays for efficient batch processing.

🤖 MCP Server

Our MCP server (ylink-mcp-server on npm) lets AI assistants interact with yLink.pro natively. Shorten links, check analytics, and manage campaigns through AI.

⚡ Low Latency

API responses in under 100ms globally. Our infrastructure is optimized for high-throughput applications with 99.9% uptime SLA.

Rate Limits & Pricing

Generous free tier with scalable paid options:

Plan Requests/Min Daily Limit Price
Free 100 5,000 $0
Pro 500 50,000 $9/mo
Business 1,000 Unlimited $29/mo

Rate limit headers (X-RateLimit-Remaining, X-RateLimit-Reset) are included in every response for proactive throttling.

Frequently Asked Questions

How do I get an API key?

Sign up for a free yLink.pro account, navigate to Settings > API, and generate your API key. The key is included in all requests via the Authorization header. Free accounts get full API access with generous rate limits.

What are the API rate limits?

Free accounts get 100 requests per minute and 5,000 requests per day. Premium accounts get 1,000 requests per minute and unlimited daily requests. Rate limit headers are included in every response so you can monitor usage.

What programming languages are supported?

The yLink.pro API is language-agnostic — any language that can make HTTP requests works. We provide official SDKs and code examples for Python, JavaScript/Node.js, PHP, Ruby, Go, and cURL. Community libraries are available for Java, C#, and Rust.

Can I retrieve analytics via the API?

Yes, the API provides full analytics access including total clicks, unique visitors, geographic breakdown, device types, referral sources, and time-series data. You can query analytics for individual links or aggregate across campaigns.

Is there an MCP server available?

Yes, yLink.pro offers an MCP (Model Context Protocol) server available on npm as ylink-mcp-server. This allows AI assistants and LLMs to interact with the yLink.pro API natively for link management tasks.

Start Building with the API

Get your free API key and start shortening links programmatically in minutes.

Get Free API Key →