Developer Tools

API Documentation

Integrate our URL shortening service into your applications with our powerful, easy-to-use API

API Features

Simple, Powerful, and Developer-Friendly

Our API is designed to make integration straightforward with any application

Simple Integration

Integrate our URL shortening service with just a few lines of code. We support multiple programming languages including PHP, JavaScript, Python, and more.

RESTful Design

Our API follows RESTful principles with standardized HTTP methods, status codes, and JSON responses, making it predictable and easy to work with.

Advanced Options

Create password-protected URLs, track click statistics, validate URLs for safety, and utilize intelligent URL reuse - all through simple API parameters.

Documentation

API Reference

Complete documentation for integrating with our URL shortening service

Overview

Base URL: https://adcode.nabzclan.vip/api/

Our API accepts both GET and POST requests. All responses are returned in JSON format.

For production use, we recommend using POST requests with JSON data for better security and flexibility.

Rate Limit: 50 requests per minute per IP address

API Endpoints

GET /api/?url=URL

Create a Basic Shortened URL

Parameters:
url

The URL to shorten (must start with http:// or https://)

Example: https://example.com/very/long/path

URL Reuse: If the URL already exists in our system, the API will return the existing short link instead of creating a new one. The response will include is_existing: true to indicate this.
Example Response:
{
    "status": "success",
    "adcodeurl": "https://adcode.nabzclan.vip/link/abc12",
    "is_existing": false
}
GET /api/?url=URL&pass=PASSWORD

Create a Password-Protected Shortened URL

Parameters:
url

The URL to shorten (must start with http:// or https://)

Example: https://example.com/very/long/path

pass

Password to protect the URL (alphanumeric, underscore, dash only)

Example: my_secure_pass123

Example Response:
{
    "status": "success",
    "adcodeurl": "https://adcode.nabzclan.vip/link/def34",
    "is_existing": false
}
POST /api/

Create URL (Recommended Method)

Request Body (JSON):
{
    "url": "https://example.com/very/long/path",
    "pass": "optional_password"  // Optional
}
Example Response:
{
    "status": "success",
    "adcodeurl": "https://adcode.nabzclan.vip/link/ghi56",
    "is_existing": false
}
Example Response (Existing URL):
{
    "status": "success",
    "adcodeurl": "https://adcode.nabzclan.vip/link/ghi56",
    "is_existing": true
}

Error Responses

In case of an error, the API will return a JSON response with an error message:

{
    "status": "error",
    "message": "Invalid URL format"
}
Common Error Messages:
  • Missing parameter 'url'
  • Invalid URL format
  • Invalid password format
  • Database error
  • Rate limit exceeded
HTTP Status Codes:
  • 200 Success - The request was processed successfully
  • 400 Bad Request - Invalid parameters
  • 429 Too Many Requests - Rate limit exceeded
  • 500 Internal Server Error - Server-side error
Rate Limit Error Example:
{
    "status": "error",
    "message": "Rate limit exceeded. Maximum 50 requests per minute allowed.",
    "retry_after": 42
}

The retry_after value indicates the number of seconds to wait before making another request.

Code Examples

Integration Examples

Start integrating with copy-paste ready code examples

PHP Example

<?php
// Create a basic shortened URL
$longUrl = "https://example.com/very/long/url-that-needs-shortening";
$apiUrl = "https://adcode.nabzclan.vip/api/?url=" . urlencode($longUrl);

// For password protection
// $apiUrl = "https://adcode.nabzclan.vip/api/?url=" . urlencode($longUrl) . "&pass=myPassword";

// Using file_get_contents (simple approach)
$response = file_get_contents($apiUrl);
$data = json_decode($response, true);

if ($data['status'] === 'success') {
    echo "Shortened URL: " . $data['adcodeurl'];
} else {
    echo "Error: " . $data['message'];
}

// Alternative: Using cURL (recommended for production)
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://adcode.nabzclan.vip/api/");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
    'url' => $longUrl,
    'pass' => 'optional_password' // Remove this line if not using password
]));
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);

$response = curl_exec($ch);
curl_close($ch);

$data = json_decode($response, true);
// Process the response as shown above
?>
Best Practices

Implementation Guide

Follow these best practices for a successful implementation

Security Considerations

  • Always Use HTTPS

    Ensure all API calls are made using HTTPS to encrypt data in transit.

  • Validate User Input

    Always validate and sanitize URLs and other input before sending to the API.

  • Protect Sensitive Links

    Use the password protection feature for any links that contain or lead to sensitive information.

Performance Optimization

  • Implement Caching

    Cache shortened URLs to reduce API calls for frequently accessed links.

  • Respect Rate Limits

    Implement exponential backoff when rate limits are hit instead of continuous retries.

  • Use POST for Multiple Parameters

    When sending multiple parameters, prefer POST requests with JSON body over GET with query parameters.

Need Help?

If you need any assistance with implementing the API or have any questions, feel free to contact our support team via the contact form.