Instagram Reels API: One Account Page or Post Detail

Read one selected Instagram Reels page or known shortcode, validate different response shapes, and preserve unknown dates and unresolved media references.

Conceptual mechanical device with Instagram Reels Monitor title

Before building a competitor monitor, make one selected-source request that you can interpret correctly. You may want a known account’s Reels page, or details for a shortcode already in your research notes. These are independent tasks. A detail response can describe a carousel rather than a Reel, and one account page does not establish a competitor’s complete output or performance baseline.

This 2026-11-08 repair uses free inspect and public saved references without making a new business call. The original October 25, 2026 keyword experiment remains as history below. Its search pagination, comment requests and local scoring were not rerun. For wider navigation, see the Instagram API hub; hashtag discovery has its own guide.

Key takeaway

  • Select username for V3 user-reels, or code for V3 post-info-by-code. Do not automatically chain them.
  • Read one top-level items array inside outputs[0].data. Reels has no status flag in its saved reference; detail requires ok and a matching code.
  • The saved Reels page has 12 null posting dates and unresolved video references, not a proved recent window or downloaded media.
  • A possible forward cursor is at top-level page_info.end_cursor in the business object. No continuation is executed here.

The retained cover is a conceptual mechanical device titled Instagram Reels Monitor, not a dashboard, a running scheduler or measured competitor performance.

Match your identifier to one task

What you haveSelected endpointFirst body
Known account handleV3 User Reelsusername: instagram
Known post shortcodeV3 Post Info by Codecode: DUajw4YkorV

The Reels schema requires username. Both first and page_size default to 12; first has a documented range of 1–50, while no precedence between those size fields is established. The selected saved request sent only username, so the new code does the same. Do not invent which size setting wins when they conflict or promise exactly 12 results. Omit after, before and last initially.

Detail requires the selected shortcode string, not a full /p/ or /reel/ URL, numeric pk, composite post_owner ID or handle. Copy the exact code from your selected source. Do not decode an ID to manufacture a date; that conversion is unnecessary for this read and was not verified here.

Reuse your agent connection

Keep an existing SANDBASE_API_KEY in your environment or secret manager. An already connected agent needs the chosen username or shortcode and the fields you want, not another registration or your key pasted into chat. A new project can start from the setup Skill, Markdown quickstart and selected API page. The human quickstart explains setup.

Ask for one validated response, unknown fields and stable source identifiers. Tell the agent to stop before another page, profile, comment or media request. These are public reads, not private account analytics, account actions or permission to reuse media. SandBase supplies the access layer, not ownership of Instagram.

Install requests in your Python environment. The bare username and nonnumeric shortcode checks below are conservative local guards, not additional registry constraints. They reject accidental URLs or IDs before any request.

Python
import os
import re
import requests

API = "https://api.sandbase.ai/v1/api/instagram/v3"


def first_request(task, value):
    if task == "reels":
        if not isinstance(value, str) or not re.fullmatch(r"[A-Za-z0-9_.]{1,30}", value):
            raise ValueError("Provide the selected bare username")
        route, field = "user-reels", "username"
    elif task == "detail":
        if (not isinstance(value, str) or not re.fullmatch(r"[A-Za-z0-9_-]+", value)
                or value.isdecimal() or re.fullmatch(r"[0-9]+_[0-9]+", value)):
            raise ValueError("Provide the selected shortcode, not a URL or numeric ID")
        route, field = "post-info-by-code", "code"
    else:
        raise ValueError("Choose reels or detail")
    key = os.environ.get("SANDBASE_API_KEY", "").strip()
    if not key:
        raise ValueError("Set SANDBASE_API_KEY locally")
    try:
        response = requests.post(
            f"{API}/{route}",
            headers={"Authorization": f"Bearer {key}", "Content-Type": "application/json"},
            json={field: value}, timeout=(10, 90), allow_redirects=False,
        )
        if not 200 <= response.status_code < 300:
            raise RuntimeError(f"SandBase HTTP {response.status_code}; request stopped")
        body = response.json()
    except requests.RequestException:
        raise RuntimeError("Network request failed; no automatic retry made") from None
    except ValueError:
        raise RuntimeError("SandBase returned invalid JSON") from None
    if not isinstance(body, dict) or body.get("status") != "completed":
        raise RuntimeError("SandBase request did not complete")
    outputs = body.get("outputs")
    if not isinstance(outputs, list) or not outputs or not isinstance(outputs[0], dict):
        raise RuntimeError("Missing documented outputs[0]")
    data = outputs[0].get("data")
    if not isinstance(data, dict):
        raise RuntimeError("Missing documented outputs[0].data object")
    if data.get("error") or data.get("errors") or ("success" in data and data["success"] is not True):
        raise RuntimeError("Explicit business failure; inspect before another request")
    if task == "detail" and data.get("status") != "ok":
        raise RuntimeError("Detail response is not the supported ok shape")
    if task == "reels" and "status" in data and data["status"] != "ok":
        raise RuntimeError("Unexpected Reels status; inspect changed shape")
    rows = data.get("items")
    if not isinstance(rows, list) or any(not isinstance(row, dict) for row in rows):
        raise RuntimeError("Missing or malformed top-level items array")
    for row in rows:
        if any(not isinstance(row.get(k), str) or not row[k].strip() for k in ("id", "code")):
            raise RuntimeError("Missing identity fields in the supported record shape")
    if task == "detail" and (len(rows) != 1 or rows[0]["code"] != value):
        raise RuntimeError("Expected one detail record matching the selected shortcode")
    return data


