Skip to content
Endless Documentation

Instagram user posts

POST
/social/instagram_user_posts

Use when the user asks for top/most-liked/most-viewed/most-commented posts (e.g. 'top post of the week'). Returns recent Instagram posts (newest first) with engagement counts; sort and filter by taken_at (Unix seconds). For a VIDEO or date-range question prefer instagram_user_reels, which pages back more reliably; use this one for photos and carousels or a mixed feed. Also read this BEFORE writing copy in an account's voice: caption_text carries the voice and the engagement counts carry what actually landed, so the default limit of 12 is usually enough, and one read per account per conversation covers a whole thread of revisions. If a date window you chose returns no items, retry once without date filters before drafting; preserve any source period the user requested. If results are still empty or thin, say so — don't fall back to web_search and write from the open web, which is what produces the generic voice an account rejects.

For a date range pass since and until rather than a large item cap — plus tz, the user's timezone, so the days are cut on THEIR calendar. The walk pages back until it reaches that date, and the tool returns a totals block (posts, views, likes, comments, engagement_rate) computed over exactly that window. Quote those numbers; never add up the rows yourself. Before reporting a total, read these four fields — each one exists because ignoring it produced a wrong report:

  • partial: true — the walk stopped early, so this is a FLOOR, not a measurement. Say so, or re-run; never present it as the period's total.
  • overlaps — names a sibling feed returning the SAME pieces. Report one feed or the other; adding both counts every piece twice.
  • views_metric — which upstream number views came from. Two feeds on one platform can report different values for the same piece, so only compare or combine totals whose views_metric matches.
  • measured_at — when it was read. Live counts move fast; state it whenever you report a total, and never explain a difference between two runs as a mistake before checking whether the pieces simply gained views between them.

COVERING MORE THAN ONE ACCOUNT OR FEED: never add these totals in your head. Each result carries a receipt — a TSV block with the same five columns on every platform. Paste the receipts into run_code and total them there: dedupe on (platform, id) so a piece returned by two feeds is counted once, keep an empty field as missing rather than 0, and only add views across receipts whose views_metric matches. Report the code's number, not a retyped one, and hand back the per-piece list so the total can be checked by hand.

Authorization

bearerAuth
AuthorizationBearer <token>

JWT token from authentication

In: header

Header Parameters

Endless-Api-Version?string

Pin the caller to an API major (1). Omit to accept the current version. A major this deployment cannot serve is refused with 400 unsupported_api_version.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/social/instagram_user_posts" \  -H "Content-Type: application/json" \  -d '{    "organization_id": "string",    "input": {      "username": "string"    }  }'
{  "operation": "instagram_profile",  "result": {    "summary": "string",    "username": "string",    "user_id": "string",    "totals": {      "window": {        "since": "string",        "until": "string",        "tz": "string"      },      "posts": -9007199254740991,      "views": 0,      "likes": 0,      "comments": 0,      "engagement_rate": 0,      "rows_without_views": -9007199254740991,      "rows_without_likes": -9007199254740991,      "rows_without_comments": -9007199254740991,      "views_metric": "string",      "measured_at": "string",      "partial": true,      "overlaps": "string",      "oldest": "string",      "newest": "string"    },    "receipt": "string",    "coverage": "string",    "items": [      {        "pk": "string",        "id": "string",        "code": "string",        "media_type": 0,        "product_type": "string",        "taken_at": 0,        "like_count": 0,        "comment_count": 0,        "play_count": 0,        "view_count": 0,        "permalink": "string",        "caption_text": "string",        "image_url": "string",        "carousel_image_urls": [          "string"        ]      }    ]  },  "requests": 0,  "credits_charged": 0}