Tutorial · Instagram · cURL, Python, Node.js, PHP, Go, Ruby

Get an Instagram hashtag's post count

A hashtag and its post count. Complete code for GET /v1/instagram/hashtags/{tag} in six languages and both official SDKs, each tested against the documented response.

Short answer. One call returns one hashtag: id, name and post_count, the number of posts Instagram shows for it. The tag works with or without #.

Facts checked 2 December 2026. Prices change: follow the links before you decide.

Why call it

  • Size a niche before a campaign by comparing post_count across candidate hashtags.
  • Track a branded hashtag's growth in reports by storing its count on a schedule.

The request

GET https://api.handlehaul.com/v1/instagram/hashtags/{tag} with your key in the X-Api-Key header. A hashtag and its post count. A hashtag and its post count. 1 credit. Docs: https://api.handlehaul.com/docs/instagram-hashtag-api

Parameters for A hashtag and its post count
ParameterInDescription
tag requiredpathHashtag, with or without #.
freshquerytrue skips the cache (full price).

Code in 6 languages

Each sample is a complete program: it reads the key from HANDLEHAUL_API_KEY, waits and retries when the API answers 429 (using Retry-After), stops with the error code on anything else. The SDK versions do the retries for you.

instagram-hashtag.sh

# A hashtag and its post count. --retry waits out a 429 using its Retry-After header;
# --fail exits with code 22 on any other error (drop it to read the error JSON).
curl -sS --fail --retry 3 "https://api.handlehaul.com/v1/instagram/hashtags/coffee" \
  -H "X-Api-Key: $HANDLEHAUL_API_KEY"
Generated from the OpenAPI spec (2026-12-02); every sample was syntax-checked and run against a local mock serving the response below. Language guides: Python, Node.js, PHP, Go, Ruby, cURL.

Response

One object in data and meta with what the call cost. Example values; hashtag shape from the openapi schema; example values, from the API docs. Lists are cut to two rows here.

200 · application/json
{
  "data": {
    "id": "17843853986012965",
    "name": "coffee",
    "post_count": 41823117
  },
  "meta": {
    "request_id": "req_…",
    "cached": false,
    "cache_age_seconds": 0,
    "credits_charged": 1,
    "credits_remaining": 26943
  }
}

Cost, cache and limits

  • 1 credit per call. At $1.40 to $0.80 per 1,000 calls. Cache hits, failed calls and 429 answers are free; meta.credits_charged says what each call cost.
  • Cache. Answers are cached for 15 minutes. Add fresh=true to force a live call (billed).
  • Speed. Over your plan's requests-per-second limit the API answers 429 rate_limited with Retry-After; the samples wait that long and retry.
  • Testing. A kd_test_ key returns sample data in this exact shape at no cost, so you can run the code before you spend anything.

Things to know

  • Pass the tag with or without #. If you include it, URL-encode it as %23.
  • This route returns the count only. For the posts, call /hashtags/{tag}/posts.

Next steps

Instagram hashtag API: questions

How many posts does an Instagram hashtag have?
Call GET /v1/instagram/hashtags/{tag}: post_count is the number Instagram shows.
Should I include the # when calling the hashtag API?
Either works. If you include it, encode it as %23 in the URL path.

Run it on real data

One key for Instagram and TikTok. $1.40 to $0.80 per 1,000 calls; failed calls and cache hits are free.

Want to test first? Sandbox keys are free and unlimited, with sample data in the live schema.