Table of Contents

Quick start — one GET request, no key

The fastest way to shorten a link. No account, no API key, no POST body:

curl "https://urlvanish.com/api/shorten?format=simple&url=https://example.com/a/very/long/address"
https://urlvanish.com/a1b2c3d4

Or as JSON:

curl "https://urlvanish.com/api/shorten?url=https://example.com/page"
{
  "shorturl": "https://urlvanish.com/a1b2c3d4",
  "alias": "a1b2c3d4",
  "originalUrl": "https://example.com/page"
}

Compatibility: the same request also works against https://urlvanish.com/create.php?format=simple&url=…, which is the shape other no-key shorteners use. Both routes are the same endpoint.

Parameters

ParameterRequiredDescription
urlYesThe address to shorten. u, long_url and originalUrl are accepted as aliases.
formatNojson (default), or simple/text for the bare short URL as plain text.
shorturlNoRequest a custom alias. Letters, numbers, hyphens and underscores, up to 50 characters.
base64NoSet to 1 if url is base64 encoded. Base64 input is auto-detected too.

Expanding a short link

The reverse operation resolves a URLVanish short link back to its destination. It does not count as a click and never consumes a single-use link:

curl "https://urlvanish.com/api/expand?format=simple&url=https://urlvanish.com/a1b2c3d4"
https://example.com/page

The destination of a password-protected link is deliberately withheld and returns 403. Suspended, expired and used-up links return 410.

No key needed, but one raises your limit. Anonymous callers get 100 requests per hour. Send Authorization: Bearer <key> with a free key for 1,000. Every response carries X-RateLimit-Remaining.

Introduction

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.

Two endpoints, same service. GET https://urlvanish.com/api/shorten for the one-request form above, and POST https://urlvanish.com/create_api.php for the JSON-body form documented below. Neither requires an API key.

Authentication

URLVanish API supports optional API key authentication. Authenticated requests link shortened URLs to your account so you can manage them from your dashboard.

  1. Create an account at URLVanish
  2. Log in and go to your Dashboard
  3. Generate an API key from the API Keys section
  4. Include your API key in the request header

Authentication Header

Authorization: Bearer YOUR_API_KEY
Note: Authentication is optional. You can create short URLs without an API key, but they won't be linked to your account and won't appear in your dashboard.

Rate Limits

To ensure fair usage for all users, we implement the following rate limits:

Every response carries your current allowance, so you do not have to guess:

Exceeding the limit returns 429 Too Many Requests with a Retry-After header giving the number of seconds to wait.

Create Short URL

POST https://urlvanish.com/create_api.php

Creates a new shortened URL.

Request Headers

Header Required Description
Content-Type Yes Must be application/json
Authorization No Bearer token for authenticated requests: Bearer YOUR_API_KEY

Request Body (JSON)

Parameter Type Required Description
originalUrl string Yes The URL to shorten
customAlias string No Custom alias for the short URL (letters, numbers, dashes, underscores, up to 50 characters)

Checking a link without following it: append a + to any short URL — https://urlvanish.com/abc12345+ — to get a page showing the destination, the click count and whether the link carries a password or an expiry. It needs no authentication, does not count as a click, and does not consume a single-use link. The destination of a password-protected link is withheld.

Note: password protection, expiry dates, click limits and self-destructing links are available on the website but are not yet exposed through the API. A link created through the API has none of those controls. Any extra fields you send are ignored — including userId, which is deliberately not accepted: a link belongs to the account whose API key created it, or to nobody.

Example Request

{
  "originalUrl": "https://example.com/very-long-url",
  "customAlias": "my-custom-link"
}

Success Response

{
  "status": "success",
  "alias": "https://urlvanish.com/my-custom-link",
  "originalUrl": "https://example.com/very-long-url"
}
Note: When using a valid API key, the response also includes an authenticated_as field with your username, confirming the URL was linked to your account.

Authenticated Response

{
  "status": "success",
  "alias": "https://urlvanish.com/my-custom-link",
  "originalUrl": "https://example.com/very-long-url",
  "authenticated_as": "your_username"
}

Error Response

{
  "status": "error",
  "message": "Missing required parameter: originalUrl."
}

Get URL Information Coming Soon

This endpoint is planned for a future release. It will allow you to retrieve information about a shortened URL including click statistics.

Delete URL Coming Soon

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.

List URLs Coming Soon

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.

Error Handling

The API uses HTTP response codes alongside a JSON response to indicate success or failure.

Status Code Description
200 Success — URL created
400 Bad Request — missing originalUrl, malformed JSON, an invalid URL, or an invalid custom alias
401 Unauthorized — Invalid or inactive API key
405 Method Not Allowed — use POST
409 Conflict — the requested custom alias is already taken
429 Too Many Requests — hourly rate limit reached. See the Retry-After and X-RateLimit-* headers.
500 Internal Server Error

Error Response Format

{
  "status": "error",
  "message": "Description of what went wrong"
}

Common Errors

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

Code Examples

cURL

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 (without authentication)

curl -X POST https://urlvanish.com/create_api.php \
  -H "Content-Type: application/json" \
  -d '{
    "originalUrl": "https://example.com/long-url"
  }'

JavaScript

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: "..." }

Python

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': '...'}

PHP

$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] => ... )
Need Help? If you have questions about the API or need assistance with integration, please contact our support team through the contact form.