Skip to main content
GET
/
analytics
/
gateways
/
top
Top Gateway Analytics
curl --request GET \
  --url https://api.pinata.cloud/v3/analytics/gateways/top \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.pinata.cloud/v3/analytics/gateways/top"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.pinata.cloud/v3/analytics/gateways/top', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.pinata.cloud/v3/analytics/gateways/top",
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: Bearer <token>"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

import (
"fmt"
"net/http"
"io"
)

func main() {

url := "https://api.pinata.cloud/v3/analytics/gateways/top"

req, _ := http.NewRequest("GET", url, nil)

req.Header.Add("Authorization", "Bearer <token>")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.get("https://api.pinata.cloud/v3/analytics/gateways/top")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.pinata.cloud/v3/analytics/gateways/top")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
{
  "data": [
    {
      "value": "bafybeiegx7bgm5gpiutivw6e234gflheqjmp7hxlxfkihd3zdfx6omocia",
      "requests": 1341,
      "bandwidth": 287310699
    }
  ]
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Query Parameters

gateway_domain
string
required

Gateway domain to filter by

start_date
string
required

Start date of aggregation in the format YYYY-MM-DD

end_date
string
required

End date of aggregation in the format YYYY-MM-DD

by
enum<string>
required

Attribute to aggregaate results by, must be cid, country, region, user_agent, referer, or file_name.

Available options:
cid,
country,
region,
user_agent,
referrer,
file_name
sort_by
enum<string>
required

Sort data by either requests or bandwidth

Available options:
requests,
bandwidth
cid
string

Filter by CID

file_name
string

Filter by file name

user_agent
string

Filter by user agent

country
string

Filter by country

region
string

Filter by region

referer
string

Filter by referer

http_status_code
enum<string>

Filter results by HTTP status code

Available options:
200,
206,
301,
302,
304,
307,
308,
404,
499
limit
integer

Limit the number of results returned, default is 100

sort_order
enum<string>

Sort results by either asc or desc

Available options:
asc,
desc

Response

200 - application/json

OK

The response is of type object.