Skip to content

Facebook comments API: Manage Facebook Page Comments

The Facebook comments API lets you list, reply to, and delete comments on Facebook Page posts programmatically. This guide follows the exact request sequence: connect a Facebook Page, obtain accountId, list comments with pagination, post a top-level comment, reply to a comment, and delete a comment when moderation requires it.

Prerequisites and Page scope

You need an API access key, a Facebook Page, and the permissions required to read and manage engagement on that Page. This workflow applies to a Facebook Page, not a personal profile. Reading comments requires pages_read_user_content, while replying and deleting require pages_manage_engagement. Every request uses the x-access-key header, shown in the example titled Authentication header. Treat the key like a password and do not commit it to source control.

Connect a Facebook Page and obtain accountId

Start by calling GET /v1/connect/facebook with the x-access-key header, as shown in the example titled Connect a Facebook Page. The response provides an authorization URL to open in a browser, where you authorize the app and select the Facebook Page to link. Then call GET /v1/connect/integrations, as shown in the example titled List connected accounts to obtain accountId. Each connected account includes an id; use that value as accountId in every comment call. If accountId is missing, stop and reconnect the Page rather than guessing an identifier.

List comments with pagination

Call GET /v1/comments with platform=facebook, accountId, and postId, as shown in the example titled List comments on a Facebook Page post. The response includes success, a comments array, and nextCursor when more results are available. Each comment includes id, text, author, timestamp, likeCount, hidden, and replies. Replies include the same core fields except hidden in the source example. To page forward, pass the nextCursor value as after, as shown in the example titled List comments with pagination. The default limit is 25, and limit accepts values from 1 to 100. Check success before processing comments, and preserve nextCursor exactly when requesting the next page.

Post a top-level comment

To start a new top-level comment, call POST /v1/comments with platform, accountId, postId, and text, as shown in the example titled Post a top-level comment. A successful response includes success and the new commentId, as shown in the example titled Create comment response example. Save that commentId because it is the identifier you will need to reply to the thread or delete the comment later. Do not reuse postId when you intend to reply; postId creates a new top-level comment.

Reply to a comment

Replying uses the same POST /v1/comments endpoint, but you replace postId with commentId, as shown in the example titled Reply to a comment. The body still includes platform, accountId, and text. The response has the same shape as a top-level creation: success and the new commentId for the reply. This postId versus commentId distinction is the decision rule: postId targets the post itself, while commentId nests the new text under an existing comment. If you supply the wrong target field, you will create the comment in the wrong place, so verify the target before sending.

Delete a comment and moderation limits

To delete a comment, call DELETE /v1/comments/{commentId} with platform and accountId as query parameters, as shown in the example titled Delete a comment. A successful response includes success, as shown in the example titled Delete comment response example. Deletion is permanent, so reserve this operation for deliberate moderation decisions. Deleting your Page's own comment removes it for everyone, and deleting another person's comment removes it from the thread on your Page's post. There is no hide or unhide operation for Facebook comments through this API, even though the hidden field can appear in list responses. Plan moderation around reply and delete only. Each Comments API call spends 1 credit, as stated in the source contract, so budget for listing, replying, and deleting as separate calls.

Field map and input contract

The full loop is to connect the Facebook Page, list comments and replies, post a top-level comment with postId, reply with commentId, and delete with DELETE /v1/comments/{commentId} when moderation requires it. Before each call, confirm that platform is facebook, accountId matches the connected Page, and the target field matches your intent. After each call, check success and retain any returned commentId or nextCursor for the next step. The field map and input contract table below summarizes the exact fields for each operation.

Input contract by operation
OperationMethod and pathRequired inputsResponse fields
Connect Facebook PageGET /v1/connect/facebookHeader: x-access-keyAuthorization URL for browser authorization and Page selection
List connected accountsGET /v1/connect/integrationsHeader: x-access-keyConnected accounts including id, used as accountId
List commentsGET /v1/commentsHeader: x-access-key; query: platform=facebook, accountId, postId; optional: limit (default 25, range 1 to 100), aftersuccess, comments, nextCursor; each comment: id, text, author, timestamp, likeCount, hidden, replies
Post top-level commentPOST /v1/commentsHeader: x-access-key; JSON body: platform, accountId, postId, textsuccess, commentId
Reply to commentPOST /v1/commentsHeader: x-access-key; JSON body: platform, accountId, commentId, textsuccess, commentId
Delete commentDELETE /v1/comments/{commentId}Header: x-access-key; query: platform=facebook, accountIdsuccess

Contract parity draft; illustrative_unexecuted examples only.