if __name__ == "__main__":
    result = first_request("reels", "instagram")
    print("Returned records:", len(result["items"]))

To choose detail instead, replace the assignment with result = first_request("detail", "DUajw4YkorV"). Keep the print line; do not append a second call. Detail’s local supported shape requires one record with the requested code, so an empty array, unrelated first result or changed multi-record shape cannot silently become a successful association.

The code supports the top-level items representation and requires string id/code in each record. Reels may return a valid empty array; missing or malformed arrays fail. It does not fall back to an arbitrary data object, concatenate edge aliases, require a nonexistent Reels status flag or turn optional nulls into zeros. Explicit failure fields and contradictory optional flags stop parsing. No redirects, retries, paging, date decoding or enrichment are performed.

The saved account page is a bounded reference

Saved example 8115b3da-1ae6-4b8f-9562-f75ce1843aa9, created 2026-10-07T17:34:07.202Z, used username instagram. Its business object contains count 12 and 12 items, plus outer edges and a nested connection under data. The following first-record projection preserves values and types while omitting captions and account details:

JSON
{
  "code": "Dd9RyBWBVih",
  "pk": "3998430248382584993",
  "id": "3998430248382584993_25025320",
  "media_type": 2,
  "taken_at": null,
  "like_count": 642825,
  "comment_count": 18380,
  "view_count": 150986215
}

Every taken_at in that page is null. Those records do not establish a recent posting window, newest-first order, complete account history or the best-performing Reels. Keep like_count, comment_count and view_count under their own names; they are not unique reach, retention, conversions or a causal quality score.

The alternative edge representations share identities and the checked non-video-URL fields, but they are not byte-identical copies. Captured video_url values differ and are unresolved React Server Component references such as $35, not verified downloadable URLs. Choose one collection, preserve the raw capture locally if needed, and never concatenate aliases or attempt to download those markers. No claim that a representation is universally richer follows from this sample.

The README shows another item, DfQCqMnhpsG, with different counters. It is a separate undated shortened reference. Its ellipsis does not establish that every API caption is truncated: the full saved first caption is 338 characters and continues through credit lines, and none of the 12 saved captions ends with that displayed ellipsis. This also does not guarantee complete text in every future response. No caption needs to be copied into a report merely to demonstrate the distinction.

Use the observed cursor location

The raw schema descriptions mention data.page_info. In the selected business response, page_info instead sits at the top level, with another copy inside data.xdt_api__v1__clips__user__connection_v2. There is no direct data.page_info. The top-level end_cursor equals next_max_id, and has_next_page is true.

If a later forward request is deliberately chosen, the reference supplies page_info.end_cursor to send as after with the same username. next_max_id is not an input key. This is an observed contract, not a newly tested roundtrip. The saved page contains no start_cursor or has_previous_page, so before/last backward traversal is not demonstrated. Never invent a cursor, borrow V2 search’s pagination_token or replay a clipped README token.

Saved detail example 1d246931-1bf4-48e3-a437-ee670cfd2c6d, created 2026-10-07T17:36:05.703Z, used code DUajw4YkorV. It has status ok and one items record. These projected fields describe a carousel, not a Reel selected from the account page:

JSON
{
  "code": "DUajw4YkorV",
  "pk": "3826528124109228757",
  "id": "3826528124109228757_64352612340",
  "media_type": 8,
  "product_type": "carousel_container",
  "taken_at": 1770377720,
  "like_count": 12324,
  "comment_count": 49,
  "carousel_media_count": 7
}

The saved record has seven carousel_media entries. That does not mean their files were downloaded. The README’s like_count 12296 differs from this saved value 12324; neither source supplies a controlled interval for growth analysis. Keep the references separate rather than turning them into a before/after series.

