Update link details
curl --request PATCH \
--url https://ishortn.ink/api/v1/links/{alias} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://new-destination.com",
"expiresAfter": null
}
'import requests
url = "https://ishortn.ink/api/v1/links/{alias}"
payload = {
"url": "https://new-destination.com",
"expiresAfter": None
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://new-destination.com', expiresAfter: null})
};
fetch('https://ishortn.ink/api/v1/links/{alias}', 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/{alias}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://new-destination.com',
'expiresAfter' => null
]),
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/{alias}"
payload := strings.NewReader("{\n \"url\": \"https://new-destination.com\",\n \"expiresAfter\": null\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://ishortn.ink/api/v1/links/{alias}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://new-destination.com\",\n \"expiresAfter\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ishortn.ink/api/v1/links/{alias}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://new-destination.com\",\n \"expiresAfter\": null\n}"
response = http.request(request)
puts response.read_body{
"shortLink": "https://ishortn.ink/newAlias",
"url": "https://new-destination.com",
"alias": "newAlias",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": null
}"<string>""Invalid or missing API key""Link not found""Failed to update link"Endpoint Examples
Update short link details
Updates details of a shortened link (e.g., destination URL, alias, expiration) using its alias.
PATCH
/
links
/
{alias}
Update link details
curl --request PATCH \
--url https://ishortn.ink/api/v1/links/{alias} \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"url": "https://new-destination.com",
"expiresAfter": null
}
'import requests
url = "https://ishortn.ink/api/v1/links/{alias}"
payload = {
"url": "https://new-destination.com",
"expiresAfter": None
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({url: 'https://new-destination.com', expiresAfter: null})
};
fetch('https://ishortn.ink/api/v1/links/{alias}', 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/{alias}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'url' => 'https://new-destination.com',
'expiresAfter' => null
]),
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/{alias}"
payload := strings.NewReader("{\n \"url\": \"https://new-destination.com\",\n \"expiresAfter\": null\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://ishortn.ink/api/v1/links/{alias}")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"url\": \"https://new-destination.com\",\n \"expiresAfter\": null\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://ishortn.ink/api/v1/links/{alias}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"url\": \"https://new-destination.com\",\n \"expiresAfter\": null\n}"
response = http.request(request)
puts response.read_body{
"shortLink": "https://ishortn.ink/newAlias",
"url": "https://new-destination.com",
"alias": "newAlias",
"expiresAt": "2024-12-31T23:59:59Z",
"expiresAfter": null
}"<string>""Invalid or missing API key""Link not found""Failed to update link"Authorizations
Path Parameters
The alias of the shortened link.
Query Parameters
The domain of the shortened link. If not provided, the default domain will be used.
Body
application/json
The new destination URL.
The new custom alias for the shortened link.
The new date and time when the link expires. Use null to remove expiration date.
The new number of clicks after which the link expires. Use null to remove click limit.
Response
Link updated 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).