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

Get an Instagram post or reel by URL

One post or reel by shortcode, id or URL. Complete code for GET /v1/instagram/posts/{post} in six languages and both official SDKs, each tested against the documented response.

Short answer. One call returns one post or reel: caption, media_type, taken_at, like, comment and view counts, owner, location, audio and carousel items. {post} takes a shortcode, a numeric id or a URL-encoded instagram.com link.

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

Why call it

  • Turn links that users paste into structured data in a clipping or content-research tool.
  • Pull caption, owner and counts for one campaign post into a client report.
  • Let an AI agent read a post from a shared link.

The request

GET https://api.handlehaul.com/v1/instagram/posts/{post} with your key in the X-Api-Key header. One post or reel by shortcode, id or URL. One post or reel by shortcode, id or URL. 1 credit. Docs: https://api.handlehaul.com/docs/instagram-post-api

Parameters for One post or reel by shortcode, id or URL
ParameterInDescription
post requiredpathPost shortcode, numeric post id, or an instagram.com/p|reel URL (URL-encoded).
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-post.sh

# One post or reel by shortcode, id or URL. --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/posts/C9xYzAbCdEf" \
  -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, from the API docs. Lists are cut to two rows here.

200 · application/json
{
  "data": {
    "id": "3500000000000000123",
    "shortcode": "DCSf3TJ3gB7",
    "url": "https://www.instagram.com/p/DCSf3TJ3gB7/",
    "taken_at": "2026-11-28T11:59:43.000Z",
    "media_type": "photo",
    "caption": "bloom river · sample post 1",
    "counts": {
      "likes": 915,
      "comments": 148,
      "views": null
    },
    "thumbnail_url": "https://scontent.cdninstagram.com/…/8637327854758358242.jpg",
    "video_url": null,
    "duration_seconds": null,
    "owner": {
      "id": "6393149904",
      "username": "nomad.atelier17",
      "full_name": "Nomad Atelier",
      "is_private": false,
      "is_verified": false,
      "profile_pic_url": "https://scontent.cdninstagram.com/…/6393149904.jpg"
    },
    "location": {
      "id": "958349030",
      "name": "ivy Café"
    },
    "audio": null,
    "carousel": null
  },
  "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. Identical calls that arrive while an answer is cached are served from it. 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.
  • Private accounts. Public data only: a private account answers 403 private_account, and that call is free.
  • 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

  • URL-encode a link before passing it as {post}. The id is worked out locally from the URL or shortcode, so there is no extra call.
  • video_url, duration_seconds and counts.views are null on photos. location, audio and carousel can be null too.
  • To track counts on many posts, use /posts/stats: up to 20 posts in one call.

Next steps

Instagram post or reel API: questions

How do I get Instagram post data from a URL?
URL-encode the link and pass it as {post}, or pass the shortcode from the URL. The id is worked out locally, so there is no extra call.
Does the post route work for reels?
Yes. Pass a reel's shortcode, id or instagram.com/reel/ link. Posts and reels come back in the same shape.

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.