Skip to main content
GET
/
sources
/
{source_id}
/
metrics
Get Metrics For Source
curl --request GET \
  --url https://api.streamkap.com/sources/{source_id}/metrics \
  --header 'Authorization: Bearer <token>'
import requests

url = "https://api.streamkap.com/sources/{source_id}/metrics"

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

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

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

fetch('https://api.streamkap.com/sources/{source_id}/metrics', 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.streamkap.com/sources/{source_id}/metrics",
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.streamkap.com/sources/{source_id}/metrics"

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.streamkap.com/sources/{source_id}/metrics")
.header("Authorization", "Bearer <token>")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.streamkap.com/sources/{source_id}/metrics")

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": {
    "SnapshotMilliSecondsSinceLastEvent": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 500
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 300
      }
    ],
    "SnapshotTotalNumberOfEventsSeen": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 100
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 150
      }
    ],
    "StreamingMilliSecondsBehindSource": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 1000
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 800
      }
    ],
    "StreamingMilliSecondsSinceLastEvent": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 200
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 150
      }
    ],
    "StreamingTotalNumberOfCreateEventsSeen": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 20
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 35
      }
    ],
    "StreamingTotalNumberOfDeleteEventsSeen": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 5
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 8
      }
    ],
    "StreamingTotalNumberOfUpdateEventsSeen": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 30
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 45
      }
    ],
    "byteTotal": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 10000
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 15000
      }
    ],
    "recordRetryTotal": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 2
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 3
      }
    ],
    "recordSendTotal": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 50
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 70
      }
    ],
    "recordWrittenTotal": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 40
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 60
      }
    ],
    "sourceRecordWriteTotal": [
      {
        "timestamp": "2025-03-02 08:00:00",
        "value": 25
      },
      {
        "timestamp": "2025-03-02 09:00:00",
        "value": 40
      }
    ]
  },
  "metadata": {}
}
{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}

Authorizations

Authorization
string
header
required

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

Path Parameters

source_id
string
required

Query Parameters

time_type
enum<string>
default:latest

Type of the metrics.

Available options:
timeseries,
timesummary,
latest
Example:

"latest"

time_interval
integer
default:1

The interval between each metrics data point.

Example:

1

time_unit
enum<string>
default:hour

The unit of the time interval. Combined with time_interval to determine the interval between each metrics data point. For example, if time_interval=1 and time_unit=hour, the interval between each metrics data point is 1 hour.

Available options:
minute,
hour,
day,
week,
month
Example:

"hour"

timestamp_from
string<date-time> | null

Start time of the metrics data in UTC timezone. If not provided, start time is set to 24 hours before the current time.

Example:

"2025-03-02T07:10:15Z"

timestamp_to
string<date-time> | null

End time of the metrics data in UTC timezone. If not provided, end time is set to the current time.

Example:

"2025-03-04T07:10:15Z"

Response

Successful Response

data
SourceTimeseriesMetrics · object
required

Source timeseries metrics.

Example:
{
"SnapshotMilliSecondsSinceLastEvent": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 500
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 300
}
],
"SnapshotTotalNumberOfEventsSeen": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 100
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 150
}
],
"StreamingMilliSecondsBehindSource": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 1000
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 800
}
],
"StreamingMilliSecondsSinceLastEvent": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 200
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 150
}
],
"StreamingTotalNumberOfCreateEventsSeen": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 20
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 35
}
],
"StreamingTotalNumberOfDeleteEventsSeen": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 5
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 8
}
],
"StreamingTotalNumberOfUpdateEventsSeen": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 30
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 45
}
],
"byteTotal": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 10000
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 15000
}
],
"recordRetryTotal": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 2
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 3
}
],
"recordSendTotal": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 50
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 70
}
],
"recordWrittenTotal": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 40
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 60
}
],
"sourceRecordWriteTotal": [
{
"timestamp": "2025-03-02 08:00:00",
"value": 25
},
{
"timestamp": "2025-03-02 09:00:00",
"value": 40
}
]
}
metadata
Metadata · object
required