> ## 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 historical count of your Instagram followers online per hour for a given day, so you can optimize posting times for maximum engagement.

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

<ul>
  <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.
  </li>
</ul>

## Header Parameters

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## Query Parameters

**date** `string` *required*

A day with format: `YYYY-MM-DD`, for example `2026-07-08`. A date with a time returns error `101`.

**formatUTC** `boolean` (default: false)

Format the output with UTC start and end dates. To get the default output, leave this parameter out.

```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}");
           }
       }
   }
}
```

```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"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.