> ## Documentation Index
> Fetch the complete documentation index at: https://www.ayrshare.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Comments API Overview

> Post, reply, get, and delete comments on a social post

export const PlansAvailable = ({plans = [], maxPackRequired}) => {
  let displayPlans = plans;
  if (plans && plans.length === 1) {
    const lowerCasePlan = plans[0].toLowerCase();
    if (lowerCasePlan === "basic") {
      displayPlans = ["Basic", "Premium", "Business", "Enterprise"];
    } else if (lowerCasePlan === "business") {
      displayPlans = ["Business", "Enterprise"];
    } else if (lowerCasePlan === "premium") {
      displayPlans = ["Premium", "Business", "Enterprise"];
    }
  }
  return <Note>
Available on {displayPlans.length === 1 ? "the " : ""}
{displayPlans.join(", ").replace(/\b\w/g, l => l.toUpperCase())}{" "}
{displayPlans.length > 1 ? "plans" : "plan"}.

{maxPackRequired && <span onClick={() => window.open('https://www.ayrshare.com/docs/additional/maxpack', '_self')} className="flex items-center mt-2 cursor-pointer">
 <span className="px-1.5 py-0.5 rounded text-sm" style={{
    backgroundColor: '#C264B6',
    color: 'white',
    fontSize: '12px'
  }}>
   Max Pack required
 </span>
</span>}
</Note>;
};

<PlansAvailable plans={["premium"]} maxPackRequired={false} />

The Comments endpoints allow your users to post, reply, retrieve, and delete comments on their posts.
There are four types of comments IDs: Ayrshare Post ID, Social Post ID, Ayrshare Comment ID, and Social Comment ID.
Each of these IDs are used for different purposes.

## Comment ID Types

### Comments with Ayrshare Post ID