Field map
FieldUsed inMeaning
platformList, create, reply, deleteSet to facebook for Facebook Page comments
accountIdList, create, reply, deleteIdentifier of the connected Facebook Page account
postIdList, post top-level commentIdentifier of the Page post to read or comment on
commentIdReply, deleteIdentifier of the existing comment to reply to or delete
textPost top-level comment, replyComment text to publish
limitList commentsPage size; default 25, range 1 to 100
afterList commentsPagination cursor; pass the previous nextCursor value
nextCursorList comments responseCursor for the next page when more comments are available
hiddenList comments responseBoolean field present in list responses; no Facebook hide/unhide operation is available through this API

Field names preserved exactly from source examples.

Moderation and failure matrix
SituationCorrect actionFailure check
New comment on the postPOST /v1/comments with postId and textConfirm you did not supply commentId instead of postId
Reply inside a threadPOST /v1/comments with commentId and textConfirm commentId came from a prior list or create response
Remove spam or an off-topic threadDELETE /v1/comments/{commentId} with platform and accountIdConfirm the commentId is correct; deletion cannot be undone
Attempt to hide a Facebook commentNo hide/unhide operation availableDo not treat the hidden response field as a toggle; use reply or delete

Deletion is permanent; no Facebook hide/unhide operation in this contract.

Frequently asked questions

What is the difference between postId and commentId when creating a comment?

Use postId to start a new top-level comment on the post, and commentId to nest a reply under an existing comment. Both use POST /v1/comments with platform, accountId, and text; the difference is which target field you supply.

How does pagination work when listing Facebook Page comments?

The list response returns top-level comments with their first level of replies, plus nextCursor when more results are available. Pass that nextCursor value as the after parameter on the next request. The default limit is 25, with a range of 1 to 100.

Is deleting a Facebook Page comment reversible?

Deletion is permanent. It removes your Page's own comment for everyone, or removes another person's comment from the thread on your Page's post. Reserve delete for moderation decisions, since it cannot be undone.

Can I hide or unhide a Facebook comment through this API?

No. The hidden field can appear in list responses, but there is no hide or unhide operation for Facebook comments through this API. Moderation options are reply and delete.

Does this work for personal Facebook profiles?

This workflow applies to a Facebook Page, not a personal profile. Reading comments requires pages_read_user_content, and replying and deleting require pages_manage_engagement.

Authentication header
-H "x-access-key: YOUR_API_KEY"
Connect a Facebook Page
curl {{API_BASE_URL}}/v1/connect/facebook \
  -H "x-access-key: YOUR_API_KEY"
List connected accounts to obtain accountId
curl {{API_BASE_URL}}/v1/connect/integrations \
  -H "x-access-key: YOUR_API_KEY"
List comments on a Facebook Page post
curl "{{API_BASE_URL}}/v1/comments?platform=facebook&accountId=your-fb-id&postId=your-post-id" \
  -H "x-access-key: YOUR_API_KEY"
List comments response example
{
  "success": true,
  "comments": [
    {
      "id": "17845...901",
      "text": "An example comment.",
      "author": { "id": "1029...", "name": "Priya Anand" },
      "timestamp": "2026-08-05T14:22:10Z",
      "likeCount": 3,
      "hidden": false,
      "replies": [
        {
          "id": "17845...944",
          "text": "An example comment.",
          "author": { "id": "998...", "name": "Your Page" },
          "timestamp": "2026-08-05T14:40:02Z",
          "likeCount": 0
        }
      ]
    }
  ],
  "nextCursor": "QVFIU..."
}
List comments with pagination
curl "{{API_BASE_URL}}/v1/comments?platform=facebook&accountId=your-fb-id&postId=your-post-id&limit=50&after=QVFIU..." \
  -H "x-access-key: YOUR_API_KEY"
Post a top-level comment
curl -X POST {{API_BASE_URL}}/v1/comments \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "facebook",
    "accountId": "your-fb-id",
    "postId": "your-post-id",
    "text": "An example comment."
  }'
Create comment response example
{
  "success": true,
  "commentId": "17845...977"
}
Reply to a comment
curl -X POST {{API_BASE_URL}}/v1/comments \
  -H "x-access-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "platform": "facebook",
    "accountId": "your-fb-id",
    "commentId": "17845...901",
    "text": "An example comment."
  }'
Delete a comment
curl -X DELETE "{{API_BASE_URL}}/v1/comments/17845...977?platform=facebook&accountId=your-fb-id" \
  -H "x-access-key: YOUR_API_KEY"
Delete comment response example
{
  "success": true
}