Developer

API Integration: Automate Your Link Shortening Workflow

Step-by-step tutorial on integrating our RESTful API into your applications for seamless automation.

EB
Endi Buka
Nov 20, 202510 min read

For developers and teams handling high volumes of links, manual creation isn't practical. Our RESTful API enables seamless integration with your existing tools and workflows.

Getting Started with the API

Authentication

All API requests require authentication using an API key. Generate your key from the dashboard under Settings > API Keys. Include it in the Authorization header:

Authorization: Bearer your_api_key_here

Base URL

All API endpoints are available at:

https://api.klyr.link/v1/

Creating Short Links

The most common operation is creating a new short link. Send a POST request to the /links endpoint:

POST /links
{
  "url": "https://example.com/very-long-url",
  "slug": "my-custom-slug",
  "tags": ["campaign-2025", "email"]
}

Response

{
  "id": "link_abc123",
  "short_url": "https://klyr.link/my-custom-slug",
  "original_url": "https://example.com/very-long-url",
  "created_at": "2025-11-20T10:30:00Z"
}

Retrieving Analytics

Fetch analytics for any link using the GET endpoint:

GET /links/{link_id}/analytics?period=30d

This returns click counts, geographic data, device breakdown, and referral sources.

Bulk Operations

For high-volume use cases, our bulk endpoint lets you create up to 100 links in a single request:

POST /links/bulk
{
  "links": [
    {"url": "https://example.com/page1"},
    {"url": "https://example.com/page2"}
  ]
}

Webhooks

Set up webhooks to receive real-time notifications when links are clicked or reach milestones. Configure webhooks in your dashboard or via the API.

Rate Limits

API requests are rate-limited based on your plan:

  • Professional: 1,000 requests/minute
  • Enterprise: 10,000 requests/minute

Rate limit headers are included in every response to help you manage your usage.

SDKs and Libraries

We provide official SDKs for popular languages:

- JavaScript/TypeScript (npm)

- Python (pip)

- PHP (composer)

- Ruby (gem)

Conclusion

Our API is designed for developers who need powerful, flexible link management. Whether you're building a marketing automation tool, a social media scheduler, or a custom analytics dashboard, our API provides the foundation you need.

Share this article

Ready to shorten your first link?

Join thousands of marketers using Klyr to manage and track their links.