API Documentation
Integrate ly1.ru URL shortening into your applications with our simple REST API.
🔐 Authentication Required
API access requires authentication. Sign in with Google to get your API key. Sign in
Authentication
All API requests require authentication using your API key. Include it in the request header:
Authorization: Bearer YOUR_API_KEY
Or use the X-API-Key header:
X-API-Key: YOUR_API_KEY
Endpoints
POST
/api/v1/shorten
Create a shortened URL.
Request Parameters
| Parameter | Type | Description |
|---|---|---|
| url required | string | The URL to shorten (must be a valid HTTP/HTTPS URL) |
| custom optional | string | Custom alias (3-32 alphanumeric characters) |
Example Request
# Using curl
curl -X POST https://ly1.ru/api/v1/shorten \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"url": "https://example.com/very/long/url", "custom": "mylink"}'
# Using PHP
$ch = curl_init('https://ly1.ru/api/v1/shorten');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
],
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com/very/long/url',
'custom' => 'mylink'
])
]);
$response = json_decode(curl_exec($ch), true);
Success Response (200)
{
"success": true,
"data": {
"code": "mylink",
"short_url": "https://ly1.ru/mylink",
"subdomain_url": "https://mylink.ly1.ru",
"original_url": "https://example.com/very/long/url"
}
}
Error Response (400/401)
{
"success": false,
"error": "Error message here"
}
Error Codes
| Code | Description |
|---|---|
400 |
Bad Request — Invalid parameters or URL |
401 |
Unauthorized — Invalid or missing API key |
405 |
Method Not Allowed — Use POST method |
500 |
Internal Server Error |
Rate Limits
Currently there are no strict rate limits, but please be reasonable. Excessive requests may result in temporary blocking.