Authentication

All API requests require an API key. You can find your API key in your dashboard after logging in.

Authorization Header
Authorization: Bearer YOUR_API_KEY

Getting Your API Key

You can find your API key in your dashboard under the API section. If you don't have an API key yet, you can generate one there.

Endpoints

POST

/api.php

Create Short URL

Parameters

Parameter Type Required Description
long_url string Yes The URL to be shortened

Example Request

cURL
curl -X POST https://i5o.io/api.php \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_API_KEY" \
-d '{"long_url": "https://example.com/very/long/url"}'

Example Response

JSON
{
    "status": "success",
    "short_url": "https://i5o.io/abc123",
    "qr_code": "https://i5o.io/qr/abc123"
}
GET

/api.php/stats/{short_code}

Get URL Statistics

Example Request

cURL
curl https://i5o.io/api.php/stats/abc123 \
-H "Authorization: Bearer YOUR_API_KEY"

Example Response

JSON
{
    "status": "success",
    "data": {
        "short_code": "abc123",
        "long_url": "https://example.com/very/long/url",
        "created_at": "2025-01-07T12:00:00Z",
        "clicks": 42,
        "last_clicked": "2025-01-07T15:30:00Z"
    }
}

Rate Limits

To ensure fair usage of our API, rate limits are applied based on your account type.

Rate Limit Information

Free accounts are limited to 60 requests per minute.

Account Type Rate Limit
Basic (Free) 60 requests per hour
Plus 300 requests per hour

Error Handling

When an error occurs, the API returns an error object with a status code and message.

Error Response
{
    "status": "error",
    "code": "invalid_url",
    "message": "The provided URL is not valid."
}
Error Code Description
invalid_url The provided URL is not valid
unauthorized Invalid or missing API key
rate_limit_exceeded You have exceeded your rate limit
not_found The requested resource was not found
server_error Internal server error

Example Code

PHP

PHP
$apiKey = 'YOUR_API_KEY';
$url = 'https://example.com/long/url';

$ch = curl_init('https://i5o.io/api.php');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => [
        'Content-Type: application/json',
        'Authorization: Bearer ' . $apiKey
    ],
    CURLOPT_POSTFIELDS => json_encode(['long_url' => $url])
]);

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

if ($data['status'] === 'success') {
    echo "Short URL: " . $data['short_url'];
}

JavaScript

JavaScript
async function createShortUrl(longUrl) {
    const response = await fetch('https://i5o.io/api.php', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'Authorization': 'Bearer YOUR_API_KEY'
        },
        body: JSON.stringify({ long_url: longUrl })
    });

    const data = await response.json();
    if (data.status === 'success') {
        console.log('Short URL:', data.short_url);
    }
}

Python

Python
import requests
import json

api_key = 'YOUR_API_KEY'
url = 'https://example.com/long/url'

headers = {
    'Content-Type': 'application/json',
    'Authorization': f'Bearer {api_key}'
}

data = {
    'long_url': url
}

response = requests.post('https://i5o.io/api.php', 
                        headers=headers, 
                        data=json.dumps(data))

if response.status_code == 200:
    result = response.json()
    if result['status'] == 'success':
        print(f"Short URL: {result['short_url']}")
else:
    print(f"Error: {response.status_code}")

Support

If you have any questions or need assistance with our API, please don't hesitate to contact our support team.

Need Help?

Contact our support team at m.alshahrani584@gmail.com or visit our contact page for assistance.