Getting a List of Links

Returns list of links

📘

Information below might be outdated - please visit our recently updated API Reference

The instruction below shows how to get a list of short links.

BODY PARAMS

Parameter nameTypeConstraintsDescription
domain_idstringrequiredyour registered domain id
limitfloatoptionalLink limit (up to 150)
beforestringoptionalReturns links, older than provided link id. Used for pagination. Example: "before":"lnk_49n_UcaN4"

  • Click "Create API key".
  • Add a Secret key.

2) Copy an ID of a domain.

  • Open Domain settings.
  • Copy domain ID.

3) Install prerequisites for requests.

pip install requests
npm install --save axios

Now everything is ready to run the following snippet. It will return a list of links.

4) Create a file: filename.py/ .js/ .rb. Use the code snippet below.

📘

Please, replace domainID and limit with appropriate values.

❗️

Link limit (up to 150 links)

import requests

url = "https://api.short.io/api/links"

querystring = {"domain_id":"domainID","limit":"150","offset":"0"}

headers = {
    'accept': "application/json",
    'authorization': "<<apiKey>>"
    }

response = requests.request("GET", url, headers=headers, params=querystring)

print(response.text)
const axios = require('axios')

axios.get('https://api.short.io/api/links', {
    params: {
        domain_id: 'domainID', 
        limit: '150', 
        offset: '0'
    },
    headers: {
        accept: 'application/json',                                     authorization: '<<apiKey>>'
    }
  })
.then(function (response) {
  console.log(response.data);
})
.catch(function (response) {
  console.log(response);
});
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api.short.io/domains/delete/domainID")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["authorization"] = '<<apiKey>>'

response = http.request(request)
puts response.read_body

5) Launch the file.

python filename.py
node filename.js
ruby filename.rb

6) JSON Response (a list of links).

Once you run the code, you will see the response.

{
      id: 271198926,
      path: 'Kqnpc2',
      title: null,
      icon: null,
      archived: false,
      originalURL: 'https://codepen.io/mdJjKWq',
      iphoneURL: null,
      androidURL: null,
      splitURL: null,
      expiresAt: null,
      expiredURL: null,
      redirectType: null,
      cloaking: null,
      source: 'public',
      AutodeletedAt: null,
      createdAt: '2020-04-01T12:16:52.000Z',
      updatedAt: '2020-04-01T12:16:52.000Z',
      DomainId: 9026,
      OwnerId: 9346,
      tags: [],
      secureShortURL: 'https://shortcm.xyz/Kqnpc2',
      shortURL: 'https://shortcm.xyz/Kqnpc2'
    },
    {
      id: 271198874,
      path: 'Cj3kxP',
      title: null,
      icon: null,
      archived: false,
      originalURL: 'https://codepen.io/mdJjKWq',
      iphoneURL: null,
      androidURL: null,
      splitURL: null,
      expiresAt: null,
      expiredURL: null,
      redirectType: null,
      cloaking: null,
      source: 'public',
      AutodeletedAt: null,
      createdAt: '2020-04-01T12:16:26.000Z',
      updatedAt: '2020-04-01T12:16:26.000Z',
      DomainId: 9026,
      OwnerId: 9346,
      tags: [],
      secureShortURL: 'https://shortcm.xyz/Cj3kxP',
      shortURL: 'https://shortcm.xyz/Cj3kxP'
    },
    {
      id: 271198220,
      path: '4N48Ba',
      title: null,
      icon: null,
      archived: false,
      originalURL: 'https://codepen.io',
      iphoneURL: null,
      androidURL: null,
      splitURL: null,
      expiresAt: null,
      expiredURL: null,
      redirectType: null,
      cloaking: null,
      source: 'public',
      AutodeletedAt: null,
      createdAt: '2020-04-01T12:14:26.000Z',
      updatedAt: '2020-04-01T12:14:26.000Z',
      DomainId: 9026,
      OwnerId: 9346,
      tags: [],
      secureShortURL: 'https://shortcm.xyz/4N48Ba',
      shortURL: 'https://shortcm.xyz/4N48Ba'
    },
    {
      id: 271195976,
      path: '05i3Ai',
      title: null,
      icon: null,
      archived: false,
      originalURL: 'https://codepen.io/mdJjKWq',
      iphoneURL: null,
      androidURL: null,
      splitURL: null,
      expiresAt: null,
      expiredURL: null,
      redirectType: null,
      cloaking: null,
      source: 'public',
      AutodeletedAt: null,
      createdAt: '2020-04-01T12:07:29.000Z',
      updatedAt: '2020-04-01T12:07:29.000Z',
      DomainId: 9026,
      OwnerId: 9346,
      tags: [],
      secureShortURL: 'https://shortcm.xyz/05i3Ai',
      shortURL: 'https://shortcm.xyz/05i3Ai'
    },
    {
      id: 271193693,
      path: 'Ffgq9A',
      title: null,
      icon: null,
      archived: false,
      originalURL: 'https://codepen.io/mdJjKWq',
      iphoneURL: null,
      androidURL: null,
      splitURL: null,
      expiresAt: null,
      expiredURL: null,
      redirectType: null,
      cloaking: null,
      source: 'public',
      AutodeletedAt: null,
      createdAt: '2020-04-01T11:55:06.000Z',
      updatedAt: '2020-04-01T11:55:06.000Z',
      DomainId: 9026,
      OwnerId: 9346,
      tags: [],
      secureShortURL: 'https://shortcm.xyz/Ffgq9A',
      shortURL: 'https://shortcm.xyz/Ffgq9A'
    },