Create a shortened link
curl --request POST \
--url https://ishortn.ink/api/v1/links \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://example.com",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": 1000,
"domain": "example.com",
"alias": "customAlias",
"password": "securePassword"
}
'import requests
url = "https://ishortn.ink/api/v1/links"
payload = {
"url": "https://example.com",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": 1000,
"domain": "example.com",
"alias": "customAlias",
"password": "securePassword"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com',
expiresAt: '2024-12-31T23:59:59Z',
expiresAfter: 1000,
domain: 'example.com',
alias: 'customAlias',
password: 'securePassword'
})
};
fetch('https://ishortn.ink/api/v1/links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ishortn.ink/api/v1/links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com',
'expiresAt' => '2024-12-31T23:59:59Z',
'expiresAfter' => 1000,
'domain' => 'example.com',
'alias' => 'customAlias',
'password' => 'securePassword'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ishortn.ink/api/v1/links"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"expiresAt\": \"2024-12-31T23:59:59Z\",\n \"expiresAfter\": 1000,\n \"domain\": \"example.com\",\n \"alias\": \"customAlias\",\n \"password\": \"securePassword\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://ishortn.ink/api/v1/links")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"expiresAt\": \"2024-12-31T23:59:59Z\",\n \"expiresAfter\": 1000,\n \"domain\": \"example.com\",\n \"alias\": \"customAlias\",\n \"password\": \"securePassword\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ishortn.ink/api/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com\",\n \"expiresAt\": \"2024-12-31T23:59:59Z\",\n \"expiresAfter\": 1000,\n \"domain\": \"example.com\",\n \"alias\": \"customAlias\",\n \"password\": \"securePassword\"\n}"
response = http.request(request)
puts response.read_body{
"shortLink": "https://ishortn.ink/customAlias",
"url": "https://example.com",
"alias": "customAlias",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": 1000,
"isProtected": true
}"<string>""Invalid or missing API key"Endpoint Examples
Create a short link
Creates a shortened link with optional parameters for expiration, alias, and password protection.
POST
/
links
Create a shortened link
curl --request POST \
--url https://ishortn.ink/api/v1/links \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://example.com",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": 1000,
"domain": "example.com",
"alias": "customAlias",
"password": "securePassword"
}
'import requests
url = "https://ishortn.ink/api/v1/links"
payload = {
"url": "https://example.com",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": 1000,
"domain": "example.com",
"alias": "customAlias",
"password": "securePassword"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
url: 'https://example.com',
expiresAt: '2024-12-31T23:59:59Z',
expiresAfter: 1000,
domain: 'example.com',
alias: 'customAlias',
password: 'securePassword'
})
};
fetch('https://ishortn.ink/api/v1/links', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://ishortn.ink/api/v1/links",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://example.com',
'expiresAt' => '2024-12-31T23:59:59Z',
'expiresAfter' => 1000,
'domain' => 'example.com',
'alias' => 'customAlias',
'password' => 'securePassword'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://ishortn.ink/api/v1/links"
payload := strings.NewReader("{\n \"url\": \"https://example.com\",\n \"expiresAt\": \"2024-12-31T23:59:59Z\",\n \"expiresAfter\": 1000,\n \"domain\": \"example.com\",\n \"alias\": \"customAlias\",\n \"password\": \"securePassword\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://ishortn.ink/api/v1/links")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://example.com\",\n \"expiresAt\": \"2024-12-31T23:59:59Z\",\n \"expiresAfter\": 1000,\n \"domain\": \"example.com\",\n \"alias\": \"customAlias\",\n \"password\": \"securePassword\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ishortn.ink/api/v1/links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://example.com\",\n \"expiresAt\": \"2024-12-31T23:59:59Z\",\n \"expiresAfter\": 1000,\n \"domain\": \"example.com\",\n \"alias\": \"customAlias\",\n \"password\": \"securePassword\"\n}"
response = http.request(request)
puts response.read_body{
"shortLink": "https://ishortn.ink/customAlias",
"url": "https://example.com",
"alias": "customAlias",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": 1000,
"isProtected": true
}"<string>""Invalid or missing API key"Authorizations
Body
application/json
The URL to shorten.
The date and time when the link expires.
The number of clicks after which the link expires.
If you have a custom domain, you can specify it here.
Custom alias for the shortened link.
Password to protect the link. (Only for pro users)
Response
Link created successfully
The shortened link.
The original URL.
The alias of the shortened link.
The expiration date and time of the link.
The number of clicks after which the link expires.
Indicates if the link is password protected (relevant for creation response).
⌘I