# Instagram Post Growth Delta & Client Report (`bread-kim/instagram-post-growth-delta`) Actor

Compare two customer-provided Instagram post metric snapshots. Calculate likes, comments, and view growth, flag missing, duplicate, or decreasing metrics, and export client-ready CSV files and reports.

- **URL**: https://apify.com/bread-kim/instagram-post-growth-delta.md
- **Developed by:** [bread kim](https://apify.com/bread-kim) (community)
- **Security:** Limited permissions
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

$20.00 / 1,000 results

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 Post Growth Delta & Client Report

This private Apify Actor compares two customer-authorized exports of the same Instagram posts. It calculates counter changes inside the capture interval and produces auditable JSON, CSV, and Markdown files. It does not log in to, scrape, or call Instagram.

### Use it

Project each authorized upstream row to only `shortCode`, `ownerUsername`, `type`, `likesCount`, `commentsCount`, and `videoViewCount`. Record the real UTC capture time and a non-secret `sourceRef`. Submit the earlier snapshot as `previous` and the later snapshot as `current`; see [examples/input.json](examples/input.json).

`ownerUsername` accepts one optional leading `@`, strips it, and normalizes casing to lowercase. A count of `0` is real zero. `-1`, `null`, or an omitted counter is unknown. Both snapshots must use `PUBLIC_POST_COUNTERS`. The Actor does not retrieve automatically saved state or historic data; keep the previous capture yourself or supply it through an approved upstream automation.

For valid input, the default dataset contains exactly one authoritative OUTPUT record. The private key-value-store logical record keys are `OUTPUT`, `DELTAS.csv`, `REVIEW_REQUIRED.csv`, `REPORT.JSON`, `REPORT.MD`, `SNAPSHOT_TEMPLATE.json`, and `MANIFEST.JSON`. `REPORT.JSON` is the compact authoritative output. The manifest retains those logical keys and hashes the actual UTF-8 bytes of every other emitted record.

### Interpretation

`COMPARABLE` means all three counters were observed and none decreased. `PARTIAL` preserves known metrics while excluding unknown metrics from coverage. A decrease remains a signed delta under `COUNTER_DECREASE`; it is never described as growth. `MISSING_CURRENT` means not observed now, not deleted. `FIRST_OBSERVED` means not observed before, not newly published. Identity and duplicate conflicts are retained for review rather than merged.

This is not a reach, impression, follower, unique-person, ROI, fraud, legal-compliance, or causal creative-winner tool. Customer data is not independently verified. Spreadsheet subtraction is a free alternative.

### Local verification

Requires Node.js 22.23.3.

```sh
npm ci --ignore-scripts
npm test
npm run typecheck
npm run build
AUTOMATON_CONTAINER_SMOKE=1 node dist/main.js
```

Normal local storage uses an absolute `CRAWLEE_STORAGE_DIR` with input at `key_value_stores/default/INPUT.json`. Local record files follow the content type: JSON records use `.json`, Markdown records use `.md`, and CSV records use `.csv`, without adding a duplicate extension case-insensitively. Thus logical `OUTPUT` is stored at `key_value_stores/default/OUTPUT.json`; already suffixed names such as `REPORT.JSON`, `REPORT.MD`, and `DELTAS.csv` are unchanged. This filename mapping is local only; remote record keys and API requests remain unchanged.

The smoke-only path is selected exclusively by `AUTOMATON_CONTAINER_SMOKE=1`, runs a bounded built-in snapshot through the production comparison and checks its delta/status invariants without storage or network calls, then exits successfully.

# Actor input Schema

## `previous` (type: `object`):

Earlier authorized snapshot.

## `current` (type: `object`):

Later authorized snapshot, no more than 366 days after the previous snapshot.

## Actor input object example

```json
{
  "previous": {
    "capturedAt": "2026-10-01T00:00:00Z",
    "sourceRef": "DemoBefore",
    "metricBasis": "PUBLIC_POST_COUNTERS",
    "items": [
      {
        "shortCode": "DemoReel1",
        "ownerUsername": "demo_creator",
        "type": "Reel",
        "likesCount": 100,
        "commentsCount": 10,
        "videoViewCount": 1000
      },
      {
        "shortCode": "HiddenLikes",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": -1,
        "commentsCount": 0,
        "videoViewCount": null
      },
      {
        "shortCode": "Decreased",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": 10,
        "commentsCount": 1,
        "videoViewCount": null
      },
      {
        "shortCode": "PreviousOnly",
        "ownerUsername": "demo_creator",
        "type": "Sidecar",
        "likesCount": 20,
        "commentsCount": 2,
        "videoViewCount": null
      }
    ]
  },
  "current": {
    "capturedAt": "2026-10-02T00:00:00Z",
    "sourceRef": "DemoAfter",
    "metricBasis": "PUBLIC_POST_COUNTERS",
    "items": [
      {
        "shortCode": "DemoReel1",
        "ownerUsername": "demo_creator",
        "type": "Reel",
        "likesCount": 160,
        "commentsCount": 18,
        "videoViewCount": 1450
      },
      {
        "shortCode": "HiddenLikes",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": null,
        "commentsCount": 2,
        "videoViewCount": -1
      },
      {
        "shortCode": "Decreased",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": 8,
        "commentsCount": 1,
        "videoViewCount": null
      },
      {
        "shortCode": "CurrentOnly",
        "ownerUsername": "demo_creator",
        "type": "Video",
        "likesCount": 5,
        "commentsCount": 0,
        "videoViewCount": 25
      }
    ]
  }
}
```

# Actor output Schema

## `output` (type: `string`):

The exact authoritative result also copied once to the default dataset.

## `dataset` (type: `string`):

Exactly one authoritative OUTPUT record for valid input.

## `deltasCsv` (type: `string`):

Private one-row-per-post interval evidence.

## `reviewRequiredCsv` (type: `string`):

Posts whose evidence needs manual review.

## `reportJson` (type: `string`):

Compact JSON copy of authoritative OUTPUT.

## `reportMarkdown` (type: `string`):

Readable interval report and limitations.

## `snapshotTemplate` (type: `string`):

Minimal projection template for a future authorized capture.

## `manifest` (type: `string`):

UTF-8 byte sizes and SHA-256 hashes for every other emitted record.

# 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 = {
    "previous": {
        "capturedAt": "2026-10-01T00:00:00Z",
        "sourceRef": "DemoBefore",
        "metricBasis": "PUBLIC_POST_COUNTERS",
        "items": [
            {
                "shortCode": "DemoReel1",
                "ownerUsername": "demo_creator",
                "type": "Reel",
                "likesCount": 100,
                "commentsCount": 10,
                "videoViewCount": 1000
            },
            {
                "shortCode": "HiddenLikes",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": -1,
                "commentsCount": 0,
                "videoViewCount": null
            },
            {
                "shortCode": "Decreased",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": 10,
                "commentsCount": 1,
                "videoViewCount": null
            },
            {
                "shortCode": "PreviousOnly",
                "ownerUsername": "demo_creator",
                "type": "Sidecar",
                "likesCount": 20,
                "commentsCount": 2,
                "videoViewCount": null
            }
        ]
    },
    "current": {
        "capturedAt": "2026-10-02T00:00:00Z",
        "sourceRef": "DemoAfter",
        "metricBasis": "PUBLIC_POST_COUNTERS",
        "items": [
            {
                "shortCode": "DemoReel1",
                "ownerUsername": "demo_creator",
                "type": "Reel",
                "likesCount": 160,
                "commentsCount": 18,
                "videoViewCount": 1450
            },
            {
                "shortCode": "HiddenLikes",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": null,
                "commentsCount": 2,
                "videoViewCount": -1
            },
            {
                "shortCode": "Decreased",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": 8,
                "commentsCount": 1,
                "videoViewCount": null
            },
            {
                "shortCode": "CurrentOnly",
                "ownerUsername": "demo_creator",
                "type": "Video",
                "likesCount": 5,
                "commentsCount": 0,
                "videoViewCount": 25
            }
        ]
    }
};

