Skip to content

Instagram Profile Post Count API

The total post count on a public Instagram profile, exact wherever Instagram publishes the exact figure. Call this when a fuller profile is not needed. source names which of the two dialects Instagram ships a count in carried it (edge_owner_to_timeline_media.count or media_count). Instagram does not expose this metadata for every profile: when neither is present, postCount is null and the request is not charged. Calls cost 1 credit each. A cache hit is free, and a failed or empty response is never charged.

Try it

Prefilled with the request that produced the example below. No key yet? Get a free key.

Request

GET/v1/instagram/profile-post-count
ParameterTypeRequiredDescription
handlestringyesHandle (@nike), or a full instagram.com profile URL

Also accepts cache_max_age (a hit costs 0 credits) and include_raw (returns the untouched upstream payload under raw).

curl
curl "$API/v1/instagram/profile-post-count?handle=natgeo&cache_max_age=7d" \
  -H "x-api-key: $KEY"
JavaScript
const query = new URLSearchParams({
  handle: 'natgeo',
  cache_max_age: '7d',
});

const response = await fetch(`${API}/v1/instagram/profile-post-count?${query}`, {
  headers: { 'x-api-key': KEY },
});

const body = await response.json();
if (!body.success) throw new Error(body.error.code);

// 1 credit, 0 on a cache hit
console.log(body.data, body.meta.creditsCharged);
Python
import os, httpx

r = httpx.get(
    f"{os.environ['API']}/v1/instagram/profile-post-count",
    params={
        "handle": "natgeo",
        "cache_max_age": "7d",
    },
    headers={"x-api-key": os.environ["KEY"]},
    timeout=30,
)

body = r.json()
if not body["success"]:
    raise RuntimeError(body["error"]["code"])

print(body["data"], body["meta"]["creditsCharged"])

Example response

Captured on , with raw removed and lists cut to two items. A live call returns current data.

response
{
  "success": true,
  "data": {
    "platform": "instagram",
    "handle": "natgeo",
    "postCount": 32100,
    "source": "api",
    "fetchedAt": "2026-10-21T01:52:32.904Z"
  },
  "meta": {
    "platform": "instagram",
    "endpoint": "instagram.profilePostCount",
    "creditsCharged": 1,
    "cached": false,
    "cacheAgeSeconds": null,
    "durationMs": 3035,
    "requestId": "req_060jiyavkdp9l82k0he6"
  }
}

Returns

Returns an object with platform, handle, postCount, source, fetchedAt, reason.

Fields
FieldTypePresentDescription
platform"instagram"always
handlestringalways
postCountnumber | nullalways
sourcegraphql | api | nullalwaysWhich dialect carried the count. Null when neither did.
fetchedAtstringalways
reasonstringmay be absentPresent only when `postCount` is null. That response is not charged.

Cost and behaviour

Credits1 per live request, 0 on a cache hit
Cacheableyes: cache_max_age accepts a cached copy
Batchableyes: usable as a target in POST /v1/jobs/batch
Subscribableyes: as often as every 3600 seconds, firing a webhook only on a change

Other Instagram endpoints