Skip to main content

Comments

Retrieve comments from social media posts, send private replies (DMs) to commenters, or post public replies visible under the original comment.


Get Post Comments​

Retrieve all comments on a specific post. Accepts either a numeric media ID or a full post URL.

Endpoint​

GET /api/uploadposts/comments

Headers​

NameValueDescription
AuthorizationApikey your-api-key-hereYour API key for authentication

Query Parameters​

NameTypeRequiredDescription
platformStringYesThe platform to retrieve comments from (e.g., "instagram").
userStringYesProfile username (as configured in Upload-Post).
post_idStringYes*Numeric media ID. Use post_id or post_url (one is required).
post_urlStringYes*Full post URL (e.g., https://www.instagram.com/p/ABC123/). Alternative to post_id.
limitIntegerNoComments per page, between 1 and 50 (Meta's hard cap for this edge). If omitted, Instagram's default applies (~25).
afterStringNoCursor returned by Meta in the previous page (pagination.next_cursor). Use it to fetch the next page.

Ordering: Meta returns comments newest-first (reverse-chronological) on Graph API v3.2 and later. There is no query parameter to change this — the order is fixed by Meta.

Example Requests​

Single page (default):

curl 'https://api.upload-post.com/api/uploadposts/comments?platform=instagram&user=my-profile&post_url=https://www.instagram.com/p/ABC123/' \
-H 'Authorization: Apikey your-api-key-here'

Paginate through all comments (50 per page):

# First page
curl 'https://api.upload-post.com/api/uploadposts/comments?platform=instagram&user=my-profile&post_id=17890455123456789&limit=50' \
-H 'Authorization: Apikey your-api-key-here'

# Next page — pass back the next_cursor from the previous response
curl 'https://api.upload-post.com/api/uploadposts/comments?platform=instagram&user=my-profile&post_id=17890455123456789&limit=50&after=QVFIUm...' \
-H 'Authorization: Apikey your-api-key-here'

Loop while pagination.has_next is true, passing pagination.next_cursor as after each time.

Responses​

  • 200 OK
{
"success": true,
"comments": [
{
"id": "17858893269123456",
"text": "Great post!",
"timestamp": "2025-06-15T10:30:00+0000",
"user": {
"id": "17841400123456789",
"username": "commenter_user"
}
},
{
"id": "17858893269789012",
"text": "Love this content",
"timestamp": "2025-06-15T11:00:00+0000",
"user": {
"id": "17841400987654321",
"username": "another_user"
}
}
],
"pagination": {
"next_cursor": "QVFIUm9TbGd...",
"has_next": true
}
}

When the last page is reached, pagination is {"next_cursor": null, "has_next": false}.

  • 400 Bad Request
{
"success": false,
"error": "Missing required query parameters: platform, user, and either post_id or post_url"
}
  • 400 Bad Request (invalid limit)
{
"success": false,
"error": "Query parameter 'limit' must be between 1 and 50 (Meta's cap for this edge)."
}
  • 400 Bad Request (invalid post URL)
{
"success": false,
"error": "Could not find media ID for the provided URL. Make sure the post belongs to the authenticated account."
}
  • 500 Internal Server Error
{
"success": false,
"error": "An internal server error occurred."
}

A post URL is resolved to a media ID by scanning the account's recent posts (cached). The post must belong to the authenticated account. This endpoint uses the account's global API rate limits; there is no per-post throttle.


Reply to Comment (Private Reply)​

Send a private reply (DM) to the author of a comment on your post. This sends a direct message to the commenter.

Endpoint​

POST /api/uploadposts/comments/reply

Headers​

NameValueDescription
AuthorizationApikey your-api-key-hereYour API key for authentication

Body Parameters (JSON)​

NameTypeRequiredDescription
platformStringYesThe platform (e.g., "instagram").
userStringYesProfile username (as configured in Upload-Post).
comment_idStringYesThe ID of the comment to reply to (from Get Post Comments).
messageStringYesThe private reply message text.
buttonsArrayNoUp to 3 web_url buttons rendered in the Instagram DM. Each item is an object {title, url} (title max 20 chars, url must be http/https).

Example Request​

curl -X POST https://api.upload-post.com/api/uploadposts/comments/reply \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{
"platform": "instagram",
"user": "my-profile",
"comment_id": "17858893269123456",
"message": "Thanks for your comment! Check your DMs for more info.",
"buttons": [
{ "title": "Learn more", "url": "https://example.com" }
]
}'

Responses​

  • 200 OK (reply sent successfully)
{
"success": true,
"recipient_id": "17841400123456789",
"message_id": "aWdGM...",
"message": "Private reply sent successfully"
}
  • 400 Bad Request (missing fields)
{
"success": false,
"error": "Missing required fields: platform, user, comment_id, message"
}
  • 429 Too Many Requests (daily DM limit exceeded)
{
"success": false,
"error": "Daily DM limit exceeded."
}
  • 500 Internal Server Error
{
"success": false,
"error": "An internal server error occurred."
}

Reply to Comment (Public Reply)​

Post a public reply to a comment on your Instagram post. The reply appears as a visible comment under the original comment.

Endpoint​

POST /api/uploadposts/comments/public-reply

Headers​

NameValueDescription
AuthorizationApikey your-api-key-hereYour API key for authentication

Body Parameters (JSON)​

NameTypeRequiredDescription
platformStringYesThe platform (e.g., "instagram").
userStringYesProfile username (as configured in Upload-Post).
comment_idStringYesThe ID of the comment to reply to (from Get Post Comments).
messageStringYesThe public reply message text.

Example Request​

curl -X POST https://api.upload-post.com/api/uploadposts/comments/public-reply \
-H 'Authorization: Apikey your-api-key-here' \
-H 'Content-Type: application/json' \
-d '{
"platform": "instagram",
"user": "my-profile",
"comment_id": "17858893269123456",
"message": "Thank you! Glad you liked it."
}'

Responses​

  • 200 OK (reply posted successfully)
{
"success": true,
"id": "17858893269654321",
"message": "Instagram public reply posted successfully"
}
  • 400 Bad Request (missing fields)
{
"success": false,
"error": "Missing required fields: platform, user, comment_id, message"
}
  • 429 Too Many Requests (daily limit exceeded)
{
"success": false,
"error": "Daily DM limit exceeded."
}
  • 500 Internal Server Error
{
"success": false,
"error": "An internal server error occurred."
}

Important Notes​

  1. 7-day window for private replies: Some platforms only allow private replies to recent comments (e.g., Instagram requires comments less than 7 days old). Public replies do not have this restriction.

  2. Comment must be on your post: You can only reply to comments on posts owned by the authenticated account.

  3. Daily limits: Upload-Post enforces a configurable daily limit per user. Both private and public replies count toward this limit. When exceeded, the API returns a 429 status code.

  4. Public vs. private replies: Use /comments/reply to send a private DM to the comment author. Use /comments/public-reply to post a visible reply under the original comment. Both require the comment_id from the Get Post Comments endpoint.

  5. Using comment data for DMs: Each comment includes the commenter's user ID. You can use this ID with the Direct Messages endpoint to send follow-up DMs directly.