🚀 API Documentation

The Qyntly API allows you to programmatically shorten URLs, retrieve statistics, and manage your links from any application.

Base URL: https://qyntly.com/api/v1

🔑 Authentication

All API requests require an API key. You can generate one from your dashboard Settings page.

Option 1: Header (Recommended)

curl -H "X-API-Key: qyn_your_api_key_here" https://qyntly.com/api/v1/urls

Option 2: Query Parameter

curl "https://qyntly.com/api/v1/urls?api_key=qyn_your_api_key_here"

📊 Rate Limits

Tier Requests/Hour
Free 100
Pro 1,000

Rate limit headers in every response:

  • X-RateLimit-Limit: Your tier's limit
  • X-RateLimit-Remaining: Requests remaining
  • X-RateLimit-Reset: When the limit resets (ISO 8601)

📌 Endpoints

POST /api/v1/bulk-shorten

Create multiple short URLs at once with optional suffix.

Request Body:

{
  "urls": [
    { "name": "Leon", "url": "https://example.com" },
    { "name": "Pro", "url": "https://another.com" }
  ],
  "suffix": "Leon"  // Optional - appends to all names
}

Response (200 OK):

{
  "success": true,
  "created": 2,
  "failed": 0,
  "suffix": "Leon",
  "results": [
    {
      "success": true,
      "name": "Leon",
      "url_code": "LeonLeon",
      "short_url": "https://qyntly.com/LeonLeon",
      "original_url": "https://example.com",
      "qr_code": "https://qyntly.com/qr/LeonLeon"
    },
    {
      "success": true,
      "name": "Pro",
      "url_code": "ProLeon",
      "short_url": "https://qyntly.com/ProLeon",
      "original_url": "https://another.com",
      "qr_code": "https://qyntly.com/qr/ProLeon"
    }
  ]
}

Example:

curl -X POST https://qyntly.com/api/v1/bulk-shorten \
  -H "X-API-Key: qyn_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "urls": [
      {"name": "Leon", "url": "https://example.com"},
      {"name": "Pro", "url": "https://another.com"}
    ],
    "suffix": "Leon"
  }'

Notes:

  • Maximum 100 URLs per request
  • If suffix is provided, it appends to each name (e.g., Leon + Leon = LeonLeon)
  • If suffix is omitted or empty, only the name is used
  • Each URL code must be unique - duplicates will be reported in errors
  • Partial success possible - check both results and errors

POST /api/v1/shorten

Create a new short URL.

Request Body:

{
  "url": "https://example.com/very/long/url",
  "custom_code": "mylink"  // Optional
}

Response (200 OK):

{
  "success": true,
  "data": {
    "url_code": "abc123",
    "short_url": "https://qyntly.com/abc123",
    "original_url": "https://example.com/very/long/url",
    "qr_code": "https://qyntly.com/qr/abc123",
    "created_at": "2025-10-10T12:34:56.000Z"
  }
}

Example:

curl -X POST https://qyntly.com/api/v1/shorten \
  -H "X-API-Key: qyn_your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"url":"https://example.com/my-page"}'

GET /api/v1/url/:code

Retrieve information and stats for a specific short URL.

Response (200 OK):

{
  "success": true,
  "data": {
    "url_code": "abc123",
    "original_url": "https://example.com/my-page",
    "short_url": "https://qyntly.com/abc123",
    "clicks": 42,
    "created_at": "2025-10-10T12:34:56.000Z"
  }
}

Example:

curl https://qyntly.com/api/v1/url/abc123 \
  -H "X-API-Key: qyn_your_api_key_here"

GET /api/v1/urls

Get a paginated list of all your short URLs.

Query Parameters:

  • limit (optional): Results per page (max 100, default 50)
  • offset (optional): Pagination offset (default 0)

Response (200 OK):

{
  "success": true,
  "data": [
    {
      "url_code": "abc123",
      "original_url": "https://example.com/page1",
      "short_url": "https://qyntly.com/abc123",
      "clicks": 42,
      "created_at": "2025-10-10T12:34:56.000Z"
    }
  ],
  "pagination": {
    "total": 150,
    "limit": 50,
    "offset": 0
  }
}

