comments

Comments API Endpoint: Post, reply, get, and delete comments on a social post.


POST Post a Comment

POST https://app.ayrshare.com/api/comments

Add a comment to a post using the Comments API. Available for Facebook Pages, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, and YouTube.

Comments added to a Twitter Thread will be posted to the first Tweet.

Instagram Story comments are not yet supported by Meta. Premium or Business plan required.

Headers

Request Body

{
    "facebook": {
        "status": "success",
        "commentId": "358482752285927_363474831785719", // Facebook Social Comment ID
        "comment": "The best comment ever!",
        "platform": "facebook"
    },
    "instagram": {
        "status": "success",
        "commentId": "17060111860440276", // Instagram Social Comment ID
        "comment": "The best comment ever!",
        "platform": "instagram"
    },
    "linkedin": {
        "status": "success",
        "commentId": "urn:li:comment:(urn:li:activity:7141202289402236928,7141205176207503360)", // LinkedIn Social Comment ID
        "comment": "Someone’s sitting in the shade today because someone planted a tree a long time ago. - Warren Buffett",
        "commentUrn": "urn:li:comment:(urn:li:activity:7141202289402236928,7141205176207503360)", // Social comment Id from LinkedIn
        "platform": "linkedin"
    },
    "youtube": {
        "status": "success",
        "commentId": "UgzIEZsDQKXgHsEnwTR4AaABAa", // YouTube Social Comment ID
        "comment": "The best comment ever!",
        "platform": "youtube"
    },
    "tiktok": {
        "status": "success",
        "commentId": "7260964914699764524", // TikTok Social Comment ID
        "comment": "The best comment ever!",
        "platform": "tiktok",
        "videoId": "7260964048362310959"
    },
    "twitter": {
        "status": "success",
        "commentId": "1525632403262101648", // Twitter Social Comment ID
        "comment": "The best comment ever!",
        "postUrl": "https://twitter.com/ayrshare/status/1525632403262101648"
    },
    "status": "success",
    "commentID": "IUDSCfdYfFkw_dWhW9PLI", // Ayrshare Comment ID. Used for replying to a comment.
    "id": "Ut1fWU6XkqlMayHGnJZ" // Ayrshare Post ID
}

Request Examples

curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"id": "Ut1fWU6XkqkMayHGnJZ", "platforms": ["facebook", "instagram", "linkedin", "reddit", "tiktok", "twitter", "youtube"], "comment": "An amazing comment!"}' \
-X POST https://app.ayrshare.com/api/comments

GET Get Comments

GET https://app.ayrshare.com/api/comments/:id

Get the comments for a given top-level post ID using tghe Comments API. Available for Facebook Pages, Instagram, LinkedIn, Reddit, TikTok, Twitter, and YouTube.

Replace :id with the post top level Ayrshare Post ID returned from the /post endpoint.

https://app.ayrshare.com/api/comments/Ut1fWU6XkqlMayHGnJZ

Please see the Response 200 of Post a Comment in the section above for an example of the ID Ut1fWU6XkqlMayHGnJZ

Comment data is updated every 10 minutes for all platforms, with the exception of Twitter. Due to restrictions imposed by the Twitter API, the comment data for Twitter is refreshed using an exponential backoff strategy, meaning the intervals between updates gradually increase over time.

Facebook replies to replies have the same parent id regardless of nesting.

Retrieve LinkedIn replies to comments by using the commentID with the Get Comments with Social Comment ID endpoint.

Premium or Business plan required.

Path Parameters

Headers