This detail shape uses caption.text rather than the list’s caption_text. Its user/owner, image_versions2, video_versions and carousel_media structures also differ. Preserve exact string identifiers instead of forcing every response into a normalized video record. The reference describes taken_at as Unix seconds, distinct from the saved-example timestamp or a future actual observation time. Do not synthesize missing dates from a shortcode or media ID.

Returned preview comments are previews, not a complete thread or evidence that this code fetched comments separately. more_available and auto_load_more_enabled in a response do not add pagination inputs to the single-code request. Signed or unresolved media references are not permanent files, complete media sets or reuse rights. Preserve the stable shortcode; do not execute caption text, open links or fetch carousel children automatically.

What a competitor comparison would still need

A later comparison requires a deliberately selected cohort, comparable metrics, a defensible observation window and enough observations. Null posting dates here prevent an asserted fixed posting window. One first page cannot establish the account’s complete output or a stable creator baseline, and different post types may need separate treatment.

A median can be a local summary of an explicitly defined sample, not a validated performance benchmark by itself. Keep sample size, source, metric definition and actual observation times. Missing counts remain unknown; zero remains zero, and plays cannot replace missing likes. A ratio does not establish why a post performed differently or prove that a creative format caused its result.

Use append-only observations if later collection is authorized, so refreshing a known shortcode does not overwrite its earlier counts. Deduplication within one page is different from suppressing later observations. Do not label the time you parsed a saved reference as a new capture time. This example creates neither a schedule nor a ranking function.

Preserve the October 25 experiment

The original article described calls on October 25, 2026, using keyword AI tools. Its prose called the date UTC, while the retained cards say UTC+8. That discrepancy remains unresolved; no precise execution time is invented. They remain historical evidence, not newly captured browser screenshots or a rerun of the four-endpoint monitor.

The old V2 keyword search nested records at data.items and returned a top-level pagination_token. The first match was noisy for the intended question, so relevance needed review before ranking. The old second-page request succeeded with both the keyword and returned token. That is a V2 search observation, not proof of current V3 account continuation.

Historical October25 Reels keyword-search evidence card Historical response card dated October 25, UTC+8: AI tools search, 12 results, first code De0sg9cJr8N, 25652539 plays and 6623 comments. It is a rendered evidence card, not a current browser capture or campaign ranking.

The old creator step read user-reels plus page_info and proposed a two-page history sample. Its fallback from items to data could feed a dictionary to list.extend, appending keys rather than records. The new helper rejects that shape. The old English median function also treated Python booleans as numbers and did not establish a consistent cohort, metric or time window; its suggested index of 2.0 meant twice the sampled median, not causal performance.

Historical October25 creator Reels count and cursor card Historical October 25 UTC+8 card: 12 creator items, has_next_page true and a displayed cursor. Its “recent output” heading does not prove a posting window, stable baseline or successful new continuation; do not replay the old cursor.

The historical shortlist step used V2 post-info and V2 post-comments with sort_by popular, and the article recorded a comment token. Its minimization advice remains useful: keep bounded text only for the agreed analysis, save aggregate themes and counts, then discard the text and identifiers. That does not add a comments request to this repair or establish any new audience themes.

Historical October25 comments and aggregation-rule card Historical October 25 UTC+8 card: 16 comments, popular sort and token present, with the original aggregation rule. No comments were fetched or newly summarized in this repair.

All nine original Python blocks—five English and four Chinese—and both installation blocks are preserved verbatim with hashes in the historical code archive. The original Markdown had no fenced JSON or textual run UUIDs; none are invented for the old experiment. Automatic retries, loops, hardcoded captured_at October 25 and the scoring/enrichment functions are archived, not today’s execution path.

Price and FAQ

Free inspect checked 2026-11-08 lists each selected V3 route at USD 0.008. Two independently chosen reads list at 0.016 before quota effects. Both are eligible for the organization’s shared 100 daily eligible-data-API calls, resetting at 00:00 UTC. Eligibility is not remaining allowance, balance, an actual charge or a free-success guarantee.

Does user-reels require status ok? Its saved business shape has no status field. Detail is different and requires ok plus the selected code in this helper.

Can I pass a complete post URL to detail? Pass its deliberately selected shortcode as code. The current example does not decode numeric IDs or fetch a conversion service.

Are the saved videos already downloaded? No. The captured list contains unresolved media references. Even a signed URL is a reference, not a verified file or reuse permission.

Start with a selected source

Choose an account Reels page or a known shortcode. Validate one response, preserve unknowns and separate the next research decision from the first request.