Skip to main content

Getting a list of short links

  1. Create a secret API key from the Integrations and API menu: https://app.short.io/settings/integrations/api-key
  2. Get the ID of the domain which short links you want to display:
  • In the Short.io Dashboard open the Domain Settings and copy the domain ID from your browser's address bar:

Screenshot

  1. Then you may need to install prerequisites for HTTP requests (if necessary, depending on your programming language and its version).
  2. Use the following code snippets to get the list of links:

📘

Please note that there is a limitation on the number of links that the API can return. Consequently, the limit value must be less than 150.

Replace {user.domain_id}, {user.limit} and {user.apiKey} with the appropriate values.

<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.short.io/api/links?domain_id=<<domain_id>>&limit=<<limit>>",
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;
}

  1. Review the JSON response which should resemble the following:
{
"count": 4,
"links": [
{
"originalURL": "YOUR_LONG_URL",
"path": "slug1",
"idString": "lnk_4Th1_8MAbEywPHUsk11111",
"id": "lnk_4Th1_8MAbEywPHUsk11111",
"shortURL": "http://mydomain.fr/slug1",
"secureShortURL": "https://mydomain.fr/slug1",
"cloaking": false,
"title": "Link Title",
"tags": [],
"createdAt": "2024-10-29T08:00:47.490Z",
"skipQS": false,
"archived": false,
"DomainId": 11111,
"OwnerId": 11111,
"hasPassword": false,
"source": "website",
"User": {
"id": 11111,
"name": "YourName",
"email": "youremailaddress",
"photoURL": "youremailaddress/2zHS33ejyfE11111"
}
},
{
"originalURL": "YOUR_LONG_URL2",
"path": "slug2",
"idString": "lnk_4Th1_YUSVK9T92Dewx11111",
"id": "lnk_4Th1_YUSVK9T92Dewx11111",
"shortURL": "http://mydomain.fr/slug2",
"secureShortURL": "https://mydomain.fr/slug2",
"cloaking": false,
"title": "Link Title",
"tags": [],
"createdAt": "2024-10-29T07:59:57.487Z",
"skipQS": false,
"archived": false,
"DomainId": 11111,
"OwnerId": 11111,
"hasPassword": false,
"source": "website",
"User": {
"id": 11111,
"name": "YourName",
"email": "youremailaddress",
"photoURL": "youremailaddress/2zHS33ejyfE11111"
}
},
{
"originalURL": "YOUR_LONG_URL3",
"path": "slug3",
"idString": "lnk_4Th1_b4cX4HwE0OTal11111",
"id": "lnk_4Th1_b4cX4HwE0OTal11111",
"shortURL": "http://mydomain.fr/slug3",
"secureShortURL": "https://mydomain.fr/slug3",
"cloaking": false,
"title": "Link Title",
"tags": [],
"createdAt": "2024-10-29T07:57:43.527Z",
"skipQS": false,
"archived": false,
"DomainId": 11111,
"OwnerId": 11111,
"hasPassword": false,
"source": "website",
"User": {
"id": 11111,
"name": "YourName",
"email": "youremailaddress",
"photoURL": "youremailaddress/2zHS33ejyfE11111"
}
},
{
"originalURL": "YOUR_LONG_URL4",
"path": "slug4",
"idString": "lnk_4Th1_ZhVH0yrWn58CnJ11111",
"id": "lnk_4Th1_ZhVH0yrWn58CnJ11111",
"shortURL": "http://mydomain.fr/slug4",
"secureShortURL": "https://mydomain.fr/slug4",
"cloaking": false,
"title": "Link Title",
"tags": [],
"createdAt": "2024-10-29T07:55:00.334Z",
"skipQS": false,
"archived": false,
"DomainId": 11111,
"OwnerId": 11111,
"hasPassword": false,
"source": "website",
"User": {
"id": 11111,
"name": "YourName",
"email": "youremailaddress",
"photoURL": "youremailaddress/2zHS33ejyfE11111"
}
}
],
"nextPageToken": null
}

The following page provides more information about the settings for obtaining a list of links: https://developers.short.io/reference/get_api-links