> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Count of Instagram Followers Online

> Retrieve the total historical count of your Instagram followers

export const HeaderAPI = ({noProfileKey, profileKeyRequired}) => <>
    <ParamField header="Authorization" type="string" required>
      <a href="/apis/overview#authorization">API Key</a> of the Primary Profile.
      <br />
      <br />
      Format: <code>Authorization: Bearer API_KEY</code>
    </ParamField>
    {!noProfileKey && (profileKeyRequired ? <ParamField header="Profile-Key" type="string" required>
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField> : <ParamField header="Profile-Key" type="string">
          <a href="/apis/overview#profile-key-format">Profile Key</a> of a User Profile.
          <br />
          <br />
          Format: <code>Profile-Key: PROFILE_KEY</code>
        </ParamField>)}
  </>;

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "business") {
      displayPlans = ["Launch", "Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Launch", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

<PlansAvailable plans={["premium"]} maxPackRequired={false} />

Retrieve the total historical count of your Instagram followers online per hour, which allows you to optimize posting for maximum engagement.

<ul class="custom-bullets">
  <li>Not available on IG Users with fewer than 100 followers.</li>
  <li>Analytics data only available for the last 30 days.</li>

  <li>
    The time period for a requested day is the previous day at T07:00:00.000Z until the current day
    at T06:59:59.999Z in UTC.

    For example, use format `YYYY-MM-DDThh:mm:ssZ` and send as `2026-07-08T12:30:00Z`.
    Please see [utctime](https://www.utctime.net/) for more examples.
  </li>
</ul>

## Header Parameters

<HeaderAPI />

## Query Parameters

<ParamField query="date" type="string" required>
  A day with format: `YYYY-MM-DD`.

  For example, use format `YYYY-MM-DDThh:mm:ssZ` and send as `2026-07-08T12:30:00Z`.
  Please see [utctime](https://www.utctime.net/) for more examples.
</ParamField>

<ParamField query="formatUTC" type="boolean" default={false} required>
  Format the output with UTC start and end dates.
</ParamField>

<RequestExample>
  ```bash cURL theme={"system"}
  curl \
  -H "Authorization: Bearer API_KEY" \
  -X GET https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03
  ```

  ```javascript JavaScript theme={"system"}
  const API_KEY = "API_KEY";
  const date = "2023-12-03";
  fetch(`https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=${date}`, {
    method: "GET",
    headers: {
      Authorization: `Bearer ${API_KEY}`
    }
  })
    .then((res) => res.json())
    .then((json) => console.log(json))
    .catch(console.error);
  ```

  ```python Python theme={"system"}
  import requests

  headers = {'Authorization': 'Bearer API_KEY'}

  r = requests.get('https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03', headers=headers)

  print(r.json())
  ```

  ```php PHP theme={"system"}
  <?php

  // URL and authorization details
  $url = 'https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03';
  $apiKey = 'API_KEY';  // Replace 'API_KEY' with your actual API key

  // Initialize a cURL session
  $curl = curl_init();

  // Set cURL options
  curl_setopt($curl, CURLOPT_URL, $url);
  curl_setopt($curl, CURLOPT_HTTPHEADER, array(
      'Content-Type: application/json',
      'Authorization: Bearer ' . $apiKey
  ));
  curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);

  // Execute cURL session and get the response
  $response = curl_exec($curl);

  // Check if any error occurred
  if(curl_errno($curl)){
      echo 'Curl error: ' . curl_error($curl);
  } else {
      // Decode and re-encode the JSON response to pretty print
      echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
  }

  // Close cURL session
  curl_close($curl);
  ```

  ```csharp C# theme={"system"}
  using System;
  using System.Net.Http;
  using System.Threading.Tasks;

  namespace InstagramFollowerCountGETRequest_csharp
  {
     class InstagramFollowerCount
     {
         private static readonly HttpClient client = new HttpClient();

         static async Task Main(string[] args)
         {
             string API_KEY = "API_KEY";
             string url = "https://api.ayrshare.com/api/analytics/getInstagramOnlineFollowers?date=2023-12-03";

             client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);

             try
             {
                 HttpResponseMessage response = await client.GetAsync(url);
                 response.EnsureSuccessStatusCode();
                 string responseBody = await response.Content.ReadAsStringAsync();
                 Console.WriteLine(responseBody);
             }
             catch (HttpRequestException e)
             {
                 Console.WriteLine($"Error: {e.Message}");
             }
         }
     }
  }
  ```
</RequestExample>

<ResponseExample>
  ```json 200: Success theme={"system"}
  {
    "status": "success",
    "onlineFollowersByHour": {
      "0": 120, // 12 AM
      "1": 113, // 1 AM
      "2": 117, // 2 AM
      "3": 110, // 3 AM
      "4": 129, // 4 AM
      "5": 170, // 5 AM
      "6": 166, // 6 AM
      "7": 173, // 7 AM
      "8": 177, // 8 AM
      "9": 168, // 9 AM
      "10": 178, // 10 AM
      "11": 160, // 11 AM
      "12": 154, // 12 PM
      "13": 153, // 1 PM
      "14": 131, // 2 PM
      "15": 118, // 3 PM
      "16": 109, // 4 PM
      "17": 128, // 5 PM
      "18": 129, // 6 PM
      "19": 134, // 7 PM
      "20": 123, // 8 PM
      "21": 111, // 9 PM
      "22": 102, // 10 PM
      "23": 98 // 11 PM
    },
    "startTime": "2024-03-29T07:00:00.000Z",
    "endTime": "2024-03-30T07:00:00.000Z"
  }
  ```

  ```json 200: Success formatUTC theme={"system"}
  {
    "status": "success",
    "onlineFollowersByHour": [
      {
        "start": "2024-03-29T07:00:00.000Z",
        "end": "2024-03-29T07:59:59.999Z",
        "onlineFollowers": 33
      },
      {
        "start": "2024-03-29T08:00:00.000Z",
        "end": "2024-03-29T08:59:59.999Z",
        "onlineFollowers": 90
      },
      {
        "start": "2024-03-29T09:00:00.000Z",
        "end": "2024-03-29T09:59:59.999Z",
        "onlineFollowers": 21
      },
      {
        "start": "2024-03-29T10:00:00.000Z",
        "end": "2024-03-29T10:59:59.999Z",
        "onlineFollowers": 109
      },
      {
        "start": "2024-03-29T11:00:00.000Z",
        "end": "2024-03-29T11:59:59.999Z",
        "onlineFollowers": 99
      },
      {
        "start": "2024-03-29T12:00:00.000Z",
        "end": "2024-03-29T12:59:59.999Z",
        "onlineFollowers": 10
      },
      {
        "start": "2024-03-29T13:00:00.000Z",
        "end": "2024-03-29T13:59:59.999Z",
        "onlineFollowers": 82
      },
      {
        "start": "2024-03-29T14:00:00.000Z",
        "end": "2024-03-29T14:59:59.999Z",
        "onlineFollowers": 101
      },
      {
        "start": "2024-03-29T15:00:00.000Z",
        "end": "2024-03-29T15:59:59.999Z",
        "onlineFollowers": 91
      },
      {
        "start": "2024-03-29T16:00:00.000Z",
        "end": "2024-03-29T16:59:59.999Z",
        "onlineFollowers": 12
      },
      {
        "start": "2024-03-29T17:00:00.000Z",
        "end": "2024-03-29T17:59:59.999Z",
        "onlineFollowers": 93
      },
      {
        "start": "2024-03-29T18:00:00.000Z",
        "end": "2024-03-29T18:59:59.999Z",
        "onlineFollowers": 21
      },
      {
        "start": "2024-03-29T19:00:00.000Z",
        "end": "2024-03-29T19:59:59.999Z",
        "onlineFollowers": 95
      },
      {
        "start": "2024-03-29T20:00:00.000Z",
        "end": "2024-03-29T20:59:59.999Z",
        "onlineFollowers": 97
      },
      {
        "start": "2024-03-29T21:00:00.000Z",
        "end": "2024-03-29T21:59:59.999Z",
        "onlineFollowers": 101
      },
      {
        "start": "2024-03-29T22:00:00.000Z",
        "end": "2024-03-29T22:59:59.999Z",
        "onlineFollowers": 74
      },
      {
        "start": "2024-03-29T23:00:00.000Z",
        "end": "2024-03-29T23:59:59.999Z",
        "onlineFollowers": 61
      },
      {
        "start": "2024-03-30T00:00:00.000Z",
        "end": "2024-03-30T00:59:59.999Z",
        "onlineFollowers": 31
      },
      {
        "start": "2024-03-30T01:00:00.000Z",
        "end": "2024-03-30T01:59:59.999Z",
        "onlineFollowers": 28
      },
      {
        "start": "2024-03-30T02:00:00.000Z",
        "end": "2024-03-30T02:59:59.999Z",
        "onlineFollowers": 19
      },
      {
        "start": "2024-03-30T03:00:00.000Z",
        "end": "2024-03-30T03:59:59.999Z",
        "onlineFollowers": 21
      },
      {
        "start": "2024-03-30T04:00:00.000Z",
        "end": "2024-03-30T04:59:59.999Z",
        "onlineFollowers": 23
      },
      {
        "start": "2024-03-30T05:00:00.000Z",
        "end": "2024-03-30T05:59:59.999Z",
        "onlineFollowers": 92
      },
      {
        "start": "2024-03-30T06:00:00.000Z",
        "end": "2024-03-30T06:59:59.999Z",
        "onlineFollowers": 32
      }
    ],
    "startTime": "2024-03-29T07:00:00.000Z",
    "endTime": "2024-03-30T07:00:00.000Z"
  }
  ```

  ```json 200: Success No Data theme={"system"}
  {
    "status": "success",
    "onlineFollowersByHour": {}
  }
  ```

  ```json 400: Incorrect date theme={"system"}
  {
    "action": "request",
    "status": "error",
    "code": 101,
    "message": "Missing or incorrect parameters. Please verify with the docs. .../ayrshare.com/rest-api/endpoints"
  }
  ```
</ResponseExample>
