Skip to content

API Reference

The Klinky API enables programmatic management of A/B testing links. Create smart links, retrieve analytics data, and integrate link management into your applications.

Base URL

https://klinky-api.fly.dev/api/v1

Authentication

All API requests require an API key passed in the X-API-Key header:

bash
curl 'https://klinky-api.fly.dev/api/v1/public/links' \
  -H 'X-API-Key: klinky_live_your_api_key_here'

Getting an API Key

  1. Log in to your dashboard
  2. Go to Settings → API Keys
  3. Click "Create New Key"
  4. Copy the key immediately (it's only shown once)

Store Securely

API keys are shown only once when created. Store them securely in environment variables or secrets management systems. Never commit API keys to version control.

Rate Limits

API access is available on Growth and Scale plans:

PlanRate Limit
Growth100 requests/hour
Scale1,000 requests/hour

Rate limit headers are included in all responses:

  • X-RateLimit-Limit: Maximum requests per hour
  • X-RateLimit-Remaining: Remaining requests in current window
  • X-RateLimit-Reset: Unix timestamp when the limit resets

OpenAPI Specification

View and download the complete OpenAPI 3.1 specification: openapi.json

The spec includes detailed schema definitions for all endpoints, request/response formats, and authentication requirements.

Client Libraries

Official client libraries are coming soon. For now, use the REST API directly with standard HTTP clients.

Example: Python

python
import requests

API_KEY = 'your-api-key'
BASE_URL = 'https://klinky-api.fly.dev/api/v1'

# Create a link
response = requests.post(
    f'{BASE_URL}/public/links',
    headers={'X-API-Key': API_KEY},
    json={
        'name': 'Homepage Test',
        'slug': 'homepage-test',
        'variants': [
            {'label': 'control', 'destination_url': 'https://a.com', 'weight': 50},
            {'label': 'variant_b', 'destination_url': 'https://b.com', 'weight': 50}
        ]
    }
)

link = response.json()
print(f"Created: klinky.io/{link['slug']}")

Example: JavaScript/TypeScript

typescript
const API_KEY = 'your-api-key';
const BASE_URL = 'https://klinky-api.fly.dev/api/v1';

// List links
const response = await fetch(`${BASE_URL}/public/links`, {
  headers: { 'X-API-Key': API_KEY }
});

const data = await response.json();
console.log(`Total links: ${data.total}`);

Webhooks

Webhook support is coming soon. Subscribe to events like link created, conversion tracked, and winner declared.

Support

Need help with the API?

Released under MIT License