The typical flow is when you publish a post via Ayrshare, you get the Ayrshare Post ID.
You can then use this [Ayrshare Post ID](/apis/overview#ayrshare-post-id) to manage comments on that post.

Supported platforms: Bluesky, Facebook Pages, Instagram, LinkedIn, Reddit, Threads, TikTok, Twitter, and YouTube.

For example:

<Steps>
  <Step title="Publish a Post">
    Use the [/post](/apis/post/post) endpoint to publish a post via Ayrshare, which can be sent to multiple social networks in a single call.

    In the return is the top level [Ayrshare Post ID](/apis/overview#ayrshare-post-id).

    ```json {12} theme={"system"}
    {
        "status": "success",
        "errors": [],
        "postIds": [
        {
            "status": "success",
            "id": "106638148652329_591370753547555",
            "postUrl": "https://www.facebook.com/106638148652329/posts/591370753547555",
            "platform": "facebook"
        }
        ],
        "id": "E4UdUr1yRbvI7qqCSlaq", // Ayrshare Post ID
        "refId": "9abf1426d6ce9122ef11c72bd62e59807c5cc055",
        "post": "What an amazing day",
        "validate": true
    }
    ```
  </Step>

  <Step title="Post a Comment">
    Use the [/comments](/apis/comments/post-comment) endpoint to post a comment with the Ayrshare Post ID.
    The comment will be automatically posted to every social network where the original post was published.
    For example, if you published the post to Facebook and Instagram, the comment will appear on both platforms.

    ```http theme={"system"}
    POST https://api.ayrshare.com/api/comments/:id
    ```
  </Step>

  <Step title="Get Comments">
    Use the [/comments](/apis/comments/get-comments) endpoint to get the comments for the post with the Ayrshare Post ID.
    This will return all comments from every social network where the post was published.
    For example, if you posted to Facebook and Instagram, you'll get comments from both platforms.

    ```http theme={"system"}
    GET https://api.ayrshare.com/api/comments/:id
    ```
  </Step>
</Steps>

### Comments with Social Post ID

Sometimes you may want to manage comments on a post that were not published via Ayrshare.
In this case you can use the [Social Post ID](/apis/overview#social-post-id), which is the post ID assigned by the social network.

<Note>
  If the post was published via Ayrshare, use [the Ayrshare Post
  ID](/apis/comments/overview#comments-with-ayrshare-post-id).
</Note>

For example:

<Steps>
  <Step title="Get Post History">
    Start by getting the Instagram posts published outside of Ayrshare with the [Get All Post History endpoint](/apis/history/history-platform).

    The endpoint returns a list of posts with the social `id` of the post.

    ```json {13} theme={"system"}
    {
        "status": "success",
        "posts": [
            {
                "mediaUrl": "https://scontent.cdninstagram.com/v/t51.2885-15/7531.jpg",
                "permalink": "https://www.instagram.com/p/B5OBT3ygpfg/",
                "commentsCount": 0,
                "created": "2022-05-20T17:26:03Z",
                "likeCount": 0,
                "mediaProductType": "FEED",
                "mediaType": "IMAGE",
                "username": "thegoodone",
                "id": "17833140557332933", // Instagram Social Post ID
                "thumbnailUrl": "https://scontent-lga3-2.cdninstagram.com/v/t51..jpg",
                "post": "The #Mandalorian is on tonight instead of Friday",
                "postUrl": "https://www.instagram.com/p/B5OBT3ygpfg/"
            },
        ]
    }
    ```

    <Note>The social post `id` is also returned in the `postIds` field of the [post endpoint](/apis/post/post).</Note>
  </Step>

  <Step title="Get Comments on a Post">
    Use the returned `id` to [get all the comments](/apis/comments/get-comments) for a specific Instagram post using the social `id`, `searchPlatformId` set to `true`, and `platform` set to `instagram`.

    ```http theme={"system"}
    GET https://api.ayrshare.com/api/comments/17833140557332933?platform=instagram&searchPlatformId=true
    ```
  </Step>

  <Step title="Use the Comment ID to Get Comment Details">
    The returned JSON from the previous step will have a `commentId` for each comment, which is the [social comment ID](/apis/overview#social-comment-id).

    ```json {5} theme={"system"}
    {
        "instagram": [
            {
                "comment": "What an amazing comment",
                "commentId": "17969247335804735", // Social Comment ID
                "created": "2024-11-26T11:49:00Z",
                "from": {
                "id": "103038435208332",
                "username": "john_smith"
                },
                "hidden": false,
                "likeCount": 3,
                "platform": "instagram",
                "postId": "18231730279304333",
                "username": "john_smith"
            }
        ]
    }

    ```
  </Step>
</Steps>

### Comments with Ayrshare Comment ID

Manage comments on a post that were published via Ayrshare by using the [Ayrshare Comment ID](/apis/overview#ayrshare-comment-id).
The Ayrshare comment ID is the comment ID assigned from Ayrshare and can be found in the `commentId` field in the response when [posting a comment](/apis/comments/post-comment).

This is often used if you want to get details on a particular comment published via Ayrshare.

### Comments with Social Comment ID

Manage comments on a post that were not published via Ayrshare by using the [Social Comment ID](/apis/overview#social-comment-id).
The social comment ID is the comment ID from the social network, not the Ayrshare ID, and can be found in the `commentId` field in the response when [getting comments](/apis/comments/get-comments).

```http theme={"system"}
GET https://api.ayrshare.com/api/comments/17969247335804735?platform=instagram&searchPlatformId=true&commentId=true
```

This is often used if you want to get details on a particular comment published outside of Ayrshare, such as LinkedIn replies to comments.

## Disable Comments

You can disable comments when publishing a post using the `disableComments` field in the [/post endpoint](/apis/post/post). Comments will only be disabled for Instagram, LinkedIn, and TikTok.

You may also enable or disable comments on an already published post using the [update post](/apis/post/update-post) endpoint and the `disableComments` field.

```
```
