HypeAuditor For Twitch

Endpoint

Get metrics history of Twitch channel

GET https://hypeauditor.com/api/method/auditor.twitchHistory/?channel={channel}

Channel is Twitch username (nasa) from the url of Twitch channel (https://www.twitch.com/nasa). Returns the metrics history if it’s ready.

📘

Note:

  • By requesting Metrics History, user UNLOCKS report (auditor.twitch method).
  • nasa report is free, use it to test the API.
  • Disclaimer: HypeAuditor only provides historical data from the moment when the account to be searched was added to our database.

Changelog

❗️

Important:

  • Endpoint Metrics History Twitch has been added to API HypeAuditor since 13/02/2024.

Response Object

AttributesType
metrics_historyobjectMetrics history data

Metrics History Object

Contains monthly_views_avg, monthly_hours_streamed and stream_viewers_avg metrics history objects. Each object contains history array:

AttributesType
monthly_views_avg.history.time_isostrTime in ISO format
monthly_views_avg.history.valuefloatLast observed value of montly views average
monthly_hours_streamed.history.time_isostrTime in ISO format
monthly_hours_streamed.history.valuefloatLast observed value of monthly hours streamed
stream_viewers_avg.history.time_isostrTime in ISO format
stream_viewers_avg.history.valueintLast observed value of stream viewers average

Requests

Set YOUR_ID and YOUR_TOKEN from HypeAuditor.

curl -X GET \
  https://hypeauditor.com/api/method/auditor.twitchHistory \
  -H 'content-type: application/x-www-form-urlencoded' \
  -H 'x-auth-id: %YOUR_ID%' \
  -H 'x-auth-token: %YOUR_TOKEN%' \
  -d channel=nasa  \
<?php
$curl = curl_init();
curl_setopt_array($curl, [
   CURLOPT_URL => 'https://hypeauditor.com/api/method/auditor.twitchHistory',
   CURLOPT_CUSTOMREQUEST => 'GET',
   CURLOPT_POSTFIELDS => [
       'channel' => 'nasa'
   ],
   CURLOPT_HTTPHEADER => [
       'x-auth-id: YOUR_ID',
       'x-auth-token: YOUR_TOKEN'
   ],
]);

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

curl_close($curl);

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

Sample request

GET https://hypeauditor.com/api/method/auditor.twitchHistory/?channel=nasa

Sample response

{
    "result": {
        "metrics_history": {
            "monthly_views_avg": {
                "history": [
                    {
                        "time_iso": "2019-07-25T22:45:13",
                        "value": 1456
                    },
                    ...
                ]
            },
            "monthly_hours_streamed": {
                "history": [
                    {
                        "time_iso": "2019-07-25T22:45:13",
                        "value": 2.8
                    },
                    ...
                ]
            },
            "stream_viewers_avg": {
                "history": [
                    {
                        "time_iso": "2021-01-16T20:20:51",
                        "value": 5316
                    },
                    ...
                ]
            }
        },
        "restTokens": 999
    }
}