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

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

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/time_series', 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/time_series",
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/time_series"

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/time_series")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

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

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": {
    "total_requests": 1756,
    "total_bandwidth": 1034631262,
    "time_periods": [
      {
        "period_start_time": "2024-08-15",
        "requests": 100,
        "bandwidth": 75721161
      },
      {
        "period_start_time": "2024-08-14",
        "requests": 109,
        "bandwidth": 55430651
      },
      {
        "period_start_time": "2024-08-13",
        "requests": 70,
        "bandwidth": 32806252
      },
      {
        "period_start_time": "2024-08-12",
        "requests": 71,
        "bandwidth": 90781331
      },
      {
        "period_start_time": "2024-08-11",
        "requests": 121,
        "bandwidth": 60168755
      },
      {
        "period_start_time": "2024-08-10",
        "requests": 187,
        "bandwidth": 86036341
      },
      {
        "period_start_time": "2024-08-09",
        "requests": 360,
        "bandwidth": 262348634
      },
      {
        "period_start_time": "2024-08-08",
        "requests": 86,
        "bandwidth": 45399695
      },
      {
        "period_start_time": "2024-08-07",
        "requests": 114,
        "bandwidth": 27869980
      },
      {
        "period_start_time": "2024-08-06",
        "requests": 146,
        "bandwidth": 65227201
      },
      {
        "period_start_time": "2024-08-05",
        "requests": 93,
        "bandwidth": 101281128
      },
      {
        "period_start_time": "2024-08-04",
        "requests": 62,
        "bandwidth": 18297460
      },
      {
        "period_start_time": "2024-08-03",
        "requests": 65,
        "bandwidth": 21646988
      },
      {
        "period_start_time": "2024-08-02",
        "requests": 64,
        "bandwidth": 49484961
      },
      {
        "period_start_time": "2024-08-01",
        "requests": 108,
        "bandwidth": 42130724
      }
    ]
  }
}

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

date_interval
enum<string>
required

Date interval to view gateway usage by. Must be either day or week.

Available options:
day,
week
sort_by
enum<string>

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
string

Sort results by either asc or desc

Response

200 - application/json

OK

The response is of type object.