// Run the Actor and wait for it to finish
const run = await client.actor("bread-kim/instagram-post-growth-delta").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 = {
    "previous": {
        "capturedAt": "2026-10-01T00:00:00Z",
        "sourceRef": "DemoBefore",
        "metricBasis": "PUBLIC_POST_COUNTERS",
        "items": [
            {
                "shortCode": "DemoReel1",
                "ownerUsername": "demo_creator",
                "type": "Reel",
                "likesCount": 100,
                "commentsCount": 10,
                "videoViewCount": 1000,
            },
            {
                "shortCode": "HiddenLikes",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": -1,
                "commentsCount": 0,
                "videoViewCount": None,
            },
            {
                "shortCode": "Decreased",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": 10,
                "commentsCount": 1,
                "videoViewCount": None,
            },
            {
                "shortCode": "PreviousOnly",
                "ownerUsername": "demo_creator",
                "type": "Sidecar",
                "likesCount": 20,
                "commentsCount": 2,
                "videoViewCount": None,
            },
        ],
    },
    "current": {
        "capturedAt": "2026-10-02T00:00:00Z",
        "sourceRef": "DemoAfter",
        "metricBasis": "PUBLIC_POST_COUNTERS",
        "items": [
            {
                "shortCode": "DemoReel1",
                "ownerUsername": "demo_creator",
                "type": "Reel",
                "likesCount": 160,
                "commentsCount": 18,
                "videoViewCount": 1450,
            },
            {
                "shortCode": "HiddenLikes",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": None,
                "commentsCount": 2,
                "videoViewCount": -1,
            },
            {
                "shortCode": "Decreased",
                "ownerUsername": "demo_creator",
                "type": "Image",
                "likesCount": 8,
                "commentsCount": 1,
                "videoViewCount": None,
            },
            {
                "shortCode": "CurrentOnly",
                "ownerUsername": "demo_creator",
                "type": "Video",
                "likesCount": 5,
                "commentsCount": 0,
                "videoViewCount": 25,
            },
        ],
    },
}

