# Instagram Virality Meter – Reels & Posts Outlier Score (`sn41lz/instagram-virality-meter`) Actor

Measure how viral any Instagram Business or Creator account's Reels and posts are, with the official Instagram Graph API and your own token: views per hour, times above the account's normal, engagement, growth between runs and a 0-100 virality score.

- **URL**: https://apify.com/sn41lz/instagram-virality-meter.md
- **Developed by:** [Sergi Espí Zamora](https://apify.com/sn41lz) (community)
- **Categories:** Social media, Automation
- **Features:** Limited permissions
- **Stats:** 3 total users, 2 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$2.00 / 1,000 post measureds

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/actors/running/actors-in-store.md#pay-per-event

## What's an Apify Actor?

An Actor is a serverless cloud program that runs on the Apify platform. It has two run modes.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.

Apify vocabulary and the platform model are defined once, in the agent quickstart at https://apify.com/agents.md.

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.

Do not guess an integration path. Every one of them is in the agent quickstart at https://apify.com/agents.md: the Apify MCP server, Agent Skills with the Apify CLI, the JavaScript and Python clients, the REST API, and the account-free path for an agent with no human to sign in. It also carries the rule on stating cost before the first paid run.

For examples already wired to this Actor's own input schema, see the [API](#api) section below.

Each client library has reference documentation the quickstart does not restate: [JavaScript/TypeScript](https://docs.apify.com/api/client/js/docs.md) (`npm install apify-client`) and [Python](https://docs.apify.com/api/client/python/docs.md) (`pip install apify-client`).

# README

## Instagram Virality Meter – Reels & Posts Outlier Score (Official API)

Find out **which Reels and posts are going viral** on any public Instagram **Business or Creator** account, and **how fast**. For each post you get:

- views per hour,
- how many times it beats the account's own normal (outlier multiple),
- engagement rate,
- real growth since your last run, with whether it's **accelerating, steady or slowing**,
- a **0–100 virality score** with a documented formula. No black-box AI.

It uses the **official Instagram Graph API (Business Discovery)** with **your own access token**. There is no scraping, no login to Instagram and no proxy, so it doesn't break when Instagram changes its website.

### Who is it for?

- **Social media managers and agencies** spotting which competitor content is taking off this week.
- **Brands and influencer marketers** checking which creators' content really over-performs before paying for a collaboration.
- **Creators** learning which formats beat their own normal.
- **AI agents and dashboards** that need clean, typed numbers: one row per post, the same fields every time.

### How much does it cost?

**$2 per 1,000 posts** ($0.002 per post). There is no start fee and nothing else to pay: the Instagram Graph API is free.

| You measure | You pay |
|---|---|
| 5 accounts × 25 recent posts | $0.25 |
| 20 competitors × 50 posts, every 6 hours, only posts scoring 40+ | usually under $1 a month |

Posts removed by your filters (minimum score, only videos, maximum age) are **not charged**.

### How to get your access token (free, about 10 minutes, once)

The official API reads other accounts *through* your own Instagram professional account, so you need:

1. **An Instagram professional account.** In the Instagram app go to Settings → Account type and switch to **Business** or **Creator** (free). Then **link it to a Facebook Page** you manage (Instagram → Edit profile → Page).
2. **A Meta app.** Go to [developers.facebook.com/apps](https://developers.facebook.com/apps) → *Create app* → choose a **Business** type app. No review is needed while you only use it yourself.
3. **A token.** Open the [Graph API Explorer](https://developers.facebook.com/tools/explorer/):
   - pick your app;
   - choose **Get User Access Token**;
   - add the permissions `instagram_basic`, `pages_show_list` and `pages_read_engagement` (add `business_management` if your Page belongs to a Business Manager);
   - click **Generate Access Token** and allow access to your Page.
4. **Make it last 60 days.** Paste the token in the [Access Token Debugger](https://developers.facebook.com/tools/debug/accesstoken/) and click **Extend Access Token**.
5. **Use it here.** Paste the long-lived token into **Your Instagram Graph API access token**. It's a secret field: Apify stores it encrypted, and this Actor only sends it to `graph.facebook.com`.

The Actor finds your Instagram account ID automatically from your Pages. If you manage several, set **Your Instagram account ID** under *Advanced*.

**Limits from Meta:**

- only Business and Creator accounts can be read (not personal or private ones);
- age-gated accounts return nothing;
- each lookup of up to 50 posts is one API call, and Meta allows up to 1,000 Business Discovery calls per hour per user.

### Input example

```json
{
  "accessToken": "EAAG… (secret)",
  "usernames": ["natgeo", "nasa", "https://www.instagram.com/redbull/"],
  "postsPerAccount": 30,
  "onlyVideos": true,
  "maxAgeDays": 7,
  "trackGrowth": true,
  "monitorName": "competitors",
  "minScore": 0
}
```

### Output example

One Reel on the second run of a tracked monitor (from our test suite, which uses data shaped like the sample responses in Meta's Business Discovery documentation):

```json
{
  "account": "bluebottle",
  "accountFollowers": 267793,
  "postId": "17858843269216389",
  "url": "https://www.instagram.com/reel/…/",
  "type": "REELS",
  "publishedAt": "2026-11-11T00:20:47+00:00",
  "ageHours": 22.0,
  "views": 120000,
  "likes": 5837,
  "comments": 50,
  "viewsPerHour": 5454.53,
  "engagementRatePct": 2.198,
  "engagementPerViewPct": 4.91,
  "baselinePosts": 3,
  "baselineMedian": 12000,
  "outlierMultiple": 10.0,
  "velocityMultiple": 91.81,
  "engagementMultiple": 1.6,
  "previousValue": 90000,
  "growthSinceLastRun": 30000,
  "recentPerHour": 14997.0,
  "trend": "accelerating",
  "viralityScore": 90,
  "viralityLabel": "viral",
  "scoreParts": {"outlier": 45.0, "velocity": 25.0, "engagement": 5.1, "momentum": 15.0},
  "dataSource": "Instagram Graph API (Business Discovery); scores are computed by this Actor, not by Instagram"
}
```

Rows are sorted by score within each account. The *Virality ranking* view shows the key columns as a table.

### How the numbers are calculated

All inputs are the public counts the API returns: `view_count` (videos and Reels), `like_count`, `comments_count`, `followers_count` and the publish time.

- **Primary metric:** views for videos and Reels. For photos and carousels, which have no public views, it's interactions = likes + comments.
- **Per hour:** primary metric ÷ the post's age in hours (minimum 1 hour).
- **Account normal (baseline):** the **median** of the same metric over the account's recent posts that you asked for (`postsPerAccount`), **separately for videos and for photos/carousels**. The median isn't skewed by one huge hit.
- **outlierMultiple** = primary metric ÷ the account's median. Example: 10 = ten times its normal.
- **velocityMultiple** = per-hour rate ÷ the account's median per-hour rate. It favours fresh posts that are already moving fast.
- **engagementRatePct** = (likes + comments) ÷ followers × 100. **engagementMultiple** = that rate ÷ the account's median rate.
- **Tracking mode:**
  - **growthSinceLastRun** = metric now − metric at the last run.
  - **recentPerHour** = that growth ÷ the hours between runs.
  - **trend** compares recentPerHour with the previous interval's rate (or, the first time, with the post's lifetime rate): ≥ 1.2× is `accelerating`, ≤ 0.8× is `slowing`, otherwise `steady`.

**Virality score (0–100).** Let `pts(x, F) = 0` if x ≤ 1, otherwise `min(1, log2(x) / log2(F))`:

| Part | Points | Full points at |
|---|---|---|
| outlier | 45 × pts(outlierMultiple, 8) | 8× the account's normal |
| velocity | 25 × pts(velocityMultiple, 8) | 8× its normal speed |
| engagement | 15 × pts(engagementMultiple, 4) | 4× its normal engagement |
| momentum (tracking only) | 15 × min(1, (recentPerHour ÷ lifetime per-hour rate) ÷ 2) | growing twice its lifetime pace |

Without tracking, the first three parts are scaled up to 100. **Labels:** 70+ `viral`, 40–69 `rising`, below 40 `normal`. A post at or below the account's normal scores 0, so the score is always relative to the account, never absolute.

### Notes

- **What the scores are:** our own analysis of public API data, not numbers published by Instagram. Every row says so in `dataSource`.
- **Views include paid views:** Meta's `view_count` includes paid and organic views and, since April 2026, Facebook views of cross-posted videos. Accounts that hide like counts return no likes.
- **No personal data is added:** you choose the accounts. Only public professional-account metrics are returned; captions only if you ask. Growth history stays in your own Apify account (a key-value store named `instagram-virality-monitors`) and posts are forgotten after 30 days.
- **Your token** is used only for the calls you ask for, and you can revoke it at any time in your Facebook settings. Use of the API is subject to [Meta's Platform Terms](https://developers.facebook.com/terms/).
- **Without a token or accounts**, the run ends successfully with a message and charges nothing.

# Actor input Schema

## `accessToken` (type: `string`):

A Facebook User access token from your own Meta app with the permissions instagram_basic, pages_show_list and pages_read_engagement. It is stored encrypted and only used to call the official Instagram Graph API. See 'How to get your access token' in the README (about 10 minutes, free).

## `usernames` (type: `array`):

Usernames of public Instagram Business or Creator accounts, e.g. 'natgeo' or 'https://www.instagram.com/nasa/'. Personal accounts can't be read through the official API.

## `postsPerAccount` (type: `integer`):

How many of each account's latest posts to measure. They are also the account's baseline (its 'normal').

## `onlyVideos` (type: `boolean`):

Leave out photos and carousels.

## `maxAgeDays` (type: `integer`):

0 = no limit. All recent posts still count for the account's baseline.

## `minScore` (type: `integer`):

Only return posts with at least this score (0-100). Filtered posts are not charged.

## `trackGrowth` (type: `boolean`):

Remember each post's numbers so the next run with the same settings shows real growth since then, its speed per hour and whether the post is accelerating, steady or slowing. Schedule it (e.g. every 6 hours). History is kept for 30 days.

## `monitorName` (type: `string`):

Runs with the same name share one growth history, e.g. 'competitors'. Leave empty for one history per set of accounts.

## `includeCaption` (type: `boolean`):

Add the post caption (up to 2,000 characters).

## `maxItems` (type: `integer`):

Stop after saving this many posts. 0 = no limit.

## `igUserId` (type: `string`):

The numeric ID of YOUR Instagram professional account that the lookups run from. Leave empty to find it automatically from your token's Facebook Pages.

## `graphApiVersion` (type: `string`):

Change only if Meta retires this version.

## Actor input object example

```json
{
  "usernames": [
    "natgeo",
    "nasa"
  ],
  "postsPerAccount": 25,
  "onlyVideos": false,
  "maxAgeDays": 0,
  "minScore": 0,
  "trackGrowth": false,
  "includeCaption": false,
  "maxItems": 20,
  "graphApiVersion": "v27.0"
}
```

# Actor output Schema

## `overview` (type: `string`):

No description

## `results` (type: `string`):

No description

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "usernames": [
        "natgeo",
        "nasa"
    ],
    "maxItems": 20
};

// Run the Actor and wait for it to finish
const run = await client.actor("sn41lz/instagram-virality-meter").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "usernames": [
        "natgeo",
        "nasa",
    ],
    "maxItems": 20,
}

# Run the Actor and wait for it to finish
run = client.actor("sn41lz/instagram-virality-meter").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "usernames": [
    "natgeo",
    "nasa"
  ],
  "maxItems": 20
}' |
apify call sn41lz/instagram-virality-meter --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,sn41lz/instagram-virality-meter"
        }
    }
}
```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/G62XZalGEMvGhTNQ5/builds/WPPiJqAwOHMLVPHa2/openapi.json
