Skip to main content

Getting Clicks for Links per ID

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

The instruction below shows how to get the number of clicks for links.

1) Get your API key here: https://app.short.io/settings/integrations/api-key​

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

  • Open the statistics of the short link.
  • Copy the link ID.

3) Install prerequisites for requests.​

pip install requests

Now everything is ready to run the following snippet. It will send the number of clicks for short URLs.

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

📘

Please, replace DOMAIN_ID and IDS with appropriate values.

import requests

url = "https://api-v2.short.io/statistics/domain/domainID/link_clicks"

querystring = {"ids":"293627801, 292673342"}

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

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

print(response.text)

5) Launch the file.​

python filename.py

6) JSON Response.​

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

{
'292673342': 0, '293627801': 1
}