API Version 1.0
Base URL: https://anonshort.com/api/
URL Shortener API Documentation
Welcome to the URL Shortener API documentation. This API allows you to shorten URLs and retrieve statistics about the shortened URLs.
Endpoints
ENDPOINT
1. Shorten a URL
POST
/api/
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
url |
string | Yes | The URL to be shortened |
custom_path |
string | No | Custom path for the shortened URL |
Response
{ "short_url": "https://anonshort.com/shortened-path", "stats_url": "https://anonshort.com/index.php?stats=stats-token" }
ENDPOINT
2. Get URL Statistics
GET
/api/?stats={stats_token}
Parameters
Parameter | Type | Required | Description |
---|---|---|---|
stats_token |
string | Yes | The token used to retrieve statistics for a shortened URL |
Response
{ "url": "https://www.example.com", "clicks": 0, "created_at": "2024-09-03 06:42:09" }
Example Usage
Shorten a URL using cURL
curl -X POST -d "url=https://www.example.com" -d "custom_path=mycustompath" https://anonshort.com/api/
Shorten a URL using Python
import requests url = "https://anonshort.com/api/" data = { 'url': 'https://www.example.com', 'custom_path': 'mycustompath' } response = requests.post(url, data=data) if response.status_code == 200: print("Shortened URL:", response.json().get('short_url')) print("Stats URL:", response.json().get('stats_url')) else: print("Error:", response.status_code, response.json())
Shorten a URL using Node.js
const axios = require('axios'); const url = 'https://anonshort.com/api/'; const data = { url: 'https://www.example.com', custom_path: 'mycustompath' }; axios.post(url, new URLSearchParams(data)) .then(response => { console.log('Shortened URL:', response.data.short_url); console.log('Stats URL:', response.data.stats_url); }) .catch(error => { console.error('Error:', error.response ? error.response.data : error.message); });
HTTP Response Codes
200
Success
Request was successful
400
Bad Request
Missing required parameters
405
Method Not Allowed
HTTP method not supported
429
Too Many Requests
Rate limit exceeded
500
Server Error
Internal server error
Contact
If you have any questions or feedback, please feel free to contact us: