Build powerful applications with our comprehensive URL shortening API. Simple, fast, and reliable with advanced analytics.
Welcome to the BYSL API! Our RESTful API allows you to create, manage, and track short URLs programmatically with enterprise-grade reliability.
Get started in minutes with our intuitive REST API
Detailed insights and real-time tracking
Enterprise-grade security and reliability
https://bysl.pw/api
💡 Rate limits are applied per API key. Email [email protected] if you need higher limits (14 business days response).
All API responses are returned in JSON format with a consistent structure for easy parsing and error handling.
{ "success": true, "data": { // Response data }, "message": "Success message", "meta": { // Pagination and metadata } }
The BYSL API uses API keys for authentication. You can generate and manage your API keys from your dashboard.
Never expose your API key in client-side code or public repositories.
As of Version 1.2.0.1, your account must have a verified email address. If your email is unverified, all API requests will return a 403 Forbidden error.
Include your API key in the request headers:
curl -H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
https://bysl.pw/api/links
X-API-Key: your_api_key
?api_key=your_api_key
API keys can be restricted to specific permissions (scopes). Ensure your key has the correct scope for the endpoint you are calling:
| Scope | Description |
|---|---|
| links:read | Permission to list and view your short links. |
| links:write | Permission to create, update, and delete short links. |
| analytics:read | Permission to view click statistics and analytics. |
/api/links
{
"original_url": "https://example.com/very/long/path",
"title": "Example Website",
"custom_code": "my-example-link"
}
{
"success": true,
"message": "Short link created successfully",
"data": {
"id": 123,
"bysl_id": "abc123",
"short_code": "my-example-link",
"short_url": "https://bysl.pw/my-example-link",
"original_url": "https://example.com/very/long/path",
"title": "Example Website",
"click_count": 0,
"qr_code_url": "https://bysl.pw/qr/my-example-link",
"created_at": "2026-03-29T00:00:00.000000Z"
}
}
/api/links
| Parameter | Type | Description |
|---|---|---|
| page | integer | Page number (default: 1) |
| per_page | integer | Items per page (max: 100) |
| search | string | Search in title or URL |
{
"success": true,
"data": [
{
"id": 123,
"short_code": "my-example-link",
"short_url": "https://bysl.pw/my-example-link",
"original_url": "https://example.com/very/long/path",
"title": "Example Website"
}
],
"meta": {
"current_page": 1,
"last_page": 5,
"per_page": 15,
"total": 75
}
}
/api/links/{short_code}
{
"original_url": "https://example.com/new/path",
"title": "Updated Website Title",
"is_active": true
}
Note: The custom_code cannot be updated once a shortlink is created.
{
"success": true,
"message": "Short link updated successfully"
}
/api/links/{short_code}/toggle
{
"success": true,
"message": "Short link status updated successfully",
"data": {
"is_active": false
}
}
/api/links/{short_code}
{
"success": true,
"message": "Short link deleted successfully"
}
/api/bulk-shorten
{
"links": [
{
"original_url": "https://google.com",
"title": "Google"
},
{
"original_url": "https://github.com",
"title": "GitHub",
"custom_code": "my-gh-link"
}
]
}
{
"success": true,
"count": 2,
"data": [ ... ]
}
/api/analytics/overview
{
"success": true,
"data": {
"overview": {
"total_links": 150,
"total_clicks": 2500,
"active_links": 140,
"clicks_today": 45
},
"top_links": [
{
"id": 123,
"short_code": "example",
"title": "Example Website",
"click_count": 500
}
]
}
}
/api/analytics/links/{short_code}
/api/analytics/clicks
/api/analytics/countries
/api/analytics/devices
/api/analytics/browsers
/api/account
{
"success": true,
"data": {
"user": {
"id": 1,
"name": "John Doe",
"email": "[email protected]",
"created_at": "2024-01-01T00:00:00Z"
},
"subscription": {
"plan": "pro",
"status": "active",
"expires_at": "2024-12-31T23:59:59Z"
}
}
}
/api/account/usage
{
"success": true,
"data": {
"current_period": {
"requests": 45,
"limit": 100,
"percentage": 45.0,
"reset_at": "2024-02-01T00:00:00Z"
},
"daily_usage": [
{
"date": "2024-01-15",
"requests": 45
}
],
"weekly_usage": 180,
"monthly_usage": 650
}
}
/api/account/api-keys
{
"success": true,
"data": [
{
"id": 1,
"name": "Production API Key",
"key": "bysl_***************",
"is_active": true,
"permissions": ["links:create", "links:read", "analytics:read"],
"rate_limit": 100,
"current_usage": 45,
"last_used_at": "2024-01-15T10:30:00Z",
"created_at": "2024-01-01T00:00:00Z"
}
]
}
/api/info/{short_code}
Returns basic information about a short link. This endpoint does not require authentication.
{
"success": true,
"data": {
"short_code": "my-link",
"original_url": "https://example.com",
"title": "Example",
"is_active": true
}
}
/api/stats/public
{
"total_links": 15420,
"total_clicks": 890532,
"active_users": 1205
}
/api/health
{
"status": "ok",
"timestamp": "2026-04-20T08:00:00Z",
"version": "1.2.0.1"
}
# Create a short link
curl -X POST https://bysl.pw/api/links \
-H "X-API-Key: your_api_key_here" \
-H "Content-Type: application/json" \
-d '{
"url": "https://example.com",
"title": "Example Website"
}'
# Get your links
curl -X GET https://bysl.pw/api/links \
-H "X-API-Key: your_api_key_here"
// Create a short link
const response = await fetch('https://bysl.pw/api/links', {
method: 'POST',
headers: {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
},
body: JSON.stringify({
url: 'https://example.com',
title: 'Example Website'
})
});
const data = await response.json();
console.log(data);
import requests
# Create a short link
url = 'https://bysl.pw/api/links'
headers = {
'X-API-Key': 'your_api_key_here',
'Content-Type': 'application/json'
}
data = {
'url': 'https://example.com',
'title': 'Example Website'
}
response = requests.post(url, headers=headers, json=data)
result = response.json()
print(result)
<?php
$url = 'https://bysl.pw/api/links';
$data = [
'url' => 'https://example.com',
'title' => 'Example Website'
];
$options = [
'http' => [
'header' => [
'X-API-Key: your_api_key_here',
'Content-Type: application/json'
],
'method' => 'POST',
'content' => json_encode($data)
]
];
$context = stream_context_create($options);
$result = file_get_contents($url, false, $context);
$response = json_decode($result, true);
print_r($response);
The BYSL API uses conventional HTTP response codes to indicate the success or failure of an API request.
| Code | Status | Description |
|---|---|---|
| 200 | OK | The request was successful |
| 201 | Created | The resource was successfully created |
| 400 | Bad Request | The request was invalid or cannot be served |
| 401 | Unauthorized | Authentication failed or API key is invalid |
| 403 | Forbidden | Access denied or insufficient permissions |
| 404 | Not Found | The requested resource was not found |
| 422 | Unprocessable Entity | Validation errors in request data |
| 429 | Too Many Requests | Rate limit exceeded |
| 500 | Internal Server Error | Something went wrong on our end |
{
"success": false,
"message": "Validation failed",
"errors": {
"url": [
"The url field is required."
]
}
}