Developer API Reference POST v1

Real-Time Webhooks (POST /api/v1/webhooks)

Subscribe to real-time events for click streams, link creations, and domain verifications.

Updated Yesterday 1 min read Verified
SDK & Request Quickstart Select your language
curl -X POST https://klic.in/api/v1/webhooks \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "targetUrl": "https://myapp.com/webhooks/klic",
    "events": ["link.clicked", "link.created"]
  }'
const response = await fetch('https://klic.in/api/v1/webhooks', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "targetUrl": "https://myapp.com/webhooks/klic",
    "events": ["link.clicked", "link.created"]
  })
});
const data = await response.json();
console.log(data);
import requests

url = "https://klic.in/api/v1/webhooks"
headers = {
    "Authorization": "Bearer YOUR_API_KEY",
    "Content-Type": "application/json"
}
payload = {
    "targetUrl": "https://myapp.com/webhooks/klic",
    "events": ["link.clicked", "link.created"]
  }

response = requests.post(url, json=payload, headers=headers)
print(response.json())
using System;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

using var client = new HttpClient();
client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", "YOUR_API_KEY");

var content = new StringContent(@"{
    ""targetUrl"": ""https://myapp.com/webhooks/klic"",
    ""events"": [""link.clicked"", ""link.created""]
  }", Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://klic.in/api/v1/webhooks", content);
string result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
<?php
$curl = curl_init();
$payload = json_encode({
    "targetUrl": "https://myapp.com/webhooks/klic",
    "events": ["link.clicked", "link.created"]
  });

curl_setopt_array($curl, [
    CURLOPT_URL => 'https://klic.in/api/v1/webhooks',
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'POST',
    CURLOPT_POSTFIELDS => $payload,
    CURLOPT_HTTPHEADER => [
        'Authorization: Bearer YOUR_API_KEY',
        'Content-Type: application/json'
    ]
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
package main

import (
	"bytes"
	"fmt"
	"io"
	"net/http"
)

func main() {
	payload := []byte(`{
    "targetUrl": "https://myapp.com/webhooks/klic",
    "events": ["link.clicked", "link.created"]
  }`)

	req, _ := http.NewRequest("POST", "https://klic.in/api/v1/webhooks", bytes.NewBuffer(payload))
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	req.Header.Set("Content-Type", "application/json")

	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()

	body, _ := io.ReadAll(resp.Body)
	fmt.Println(string(body))
}
200 OK 18ms application/json
{
  "status": "success",
  "data": {
    "id": "link_9a482b1c",
    "shortUrl": "https://klic.in/launch2026",
    "destination": "https://mybrand.com/launch-promo",
    "domain": "klic.in",
    "clicks": 0,
    "createdAt": "2026-08-20T13:36:12.842Z"
  }
}

Real-Time Webhooks

Receive real-time HTTPS webhooks when events occur in your KLIC workspace.

Supported Events

  • link.created &mdash; Fired when a new short link is created.
  • link.clicked &mdash; Real-time telemetry event for incoming visitor clicks.
  • domain.verified &mdash; Fired when custom DNS verification succeeds.

Endpoint

HTTP
POST https://klic.in/api/v1/webhooks
Content-Type: application/json
Authorization: Bearer YOUR_API_KEY

HTTP Response Status Codes

{
  "success": true,
  "statusCode": 200,
  "data": {
    "id": "link_89412a8f",
    "shortCode": "summer-2026",
    "shortUrl": "https://klic.in/summer-2026",
    "destination": "https://mybrand.com/summer-collection",
    "clicks": 0,
    "createdAt": "2026-08-20T17:05:00Z"
  }
}
{
  "success": false,
  "statusCode": 400,
  "error": {
    "code": "VALIDATION_FAILED",
    "message": "The destination URL must be a valid absolute URI (HTTP/HTTPS)."
  }
}
{
  "success": false,
  "statusCode": 401,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing or invalid Bearer API token in Authorization header."
  }
}
{
  "success": false,
  "statusCode": 429,
  "error": {
    "code": "RATE_LIMIT_EXCEEDED",
    "message": "Rate limit of 100 requests per second exceeded for your workspace plan."
  }
}