---
updatedAt: 2025-11-05T21:12:20.000Z
agentTools:
  projectIndex: https://developers.short.io/llms.txt
---

# Getting Clicks for Links per ID

Gets link clicks for link ids

> 📘 Information below might be outdated - please visit our recently updated [API Reference](https://developers.short.io/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.

![](https://files.readme.io/18bd122-Screen_Shot_2021-08-11_at_2.57.06_PM.png "Screen Shot 2021-08-11 at 2.57.06 PM.png")

### **2)** Copy an ID of a short link you want to get detailed statistics.

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

![](https://files.readme.io/a5095df-1.png "1.png")

![](https://files.readme.io/5033eb1-Screen_Shot_2021-08-11_at_3.15.24_PM.png "Screen Shot 2021-08-11 at 3.15.24 PM.png")

### **3)** Install prerequisites for requests.

```python
pip install requests
```
```javascript Node.js
npm install --save axios
```

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.

```python
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)
```
```javascript Node.js
const axios = require('axios');

axios.get('https://api-v2.short.io/statistics/domain/domainID/link_clicks', {
    params: {
        ids: '293627801, 292673342'
},
		headers: {
        accept:'*/*',
        authorization: '<<apiKey>>'
}
})
.then(function (response) {
  console.log(response.data);
})
.catch(function (response) {
  console.log(response);
});
```
```ruby
require 'uri'
require 'net/http'
require 'openssl'

url = URI("https://api-v2.short.io/statistics/domain/domainID/link_clicks?ids=293627801%2C%20292673342")

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

request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'
request["authorization"] = '<<apiKey>>'

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

### **5)** Launch the file.

```python
python filename.py
```
```javascript Node.js
node filename.js
```
```ruby Ruby
ruby filename.rb
```

### **6)** JSON Response.

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

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