Integrate our powerful URL shortening service into your applications
Welcome to the URLVanish API! Our API allows you to integrate URL shortening capabilities directly into your applications. Create shortened URLs programmatically while maintaining the same privacy-focused approach that makes URLVanish unique.
https://urlvanish.com/create_api.php
URLVanish API supports optional API key authentication. Authenticated requests link shortened URLs to your account so you can manage them from your dashboard.
Authorization: Bearer YOUR_API_KEY
To ensure fair usage for all users, we implement the following rate limits:
https://urlvanish.com/create_api.php
Creates a new shortened URL.
| Header | Required | Description |
|---|---|---|
Content-Type |
Yes | Must be application/json |
Authorization |
No | Bearer token for authenticated requests: Bearer YOUR_API_KEY |
| Parameter | Type | Required | Description |
|---|---|---|---|
originalUrl |
string | Yes | The URL to shorten |
customAlias |
string | No | Custom alias for the short URL (letters, numbers, dashes, underscores) |
{
"originalUrl": "https://example.com/very-long-url",
"customAlias": "my-custom-link"
}
{
"status": "success",
"alias": "https://urlvanish.com/my-custom-link",
"originalUrl": "https://example.com/very-long-url"
}
authenticated_as field with your username, confirming the URL was linked to your account.
{
"status": "success",
"alias": "https://urlvanish.com/my-custom-link",
"originalUrl": "https://example.com/very-long-url",
"authenticated_as": "your_username"
}
{
"status": "error",
"message": "Missing required parameter: originalUrl."
}
This endpoint is planned for a future release. It will allow you to retrieve information about a shortened URL including click statistics.
This endpoint is planned for a future release. It will allow you to delete shortened URLs via the API. Currently, you can manage your URLs from your dashboard.
This endpoint is planned for a future release. It will allow you to list all URLs created by your account with pagination and sorting. Currently, you can view your URLs from your dashboard.
The API uses HTTP response codes alongside a JSON response to indicate success or failure.
| Status Code | Description |
|---|---|
| 200 | Success — URL created |
| 401 | Unauthorized — Invalid or inactive API key |
| 500 | Internal Server Error |
{
"status": "error",
"message": "Description of what went wrong"
}
| Message | Cause |
|---|---|
Missing required parameter: originalUrl. |
The originalUrl field is missing or empty in the request body |
Invalid or inactive API key. |
The Bearer token is not a valid API key or has been deleted |
Alias already exists. Please choose a different alias. |
The customAlias you requested is already taken |
Invalid HTTP method. Please use POST. |
The request was not a POST request |
curl -X POST https://urlvanish.com/create_api.php \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"originalUrl": "https://example.com/long-url",
"customAlias": "my-link"
}'
curl -X POST https://urlvanish.com/create_api.php \
-H "Content-Type: application/json" \
-d '{
"originalUrl": "https://example.com/long-url"
}'
const response = await fetch('https://urlvanish.com/create_api.php', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
originalUrl: 'https://example.com/long-url',
customAlias: 'my-link'
})
});
const data = await response.json();
console.log(data);
// { status: "success", alias: "https://urlvanish.com/my-link", originalUrl: "...", authenticated_as: "..." }
import requests
url = "https://urlvanish.com/create_api.php"
headers = {
"Authorization": "Bearer YOUR_API_KEY",
"Content-Type": "application/json"
}
data = {
"originalUrl": "https://example.com/long-url",
"customAlias": "my-link"
}
response = requests.post(url, json=data, headers=headers)
print(response.json())
# {'status': 'success', 'alias': 'https://urlvanish.com/my-link', 'originalUrl': '...', 'authenticated_as': '...'}
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://urlvanish.com/create_api.php');
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer YOUR_API_KEY',
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'originalUrl' => 'https://example.com/long-url',
'customAlias' => 'my-link'
]));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
print_r($data);
// Array ( [status] => success [alias] => https://urlvanish.com/my-link [originalUrl] => ... [authenticated_as] => ... )