API Documentation

RESTful API for URL shortening and link management

Getting Started

Base URL: https://urlfy.org/api/v1

POST
/api/v1/shorten
Create a short URL

Request

{"url": "https://example.com"}

Response

{"shortUrl": "SHORT_URL", "cid": 304}

Examples

cURL
curl -X POST https://urlfy.org/api/v1/shorten \
  -H "Content-Type: application/json" \
  -d '{"url": "https://example.com"}'
JavaScript
fetch('https://urlfy.org/api/v1/shorten', {
    method: 'POST',
    headers: {'Content-Type': 'application/json'},
    body: JSON.stringify({url: 'https://example.com'})
})
.then(res => res.json())
.then(result => console.log(result.shortUrl));
Python
import requests

response = requests.post('https://urlfy.org/api/v1/shorten',
    json={'url': 'https://example.com'})
result = response.json()
print(result['shortUrl'])
GET
/api/v1/stats/:short_code
Public: get stats for one short link

Request

GET https://urlfy.org/api/v1/stats/zosdJjx

Response

{
  "shortCode": "zosdJjx",
  "originalURL": "https://example.com/...",
  "clickCount": 114747,
  "createdAt": "2025-11-02T15:00:00Z"
}

Examples

cURL
curl https://urlfy.org/api/v1/stats/zosdJjx
JavaScript
const r = await fetch('https://urlfy.org/api/v1/stats/zosdJjx');
const stats = await r.json();
console.log(stats.clickCount);
Python
import requests
r = requests.get('https://urlfy.org/api/v1/stats/zosdJjx')
print(r.json()['clickCount'])
POST
/api/v1/delete
Delete a short link (requires API key)

Request

POST https://urlfy.org/api/v1/delete?apikey=YOUR_API_KEY&shortcode=zosdJjx

Response

{"success": true, "message": "Short URL 'zosdJjx' deleted successfully"}

Examples

cURL
curl -X POST "https://urlfy.org/api/v1/delete?apikey=YOUR_API_KEY&shortcode=zosdJjx"
GET
/api/v1/stats
System-wide statistics (requires API key)

Request

GET https://urlfy.org/api/v1/stats?apikey=YOUR_API_KEY

Response

{
  "总短链数": 1939491,
  "近7日创建数": 23984,
  "每日统计": [...],
  "点击量Top10": [...]
}
POST
/api/v1/report
Report a malicious or inappropriate short link

Request

{
  "shortUrl": "https://urlfy.org/abc1234",
  "reason": "Phishing or fraud",
  "details": "Optional details",
  "reporterEmail": "[email protected]"
}

Response

{"success": true}
POST
/api/v1/contact
Submit a support request

Request

{
  "name": "Your Name",
  "email": "[email protected]",
  "subject": "Question",
  "message": "Hello..."
}

Response

{"success": true, "message": "感谢您的消息!我们会在24小时内回复您。"}

Error Codes

400 - Bad Request (invalid parameters or body)
401 - Unauthorized (missing or wrong API key)
404 - Not Found (short code does not exist)
500 - Internal Server Error

Ready to Start?

Test the API directly or integrate it into your application

🔗 Try Shortener 📊 Click Counter