To hide an Instagram comment, send POST /<IG_COMMENT_ID>?hide=true. To delete it, send DELETE /<IG_COMMENT_ID>, and to reply in public, POST /<IG_COMMENT_ID>/replies with a message. You read comments with GET /<IG_MEDIA_ID>/comments. The host and permissions depend on how your app’s users log in. Hide and delete work only with a token from the owner of the media that was commented on. The comments webhook tells you when a new comment arrives, so you don’t have to poll.
Three login setups, two hosts
Meta’s comment moderation guide lists three setups (comment moderation, accessed 2026-11-04). The token type decides the host.
| Setup | Token | Host | Permissions |
|---|---|---|---|
| Instagram API with Instagram Login | Instagram User access token | graph.instagram.com |
instagram_business_basic, instagram_business_manage_comments |
| Instagram API with Facebook Login | Facebook User or Page access token | graph.facebook.com |
instagram_basic, instagram_manage_comments, pages_read_engagement, plus ads_management or ads_read if the Page role comes through Business Manager |
| Unified Login | Business Integration System User access token | graph.facebook.com |
instagram_basic, instagram_manage_comments |
Standard Access covers accounts you own or manage and have added in the App Dashboard. Advanced Access is needed for professional accounts you don’t own. Since August 27, 2024, the commenter’s username field requires the manage-comments permission (IG Comment reference, accessed 2026-11-04). Older reference pages for replies and mentions also list pages_show_list. The table above follows the newer guide.
Read comments and replies
GET /<IG_MEDIA_ID>/comments “Returns only top-level comments”, and “a maximum of 50 comments per query” (IG Media comments reference, accessed 2026-11-04). Results run newest first. “Comments cannot be filtered by timestamp,” and the page documents no pagination parameters for this edge. Replies come through field expansion on replies. With Facebook Login, GET /<IG_MEDIA_ID>/ordered_comments returns Instagram’s display order and accepts after, limit and date_format=U.
The IG Comment object carries id, text, timestamp, hidden, like_count, parent_id, from (the commenter’s Instagram-scoped ID and username), media and replies. Some comments never come back:
- Comments on age-gated media.
- Comments by users the account has restricted, until they are unrestricted and approved.
- Live video comments after the broadcast ends.
- Comments found through the Mentions API, unless the comment owner makes the request.
For a boosted post, /comments on the original post or on the ad media returns comments from both. For other ads, read effective_instagram_media_id from the Marketing API first. A media object’s comments_count “Includes replies on comments” and excludes the caption (IG Media reference).
Hide, delete, reply and turn comments off
| Action | Call | Limits Meta documents |
|---|---|---|
| Hide or unhide | POST /<IG_COMMENT_ID>?hide=true (or false) |
The media owner’s comments “will always be displayed”. No live video. |
| Delete | DELETE /<IG_COMMENT_ID> |
Only the owner of the media can delete, “even if the user attempting to delete the comment is the comment’s author”. No live video. |
| Reply | POST /<IG_COMMENT_ID>/replies with message |
Top-level comments only. No hidden comments, no live video. |
| Comments off | POST /<IG_MEDIA_ID>?comment_enabled=false |
No live video |
Hide and delete return {"success": true}, and a reply returns the new comment’s id (IG Comment replies reference). A reply sent to a reply is attached to the top-level comment. For a live video comment, use a private reply through the messaging API instead. Meta doesn’t state a maximum reply length, and doesn’t say whether hiding or deleting notifies the commenter. Once a comment is deleted, you can’t fetch its replies, so save what you need before you delete.
The script below runs all five operations with the Python 3.9 standard library. Meta’s reply sample omits the line continuations and the token, so this script writes its own requests. It passes the token as access_token, which is how Meta’s samples on these pages do it.
# moderate.py. Python 3.9+, standard library only.
# Run: HOST=graph.instagram.com TOKEN=... python3 moderate.py list IG_MEDIA_ID
# python3 moderate.py hide|unhide|delete IG_COMMENT_ID
# python3 moderate.py reply IG_COMMENT_ID "Thanks, we sent you the details"
# python3 moderate.py comments-off IG_MEDIA_ID
import json, os, sys, urllib.error, urllib.parse, urllib.request
HOST = os.environ.get("HOST", "graph.instagram.com") # graph.facebook.com for Facebook or Unified Login
TOKEN = os.environ["TOKEN"]
BASE = f"https://{HOST}/v26.0"
def call(method, object_id, params=None, body=None):
query = dict(params or {}, access_token=TOKEN)
url = f"{BASE}/{object_id}?{urllib.parse.urlencode(query)}"
data = json.dumps(body).encode() if body is not None else (b"" if method == "POST" else None)
req = urllib.request.Request(url, data=data, method=method)
if body is not None:
req.add_header("Content-Type", "application/json")
try:
with urllib.request.urlopen(req) as res:
return json.load(res)
except urllib.error.HTTPError as e:
err = json.load(e).get("error", {})
sys.exit(f"HTTP {e.code}, code {err.get('code')}: {err.get('message')}")
def main(action, object_id, text=None):
if action == "list":
fields = "id,text,timestamp,username,hidden,like_count,replies{id,text,timestamp,username}"
return call("GET", f"{object_id}/comments", {"fields": fields})
if action in ("hide", "unhide"):
return call("POST", object_id, {"hide": "true" if action == "hide" else "false"})
if action == "delete":
return call("DELETE", object_id)
if action == "reply":
return call("POST", f"{object_id}/replies", body={"message": text})
if action == "comments-off":
return call("POST", object_id, {"comment_enabled": "false"})
sys.exit(f"unknown action {action}")
if __name__ == "__main__":
print(json.dumps(main(*sys.argv[1:4]), indent=2))
Hide and delete fail if the token doesn’t belong to the media owner. If a hide or delete call returns a permissions error, check whose post the comment sits on before you check the scopes.
Mentions
When someone mentions your account in a comment on another account’s media, you can’t moderate that comment. You can read it and answer it. Read it with GET /<IG_USER_ID>?fields=mentioned_comment.comment_id(<COMMENT_ID>){id,text,timestamp}, which errors if comments are disabled on that media (mentioned_comment reference). Reply with POST /<IG_USER_ID>/mentions and media_id, comment_id and message (mentions reference). Mentions in Stories aren’t supported, and media created by private accounts sends no webhooks. With Instagram Login there is no mentions webhook field; mentions arrive inside comments notifications (webhook fields, accessed 2026-11-04).
The comments webhook
The comments and live_comments fields exist on all three setups. The app must be Live with Advanced Access for these fields (webhooks setup, accessed 2026-11-04), and production needs business verification. The account that owns the media must be public. With Instagram Login, subscribe the account with POST https://graph.instagram.com/v26.0/<INSTAGRAM_ACCOUNT_ID>/subscribed_apps?subscribed_fields=comments. Unified Login uses the same call on graph.facebook.com with a system user token. Facebook Login subscribes the Page’s /subscribed_apps with a Page token.
The payload shape depends on the login. Meta’s Instagram Login example puts field and value directly in each entry, with the comment ID in value.id. Meta’s Facebook Login example wraps them in entry[].changes[], with the ID in value.comment_id and parent_id on replies. Both published examples are invalid JSON: they have code comments and missing commas. A cleaned-up copy of the Facebook Login example, labelled as such, is in Reply privately to Instagram comments. The function below reads either shape, using only the field names from those examples.
def comments_from_webhook(payload):
"""Return comment events from an Instagram webhook body, for either login shape."""
events = []
for entry in payload.get("entry", []):
items = entry.get("changes") or [entry] # Facebook/Unified Login use changes[]
for item in items:
if item.get("field") not in ("comments", "live_comments"):
continue
value = item.get("value", {})
events.append({
"account_id": entry.get("id"),
"field": item["field"],
"comment_id": value.get("comment_id") or value.get("id"),
"parent_id": value.get("parent_id"),
"from_id": value.get("from", {}).get("id"),
"username": value.get("from", {}).get("username"),
"text": value.get("text", ""),
"media_id": value.get("media", {}).get("id"),
})
return events
Verify X-Hub-Signature-256 before you parse, as in webhook signature verification. Return 200 fast. Meta retries for 36 hours, then drops the notification, and it keeps no history. Duplicates happen, so key your actions on comment_id. Meta doesn’t document whether your own replies trigger the webhook. If a bot replies to comments, check the author against your own account before answering, or it may answer itself.
Rate limits
Comment calls count against the Instagram Business Use Case limit: “Calls within 24 hours = 4800 * Number of Impressions” (Instagram Platform overview, accessed 2026-11-04). Impressions are how often the account’s content appeared on screen in the last 24 hours. The count runs per app and app user pair, over a rolling 24 hours, and excludes messaging calls. An account with little reach gets a small budget, which is one more reason to take comments from the webhook instead of polling.
Going over returns error 80002. Read the X-Business-Use-Case-Usage header on each response and slow down as its usage figures climb (Graph API rate limiting). Error 613 is a separate custom rate limit. Meta publishes no per-call limit for hide or delete. Private replies have their own ceiling of 750 calls per hour per account, covered with the messaging limits in Instagram Messaging API rate limits.
Z-API Omni team