{
    "facebook": [
        {
            "comment": "What a great comment",
            "commentId": "806720068141593_1849585385469876", // Facebook Social Comment ID
            "commentCount": 3, // The number of replies to the comment
            "created": "2024-02-27T19:55:28Z",
            "from": {  // If available. Facebook determines availability based on the user's security profile and settings.
                "name": "John Smith",
                "id": "5075334022535844"
            },
            "likeCount": 342,
            "platform": "facebook",
            "userName": "WondrousTimes", // If available. Facebook determines availability based on the user's security profile and settings.
            "userLikes": false,
            "replies": [ // Facebook replies to replies have the same parent id regardless of nesting.
                {
                    "comment": "Nice Comment 2",
                    "commentId": "806720068141593_320599703877348",
                    "commentCount": 0,
                    "company": true,
                    "created": "2024-02-27T19:55:40Z",
                    "from": {
                        "name": "Sue Me",
                        "id": "5075334022535800"
                    },
                    "likeCount": 3,
                    "parent": {
                        "createdTime": "2024-02-27T19:55:28+0000",
                        "from": {
                            "name": "John Smith",
                            "id": "5075334022535844"
                        },
                        "message": "What a great comment",
                        "id": "806720068141593_1849585385469876"
                    },
                    "platform": "facebook",
                    "userLikes": false
                }
            ]
        }
    ],
    "instagram": [
        {
            "comment": "Love this post.",
            "commentId": "18030599567251077", // Instagram Social Comment ID
            "created": "2022-10-13T00:52:47Z",
            "from": {                    // If available. Instagram determines availability based on the user's security profile and settings.
                "name": "WondrousTimes",
                "id": "112775157855689"
            },
            "hidden": false,    // Is the comment hidden
            "likeCount": 1,
            "parentId": "17999860012861", // The Instagram Social ID of the parent post. Only returned when using get by ID on a reply.
            "platform": "instagram",
            "replies": [
                {
                    "created": "2024-04-04T22:37:39Z",
                    "from": {
                        "id": "178414522127073334",
                        "username": "ayrshare"
                    },
                    "hidden": false,
                    "id": "18023114651100610", // Instagram Social Comment Id
                    "likeCount": 2,
                    "parentId": "178438334431963234",
                    "text": "@ayrshare Thanks",
                    "user": {
                        "id": "17841452212702234"
                    },
                    "username": "ayrshare"
                }
            ],
            "user": {        // ID of Instagram user who created the comment.
                "id": "17841452212707498"
            },
            "userName": "ayrshare"      // If available. Instagram determines availability based on the user's security profile and settings.
        }
    ],
    // Retrieve LinkedIn replies to comments by using the commentID with the Get Comments with Social Comment ID endpoint.
    "linkedin": [
        {
            "comment": "New wonderful comment",
            "commentId": "6961077099692445688", // LinkedIn Social Comment ID
            "commentUrn": "urn:li:comment:(urn:li:activity:7141202289402236928,7141205176207503360)", // Social comment id from LinkedIn
            "created": "2022-08-04T21:55:11Z",
            "from": {
                "name": "Sue Smith",
                "id": "yb8P0Oq5l8",
                "url": "https://www.linkedin.com/in/suesmith",
                "description": "Co-Founder at Smiths"
            },
            "likeCount": 34,
            "media": [
                {
                    "type": "image",
                    "url": "https://media-exp1.licdn.com/dms/image/D4E2CAQH4RRMRaJSR"
                }
            ],
            "platform": "linkedin",
            "profileImageUrl": "https://media-exp1.licdn.com/dms/image/C5103AQHORT70jVfK",
            "userName": "suesmith"
        },
        {   // Comment from a company
            "comment": "Love it",
            "commentId": "urn:li:comment:(urn:li:activity:71860989603258818,7186100659052515329)",
            "commentUrn": "urn:li:comment:(urn:li:activity:71860989603258818,7186100659052515329)",
            "created": "2024-04-16T20:38:28Z",
            "founded": 2020,
            "from": {
                "name": "Ayrshare",
                "id": 22327643,
                "url": "https://www.linkedin.com/company/22327643",
                "description": "Social Media API"
            },
            "likeCount": 123,
            "organizationType": "PRIVATELY_HELD",
            "platform": "linkedin",
            "userName": "ayrshare",
            "website": "https://www.ayrshare.com"
        }
    ],
    "reddit": [
        {
            "comment": "Nice comment",
            "commentId": "kaxeilk",
            "created": "2023-11-27T03:09:06.000Z",
            "from": {
                "name": "suppercomment",
                "id": "t2_3zaxa"
            },
            "permalink": "/r/test/comments/184szm7/reddit_post_title/kaxeilk/",
            "subreddit": "test",
            "ups": 1,
            "isSubmitter": true
        }
    ],
    "tiktok": [
        {
            "comment": "The best comment",
            "commentId": "7260964914699764523", // TikTok Social Comment ID
            "created": "2023-07-28T20:12:23Z",
            "liked": false,
            "likeCount": 24,
            "owner": true,
            "pinned": false,
            "platform": "tiktok",
            "profileImage": "https://p16-sign-va.tiktokcdn.com/tos-maliva-avt-0068/f123c4b57351e266540b93baf07971fd~c5_168x168.jpeg?x-expires=1690747200&x-signature=xVFguEkVmPGJP7ZL2m33Lw7Yj28%3D",
            "replies": 1,
            "replyList": [
                {
                    "comment": "One reply",
                    "commentId": "72776074297628920", // TikTok Social Comment ID
                    "createTime": "2023-09-11 16:34:20",
                    "liked": false,
                    "likes": 0,
                    "owner": false,
                    "parentCommentId": "72776073973290774", // TikTok Parent Social Comment ID
                    "profileImage": "https://p16-sign.tiktokcdn-us.com/tos-useast5-avt-0068-tx/bcc6e677ecd86e80~c5_168x168.jpeg",
                    "status": "PUBLIC",
                    "userId": "51e0cb95a8b14f0f1020aa017",
                    "username": "ayrshare",
                    "videoId": "7260964048362310958"  // TikTok Social ID
                }
            ],
            "status": "success",
            "userId": "fc904564301a6d383fd19bd4982ba2682404876533c04741a8c3f270376cd3dd",
            "username": "helmar1066",
            "videoId": "7260964048362310958", // TikTok Social ID
            "visibility": "public"
        }
    ],
    "twitter": [
        {
            "comment": "@ayrshare Congrats on this",
            "commentId": "1505595871831891068", // Twitter Social Comment ID
            "created": "2022-05-14T21:56:14.000Z",
            "description": "Eat great!",
            "followersCount": 7,
            "followingCount": 4,
            "id": "1552209331030036480",    // Twitter Social ID
            "likeCount": 341,
            "listedCount": 0,
            "name": "waffles",
            "platform": "twitter",
            "profileImageUrl": "https://pbs.twimg.com/profile_images/1194272436456890464/lvQZPpt4_normal.png",
            "replyTo": {             // Who the comment was in reply to
                "createdAt": "2012-01-18T21:13:15.000Z",
                "description": "Social Media API",
                "id": "467793290",
                "location": "New York City",
                "name": "Ayrshare",
                "profileImageUrl": "https://pbs.twimg.com/profile_images/1851502252/ayrshare_normal.gif",
                "publicMetrics": {
                    "followersCount": 601,
                    "followingCount": 601,
                    "tweetCount": 11131,
                    "listedCount": 1
                },
                "url": "",
                "username": "anothermadworld"
            },
            "threadNumber": 1,     // If thread, number in sequence
            "tweetCount": 1208,
            "userName": "waffles"
        }
    ],
    "youtube": [
        {
            "channelUrl": "http://www.youtube.com/channel/sp0CnxiNbUU0AJtuYKZwXQ",
            "comment": "Two comments",
            "commentId": "Ugx0tiPuoUpXfrY0qvV4AaABAg", // YouTube Social Comment ID
            "created": "2022-05-24T19:45:49Z",
            "isPublic": true, // This setting indicates whether the comment, including all of its comments and comment replies, is visible to all YouTube users.
            "likeCount": 34,
            "platform": "youtube",
            "profileImageUrl": "https://yt3.ggpht.com/ytc/AKedOLT2hOZirBUGodAg31-QXaGPd9DmrkxR48UXAw=s48-c-k-c0x00ffffff-no-rj",
            "replies": [
                {
                    "comment": "amazing reply",
                    "commentId": "UgzJFjmrrRUr6nsRWi14AaABAg.9ssbUo6Es1n9ssbVwRn2iz",
                    "created": "2023-08-01T15:59:16Z",
                    "likeCount": 2,
                    "platform": "youtube",
                    "userName": "uman",
                    "profileImageUrl": "https://yt3.ggpht.com/ytc/AOPcoUDV_W7h3ZSEcFYrcEuXUPxVCTuF4NTw=s48-c-k-c0x00ffffff-no-rj",
                    "channelUrl": "http://www.youtube.com/channel/sp0CnxiNbUU0AJtuYKZwXQ",
                    "parentId": "UgzJFjmrrRUr6nsRWi14AaABAg"
                }
            ],
            "userName": "ayrshare"
        },
        {
            "channelUrl": "http://www.youtube.com/channel/sp0CnxiNbUU0AJtuYKZwXQ",
            "comment": "One comment",
            "commentId": "Ugx0tiPuoUpXfrY0qvV4AaABAa", // YouTube Social Comment ID
            "created": "2022-05-24T19:00:10Z",
            "isPublic": true, // This setting indicates whether the comment, including all of its comments and comment replies, is visible to all YouTube users.
            "likeCount": 123,
            "platform": "youtube",
            "profileImageUrl": "https://yt3.ggpht.com/ytc/AAKedOLT2hOZirBUGodAg31-QXaGPd9DmrkxR48UXAw=s48-c-k-c0x00ffffff-no-rj",
            "userName": "ayrshare"
        }
    ],
    "status": "success",
    "id": "Ut2fWU6XkqkMayHGnJZ7",
    "lastUpdated": "2023-03-26T22:30:13.035Z",
    "nextUpdate": "2023-03-26T22:41:13.035Z",
}