Example:

curl "https://qyntly.com/api/v1/urls?limit=10&offset=0" \
  -H "X-API-Key: qyn_your_api_key_here"

DELETE /api/v1/url/:code

Delete a short URL.

Response (200 OK):

{
  "success": true,
  "message": "URL deleted successfully"
}

Example:

curl -X DELETE https://qyntly.com/api/v1/url/abc123 \
  -H "X-API-Key: qyn_your_api_key_here"

❌ Error Responses

All errors return JSON with an error field:

401 Unauthorized

{
  "error": "Unauthorized",
  "message": "API key required"
}

429 Rate Limit Exceeded

{
  "error": "Rate limit exceeded",
  "message": "Your free plan allows 100 requests per hour",
  "resetAt": "2025-10-10T13:00:00.000Z"
}

403 Forbidden

{
  "error": "URL limit reached",
  "message": "Your free plan allows 100 URLs. Upgrade for more.",
  "upgrade": true
}

💡 Code Examples

JavaScript (Node.js) - Bulk Create

const apiKey = 'qyn_your_api_key_here';

async function bulkShorten(urls, suffix = null) {
  const response = await fetch('https://qyntly.com/api/v1/bulk-shorten', {
    method: 'POST',
    headers: {
      'X-API-Key': apiKey,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ urls, suffix })
  });
  
  const data = await response.json();
  console.log(`Created: ${data.created}, Failed: ${data.failed}`);
  data.results.forEach(r => console.log(`${r.url_code} -> ${r.original_url}`));
  return data;
}

// Example usage
bulkShorten([
  { name: 'Leon', url: 'https://example.com' },
  { name: 'Pro', url: 'https://another.com' }
], 'Leon');

JavaScript (Node.js) - Single URL

const apiKey = 'qyn_your_api_key_here';

async function shortenURL(url) {
  const response = await fetch('https://qyntly.com/api/v1/shorten', {
    method: 'POST',
    headers: {
      'X-API-Key': apiKey,
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({ url })
  });
  
  const data = await response.json();
  console.log('Short URL:', data.data.short_url);
  return data;
}

shortenURL('https://example.com/my-page');

Python - Bulk Create

import requests

API_KEY = 'qyn_your_api_key_here'
BASE_URL = 'https://qyntly.com/api/v1'

def bulk_shorten(urls, suffix=None):
    headers = {'X-API-Key': API_KEY}
    data = {'urls': urls}
    if suffix:
        data['suffix'] = suffix
    
    response = requests.post(f'{BASE_URL}/bulk-shorten', headers=headers, json=data)
    result = response.json()
    
    print(f"Created: {result['created']}, Failed: {result['failed']}")
    for item in result['results']:
        print(f"{item['url_code']} -> {item['original_url']}")
    return result

# Example usage
bulk_shorten([
    {'name': 'Leon', 'url': 'https://example.com'},
    {'name': 'Pro', 'url': 'https://another.com'}
], 'Leon')

Python - Single URL

import requests

API_KEY = 'qyn_your_api_key_here'
BASE_URL = 'https://qyntly.com/api/v1'

def shorten_url(url):
    headers = {'X-API-Key': API_KEY}
    data = {'url': url}
    
    response = requests.post(f'{BASE_URL}/shorten', headers=headers, json=data)
    result = response.json()
    
    print(f"Short URL: {result['data']['short_url']}")
    return result

shorten_url('https://example.com/my-page')

PHP

<?php
$apiKey = 'qyn_your_api_key_here';
$url = 'https://example.com/my-page';

$ch = curl_init('https://qyntly.com/api/v1/shorten');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'X-API-Key: ' . $apiKey,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode(['url' => $url]));

$response = curl_exec($ch);
$data = json_decode($response, true);

echo "Short URL: " . $data['data']['short_url'] . "\n";
curl_close($ch);
?>

🔒 Security Best Practices

  1. Never commit API keys to version control
  2. Use environment variables to store keys
  3. Regenerate keys if compromised
  4. Use HTTPS for all requests
  5. Implement retry logic with exponential backoff
  6. Monitor rate limits in response headers

📞 Support

Happy shortening! 🔗