API Documentation
Everything you need to integrate blx.ist into your project.
Base URL
https://blx.ist
Authentication
All API requests require an Authorization header with your API token.
Authorization: your_api_token_here
Don't have a token? Get one for free.
Endpoints
POST
/api/shorten
Create a shortened URL.
Headers
| Name | Required | Description |
|---|---|---|
| Authorization | Required | Your API token |
Body Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| url | string | Required | A valid URL to shorten |
Error Codes
| Status | Message |
|---|---|
| 401 | Missing authorization token |
| 401 | Invalid token |
| 401 | Missing url |
| 401 | Url is not valid |
Code Examples
cURL
curl -X POST https://blx.ist/api/shorten \
-H "Authorization: YOUR_API_KEY_HERE" \
-F "url=https://example.com"
PHP
$ch = curl_init('https://blx.ist/api/shorten');
curl_setopt_array($ch, [
CURLOPT_POST => true,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => ['Authorization: YOUR_API_KEY_HERE'],
CURLOPT_POSTFIELDS => ['url' => 'https://example.com'],
]);
$response = json_decode(curl_exec($ch));
curl_close($ch);
echo $response->short_url;
Node.js
const form = new FormData();
form.append('url', 'https://example.com');
const res = await fetch('https://blx.ist/api/shorten', {
method: 'POST',
headers: { 'Authorization': 'YOUR_API_KEY_HERE' },
body: form,
});
const data = await res.json();
console.log(data.short_url);
Python
import requests
r = requests.post('https://blx.ist/api/shorten',
headers={'Authorization': 'YOUR_API_KEY_HERE'},
data={'url': 'https://example.com'})
print(r.json()['short_url'])
Success Response
{
"status": "success",
"url": "https://example.com",
"short_url": "https://blx.ist/a4f2c"
}
Error Response
{
"status": "error",
"message": "Invalid token"
}