Request Examples

curl \
-H "Authorization: Bearer API_KEY" \
-X GET https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ

DELETE Delete Comments

DELETE https://app.ayrshare.com/api/comments/:id

Delete either a single comment or all comments under a post that were sent via Ayrshare. Available for Facebook, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, and YouTube.

Path Parameters

Headers

Request Body

{
    "status": "success",
    "facebook": {
        "action": "delete",
        "status": "success",
        "id": "938010233_939392023" // Facebook Social Comment ID
    },
    "instagram": {
        "action": "delete",
        "status": "success",
        "id": "18010439663043269"  // Instagram Social Comment ID
    }, 
    "linkedin": {
        "action": "delete",
        "status": "success",
        "id": "7133271664032669696"  // LinkedIn Social Comment ID
    },
    "tiktok": {
        "action": "delete",
        "status": "success",
        "commentId": "7303719953248109358", // Deprecated December 1, 2023. Use the id field instead.
        "id": "7303719953248109358" // TikTok Social Comment ID
    },
   "twitter": {
        "action": "delete",
        "status": "success",
        "id": "1633128546494459904" // Twitter Social Comment ID
    },
    "youtube": {
        "action": "delete",
        "status": "success",
        "id": "Ugy2m5u-LS9M29Gn3hd4AaABAg"  // YouTub Social Comment ID
    }
}

