Welcome to the KompaktURL API. Our API is designed to be simple, predictable, and powerful. Build your own tools, automate shortening, or integrate real-time analytics into your workflow.
All private API requests must include your API key in the
X-API-Key header. You can generate
an API key from your dashboard.
X-API-Key: ku_live_your_secret_key_here
If the key is missing or invalid, the API will return a
401 Unauthorized error.
Create a shortened link for any long URL.
{
"original_url": "https://example.com/very-long-path",
"custom_code": "my-alias",
"is_one_time": false
}
Retrieve a list of all URLs you've created.
Get detailed click stats for a specific short code.
Webhooks allow you to receive real-time notifications when your links are
clicked. We send a
POST request to your endpoint as soon as an event occurs.
Each webhook request includes an X-KompaktURL-Signature
header. Use your webhook secret to
verify the payload signature using HMAC-SHA256.
# Python Verification Example import hmac, hashlib signature = hmac.new(secret.encode(), payload.encode(), hashlib.sha256).hexdigest()
Integrating is even easier with our official Python SDK. Download it from the
sdk/python
directory in the repository.
from kompakturl import KompaktURL
sdk = KompaktURL(api_key="your_key")
link = sdk.shorten("https://google.com")
print(link['short_code'])