Getting link info
Get a long URL by domain name and a path of a short URL
The instructions below demonstrate how to get the information about a link: original URL, date of creation, domainID, mobile URLs, expiration, cloaking etc..
To get short link info
- Create a secret API key from the Integrations and API menu: https://app.short.io/settings/integrations/api-key
- Then you may need to install prerequisites for HTTP requests (if necessary, depending on your programming language and its version).
- Use the following code snippets to get information about a particular short link:
Please replace example.xyz , YOUR_PATH (the URL slug), APIKEY with the appropriate values.
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.short.io/links/expand?domain=<<domain_name>>&path=<<path>>",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <<apiKey>>",
"accept: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
import requests
url = "https://api.short.io/links/expand?domain=<<domain_name>>&path=<<path>>"
headers = {
"accept": "application/json",
"Authorization": "<<apiKey>>"
}
response = requests.get(url, headers=headers)
print(response.text)
const url = 'https://api.short.io/links/expand?domain=<<domain_name>>&path=<<path>>';
const options = {
method: 'GET',
headers: {accept: 'application/json', Authorization: '<<apiKey>>'}
};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.short.io/links/expand?domain=<<domain_name>>&path=<<path>>"))
.header("accept", "application/json")
.header("Authorization", "<<apiKey>>")
.method("GET", HttpRequest.BodyPublishers.noBody())
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
using System.Net.Http.Headers;
var client = new HttpClient();
var request = new HttpRequestMessage
{
Method = HttpMethod.Get,
RequestUri = new Uri("https://api.short.io/links/expand?domain=<<domain_name>>&path=<<path>>"),
Headers =
{
{ "accept", "application/json" },
{ "Authorization", "<<apiKey>>" },
},
};
using (var response = await client.SendAsync(request))
{
response.EnsureSuccessStatusCode();
var body = await response.Content.ReadAsStringAsync();
Console.WriteLine(body);
}
- Review the JSON response which should resemble the following:
{
originalURL: 'YOUR_LONG_URL',
path: 'YOUR_PATH',
idString: 'LINK_ID',
id: 'LINK_ID',
shortURL: 'https://example.com/YOUR_PATH',
secureShortURL: 'https://example.com/YOUR_PATH',
cloaking: false,
title: 'LINK_TITLE',
tags: [],
createdAt: '2025-05-08T08:56:34.967Z',
skipQS: false,
archived: false,
DomainId: 115111,
OwnerId: 141117,
hasPassword: false
}
Updated 14 days ago