Request Examples

curl \
-H "Authorization: Bearer API_KEY" \
-X DELETE https://app.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ

POST Reply to a Comment

POST https://app.ayrshare.com/api/comments/reply

Reply to a comment, i.e. comment on a comment. The endpoint takes the commentId returned from the POST comment endpoint. Please be sure to use the top-level commentId.

Supported platforms: Facebook, Instagram, LinkedIn, TikTok, X/Twitter, and YouTube. For TikTok, please use reply with a comment Id.

Headers

Request Body

{
    "commentId": "Eh61xHheGHvAqXqGISGVa",
    "twitter": {
        "status": "success",
        "commentId": "1734395672961441821",
        "sourceCommentId": "1734395509526155733",
        "comment": "Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things. - Isaac Newton",
        "platform": "twitter",
        "postUrl": "https://twitter.com/ayrshare/status/1734395672961441821"
    },
    "facebook": {
        "status": "success",
        "commentId": "729149842469573_696560159169326",
        "sourceCommentId": "729149842469573_738966840899770",
        "comment": "Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things. - Isaac Newton",
        "platform": "facebook"
    },
    "linkedin": {
        "status": "success",
        "commentId": "7140161360574713856",
        "sourceCommentId": "urn:li:ugcPost:7140160850354397187",
        "comment": "Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things. - Isaac Newton",
        "platform": "linkedin"
    },
    "youtube": {
        "status": "success",
        "commentId": "UgxZ55j-FDri8lrTgVR4AaABAg.9yCaV71m1fo9yCaZvu7Hj4",
        "sourceCommentId": "UgxZ55j-FDri8lrTgVR4AaABAg",
        "comment": "Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things. - Isaac Newton",
        "platform": "youtube"
    },
    "instagram": {
        "status": "success",
        "commentId": "18020060386920755",
        "sourceCommentId": "17998452434360734",
        "comment": "Truth is ever to be found in simplicity, and not in the multiplicity and confusion of things. - Isaac Newton",
        "platform": "instagram"
    },
    "status": "success",
    "id": "ytDgi5vyz36F2yshlJka"
}

Request Examples

curl \
-H "Authorization: Bearer API_KEY" \
-H 'Content-Type: application/json' \
-d '{"commentId": "Ut1fWU6XkqkMayHGnJZ", "platforms": ["facebook", "instagram", "linkedin", "twitter", "youtube"], "comment": "An amazing reply!"}' \
-X POST https://app.ayrshare.com/api/comments/reply