Log In Get Started

API Documentation

Welcome to the Cabiux API documentation. Our RESTful API enables you to create short links with intelligent deep linking, track analytics, manage campaigns, and integrate link management into your applications programmatically.

Introduction

What is Cabiux?

Cabiux is an intelligent URL shortening platform that automatically detects mobile apps and creates deep links. When users click your links on mobile devices, they're taken directly into the relevant app (if installed) for a seamless experience.

Key Features

  • Intelligent Deep Linking - Automatically routes users to native apps when available
  • Real-time Analytics - Track clicks, devices, locations, and conversion rates
  • Custom Short Codes - Create branded, memorable links
  • UTM Parameters - Built-in campaign tracking support
  • QR Code Generation - Generate QR codes for any link
  • Link Expiration - Set expiry dates or click limits
  • Branded Domains - Use your own domain for short links

Supported Apps

Cabiux automatically creates deep links for 50+ popular apps including:

Social: Instagram, TikTok, Twitter/X, Facebook, LinkedIn, Snapchat, Pinterest

E-commerce: Amazon, eBay, Etsy, Shopify stores, AliExpress

Media: YouTube, Spotify, Apple Music, Netflix, Twitch, SoundCloud

Productivity: Slack, Notion, Trello, Asana, Google Drive, Dropbox

Authentication

All API requests (except login) require authentication using JSON Web Tokens (JWT). You'll receive a token when you log in, which must be included in the Authorization header of subsequent requests.

Step 1: Obtain a Token

Send a POST request to the login endpoint with your credentials:

Request
POST /api/auth/login
Content-Type: application/json

{
  "email": "your@email.com",
  "password": "your-password"
}
Response
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "expires_at": 1704067200,
  "user": {
    "id": 1,
    "email": "your@email.com",
    "name": "Your Name",
    "plan": "medium"
  }
}

Step 2: Use the Token

Include the token in the Authorization header with the Bearer prefix:

Header Format
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...
Tip:

Tokens expire after 24 hours. Store the expires_at timestamp and refresh your token before it expires.

Base URL

All API endpoints are relative to the base URL of your Cabiux instance:

https://your-domain.com/api

For example, to create a link, you would send a request to:

POST https://your-domain.com/api/links

Get Analytics

GET /api/analytics/{shortCode}

Retrieves comprehensive analytics for a specific link including click counts, device breakdowns, geographic data, and time-series data.

Query Parameters

Parameter Type Default Description
days integer 30 Number of days to include in the analytics (max: 365)

Example Response

Response (200 OK)
{
  "total_clicks": 1234,
  "unique_clicks": 892,
  "deep_link_rate": 78.5,
  "clicks_by_device": {
    "mobile": 834,
    "desktop": 356,
    "tablet": 44
  },
  "clicks_by_os": {
    "iOS": 512,
    "Android": 322,
    "Windows": 289,
    "macOS": 67,
    "Linux": 44
  },
  "clicks_by_country": {
    "US": 623,
    "UK": 198,
    "DE": 156,
    "CA": 89
  },
  "clicks_by_date": [
    {"date": "2024-01-15", "clicks": 45},
    {"date": "2024-01-14", "clicks": 62}
  ],
  "recent_clicks": [...]
}
Deep Link Rate:

The deep_link_rate shows the percentage of clicks that successfully opened in a native app rather than a web browser.

QR Codes

GET /api/links/{id}/qrcode

Generates a QR code for the specified link. The QR code points to the short URL and will trigger deep linking when scanned on mobile devices.

Query Parameters

Parameter Type Default Description
size integer 256 QR code size in pixels (min: 64, max: 1024)
format string png Response format: png (binary image) or datauri (base64 data URI)

Example Usage

# Download as PNG image
curl -o qrcode.png "https://your-domain.com/api/links/42/qrcode?size=512" \
  -H "Authorization: Bearer YOUR_TOKEN"

# Get as data URI (for embedding in HTML)
curl "https://your-domain.com/api/links/42/qrcode?format=datauri" \
  -H "Authorization: Bearer YOUR_TOKEN"

Campaigns

Campaigns help you organize and track groups of related links. Create campaigns for marketing initiatives, product launches, or any collection of links you want to analyze together.

POST /api/campaigns

Create a new campaign to organize your links.

Request Body
{
  "name": "Spring Sale 2024",
  "description": "Links for our spring promotional campaign"
}
GET /api/campaigns

List all your campaigns with their link counts and total clicks.

GET /api/campaigns/{id}/links

Get all links belonging to a specific campaign.

Deep Linking

Deep linking is the core feature of Cabiux. When enabled, the system automatically detects supported apps in your destination URLs and generates the appropriate deep links.

How It Works

  1. You create a short link to a supported app URL (e.g., Instagram profile)
  2. User clicks the short link on their mobile device
  3. Cabiux detects the user's device and operating system
  4. If the app is likely installed, Cabiux attempts to open it directly
  5. If the app isn't installed, users are redirected to the web version
App Detection:

Cabiux uses URL pattern matching to identify supported apps. For example, any URL containing instagram.com will automatically generate Instagram deep links.

Branded Domains

Use your own domain for short links instead of the default Cabiux domain. This improves brand recognition and click-through rates.

POST /api/domains

Add a custom domain to your account. You'll need to verify ownership via DNS.

POST /api/domains/{id}/verify

Verify domain ownership after adding the required DNS records.

Data Export

Export your links and analytics data in CSV format for external analysis or backup purposes.

GET /api/export/links

Export all your links as a CSV file.

GET /api/export/analytics/{shortCode}

Export click-level analytics data for a specific link as CSV.

Rate Limits

API rate limits vary by plan. Exceeding limits will result in a 429 Too Many Requests response.

Small Plan

60
requests/minute

Medium Plan

120
requests/minute

Large Plan

300
requests/minute
Tip:

If you're hitting rate limits, consider batching your requests or implementing exponential backoff in your integration.

Error Handling

The API uses standard HTTP status codes and returns error details in JSON format.

Error Response Format
{
  "error": "Description of what went wrong"
}

HTTP Status Codes

Code Status Description
200 OK Request succeeded
201 Created Resource successfully created
400 Bad Request Invalid request parameters or body
401 Unauthorized Missing or invalid authentication token
403 Forbidden Valid token but insufficient permissions
404 Not Found Requested resource doesn't exist
429 Too Many Requests Rate limit exceeded
500 Internal Server Error Something went wrong on our end

SDKs & Libraries

While we don't currently offer official SDKs, our REST API is straightforward to use with any HTTP client. Here are examples in popular languages:

JavaScript (Node.js)

JavaScript
const createLink = async (url, token) => {
  const response = await fetch('https://your-domain.com/api/links', {
    method: 'POST',
    headers: {
      'Authorization': `Bearer ${token}`,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ original_url: url })
  });
  return response.json();
};

Python

Python
import requests

def create_link(url, token):
    response = requests.post(
        'https://your-domain.com/api/links',
        headers={'Authorization': f'Bearer {token}'},
        json={'original_url': url}
    )
    return response.json()

PHP

PHP
$ch = curl_init('https://your-domain.com/api/links');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $token,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'original_url' => $url
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = json_decode(curl_exec($ch));
curl_close($ch);