# Run the Actor and wait for it to finish
run = client.actor("bread-kim/instagram-post-growth-delta").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 '{
  "previous": {
    "capturedAt": "2026-10-01T00:00:00Z",
    "sourceRef": "DemoBefore",
    "metricBasis": "PUBLIC_POST_COUNTERS",
    "items": [
      {
        "shortCode": "DemoReel1",
        "ownerUsername": "demo_creator",
        "type": "Reel",
        "likesCount": 100,
        "commentsCount": 10,
        "videoViewCount": 1000
      },
      {
        "shortCode": "HiddenLikes",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": -1,
        "commentsCount": 0,
        "videoViewCount": null
      },
      {
        "shortCode": "Decreased",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": 10,
        "commentsCount": 1,
        "videoViewCount": null
      },
      {
        "shortCode": "PreviousOnly",
        "ownerUsername": "demo_creator",
        "type": "Sidecar",
        "likesCount": 20,
        "commentsCount": 2,
        "videoViewCount": null
      }
    ]
  },
  "current": {
    "capturedAt": "2026-10-02T00:00:00Z",
    "sourceRef": "DemoAfter",
    "metricBasis": "PUBLIC_POST_COUNTERS",
    "items": [
      {
        "shortCode": "DemoReel1",
        "ownerUsername": "demo_creator",
        "type": "Reel",
        "likesCount": 160,
        "commentsCount": 18,
        "videoViewCount": 1450
      },
      {
        "shortCode": "HiddenLikes",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": null,
        "commentsCount": 2,
        "videoViewCount": -1
      },
      {
        "shortCode": "Decreased",
        "ownerUsername": "demo_creator",
        "type": "Image",
        "likesCount": 8,
        "commentsCount": 1,
        "videoViewCount": null
      },
      {
        "shortCode": "CurrentOnly",
        "ownerUsername": "demo_creator",
        "type": "Video",
        "likesCount": 5,
        "commentsCount": 0,
        "videoViewCount": 25
      }
    ]
  }
}' |
apify call bread-kim/instagram-post-growth-delta --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,bread-kim/instagram-post-growth-delta"
        }
    }
}
```

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/mm3XUXUhC86Qib0s7/builds/35gFLaDQtaec4pcmL/openapi.json
