> ## 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.

# Reply to a Comment

> Reply by Ayrshare or Social Comment ID on Bluesky, Facebook, Instagram, LinkedIn, TikTok, X, and YouTube, with @mentions and one image on Facebook or LinkedIn.

> [!NOTE]
>
> **Targeting X/Twitter?** Starting March 31, 2026, all X operations require your own API credentials. After linking X via OAuth, include these 2 headers in your request:
>
> `X-Twitter-OAuth1-Api-Key` — Your API Key (Consumer Key)
>
> `X-Twitter-OAuth1-Api-Secret` — Your API Key Secret (Consumer Secret)
>
> **One-time setup per Ayrshare account.** You create one X Developer App and reuse the same API Key and Secret across every sub-profile / end-user you link. You do *not* create a new app per customer.
>
> Not linked yet? See the [full setup guide](https://www.ayrshare.com/docs/dashboard/connect-social-accounts/x-twitter-byo-keys.md) to connect your X account.
>
> Your keys are never logged or stored by Ayrshare.

Reply to a comment, i.e. comment on a comment, on either an Ayrshare made comment, using the [Ayrshare Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-comment-id), or a comment made outside of Ayrshare, using the [Social Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id).

Most often, you will reply to a comment made through Ayrshare, but when you want to reply to a comment made outside of Ayrshare, you can use the Social Comment ID, which you get [GET /comment](https://www.ayrshare.com/docs/apis/comments/get-comments.md) endpoint.

> [!NOTE]
>
> Facebook, Instagram, and TikTok only let you reply to comments on posts from your own connected account or page. Here, a comment "made outside of Ayrshare" means one left on your own post, for example a comment a follower wrote in the Instagram app. On these platforms you cannot reply to comments on other users' posts, even with the Social Comment ID.
>
> On LinkedIn and X, Ayrshare does not check who owns the post. Whether a reply on another user's post succeeds depends on that network's rules and the post's reply settings. See [Commenting on Other Users' Social Posts](https://www.ayrshare.com/docs/help-center/technical-support/commenting-on-another-user-post.md).

Supported platforms: Bluesky, Facebook, Instagram, LinkedIn, TikTok, X, and YouTube.

> [!NOTE]
>
> **YouTube comments older than 28 days.** Ayrshare keeps the record of a YouTube comment it sent for 28 days, to stay within the 30-day limit in YouTube's API policies. After that, the Ayrshare ID no longer finds the comment. To reply to it, use its [Social Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id) (the YouTube comment `commentId`) with `"searchPlatformId": true`.

## Header Parameters

**Authorization** `string` *required*

[API Key](https://www.ayrshare.com/docs/apis/overview.md#authorization) of the Primary Profile.

Format: `Authorization: Bearer API_KEY`
**Profile-Key** `string`

[Profile Key](https://www.ayrshare.com/docs/apis/overview.md#profile-key-format) of a User Profile.

Format: `Profile-Key: PROFILE_KEY`

## Path Parameters

**commentId** `string` *required*

If replying to a comment made through Ayrshare, use the [Ayrshare Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-comment-id) `commentId` returned from the [POST comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment.md).

For example, the Ayrshare comment ID `commentId` returned from the [POST comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment.md) is:

```json Ayrshare Comment ID Returned from POST /comment theme={"system"}
{
  "commentId": "Ut1fWU6XkqkMayHGnJZ"
}
```

If replying to a comment made outside of Ayrshare, use the [Social Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id) `commentId` from the social network.

For example, the social comment ID `commentId` returned from a Facebook [POST /comment](https://www.ayrshare.com/docs/apis/comments/post-comment.md) or [GET /comment](https://www.ayrshare.com/docs/apis/comments/get-comments.md) endpoint is:

```json Social Comment ID Returned from POST /comment theme={"system"}
{
  "facebook": { "commentId": "8392829334_1234567890" }
}
```

## Body Parameters

**platforms** `array` *required*

If replying to a comment made through Ayrshare using the [Ayrshare Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-comment-id), specify the platforms to post the reply. Supported platforms: `bluesky`, `facebook`, `instagram`, `linkedin`, `tiktok`, `twitter`, `youtube`.

If replying to a comment made outside of Ayrshare using the [Social Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id), specify the one platform to post the reply. Supported platforms: `facebook`, `instagram`, `linkedin`, `tiktok`, `twitter`.

**comment** `string` *required*

The reply to add to the comment.

**mediaUrls** `array`

Attach an image by providing the image URL. Only one image is supported. Facebook and LinkedIn only.

**searchPlatformId** `boolean` (default: false)

Set to `true` if replying to a comment using the [Social Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id), which is the post `commentId` from the social networks.

**commentUrn** `string`

If replying to a LinkedIn comment with a Social Comment ID, you must also provide the full LinkedIn comment URN, which you get from the [POST /comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment.md) or [GET /comment endpoint](https://www.ayrshare.com/docs/apis/comments/get-comments.md) as `commentUrn` — not the bare `commentId`. The URN has the form `urn:li:comment:(urn:li:activity:<postId>,<commentId>)`.
Only required for LinkedIn and `"searchPlatformId": true`.

**videoId** `string`

If replying to a TikTok comment with a Social Comment ID, you must also provide the TikTok video ID, which you get from the [POST /comment endpoint](https://www.ayrshare.com/docs/apis/comments/post-comment.md) or [GET /comment endpoint](https://www.ayrshare.com/docs/apis/comments/get-comments.md).
Only required for TikTok and `"searchPlatformId": true`.

**objResponse** `boolean` (default: true)

Response as Object, otherwise as an Array. Default to `true`.

## @Mentions in Comments

You can include @mentions directly in the `comment` text string. There is no separate parameter for mentions. Simply add `@handle` in your comment text.

```json Reply with @Mention theme={"system"}
{
  "comment": "Thanks @CompanyName! Great insight.",
  "platforms": ["linkedin", "twitter", "facebook"]
}
```

> [!NOTE]
>
> **LinkedIn Mentions:** LinkedIn mentions are resolved server-side by Ayrshare. Use the [LinkedIn Search endpoint](https://www.ayrshare.com/docs/apis/listen/search/linkedin-search.md) to look up the correct vanity name or member name. For organizations, use `@handle`. For members, use `@vanity_name` or `@[Full Name]`.

For detailed mention syntax and limitations per platform, see:

* [Bluesky mentions](https://www.ayrshare.com/docs/apis/post/social-networks/bluesky.md#bluesky-mentions)
* [Facebook mentions](https://www.ayrshare.com/docs/apis/post/social-networks/facebook.md#facebook-page-mentions)
* [Instagram mentions](https://www.ayrshare.com/docs/apis/post/social-networks/instagram.md#instagram-mentions)
* [LinkedIn mentions](https://www.ayrshare.com/docs/apis/post/social-networks/linkedin.md#linkedin-mentions)
* [Threads mentions](https://www.ayrshare.com/docs/apis/post/social-networks/threads.md#threads-mentions)
* [TikTok mentions](https://www.ayrshare.com/docs/apis/post/social-networks/tiktok.md#tiktok-mentions)
* [X/Twitter mentions](https://www.ayrshare.com/docs/apis/post/social-networks/x-twitter.md#mentions)
* [YouTube mentions](https://www.ayrshare.com/docs/apis/post/social-networks/youtube.md#youtube-mentions)

Reply to comment is not supported on Reddit. See [Post Verification](https://www.ayrshare.com/docs/testing/post-verification.md) for the platform-by-platform mention rules and recommendations.

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

```javascript JavaScript theme={"system"}
const API_KEY = "API_KEY";

fetch("https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    Authorization: `Bearer ${API_KEY}`,
  },
  body: JSON.stringify({
    platforms: ["bluesky", "facebook", "instagram", "linkedin", "twitter", "youtube"], // required
    comment: "An amazing comment!", //required
  }),
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

```python Python theme={"system"}
import requests

payload = {'platforms': ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter', 'youtube'],
        'comment': 'An amazing comment!'}
headers = {'Content-Type': 'application/json',
        'Authorization': 'Bearer API_KEY'}

r = requests.post('https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ',
    json=payload,
    headers=headers)

print(r.json())
```

```php PHP theme={"system"}
<?php

$apiUrl = 'https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ';
$apiKey = 'API_KEY';  // Replace 'API_KEY' with your actual API key

$headers = [
    'Content-Type: application/json',
    'Authorization: Bearer ' . $apiKey,
];

$data = json_encode([
    'platforms' => ['bluesky', 'facebook', 'instagram', 'linkedin', 'twitter', 'youtube'],
    'comment' => 'An amazing comment!'
]);

$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_POST => true,
    CURLOPT_HTTPHEADER => $headers,
    CURLOPT_POSTFIELDS => $data
]);

$response = curl_exec($curl);

if ($response === false) {
    echo 'Curl error: ' . curl_error($curl);
} else {
    echo json_encode(json_decode($response), JSON_PRETTY_PRINT);
}

curl_close($curl);
```

```go Go theme={"system"}
package main

import (
	"bytes"
	"encoding/json"
	"log"
	"net/http"
)

func main() {
	message := map[string]interface{}{
		"platforms": []string{"bluesky", "facebook", "instagram", "linkedin", "twitter", "youtube"}, // required
		"comment": "An amazing comment!", // required
	}

	bytesRepresentation, err := json.Marshal(message)
	if err != nil {
		log.Fatalln(err)
	}

	req, _ := http.NewRequest("POST", "https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ",
		bytes.NewBuffer(bytesRepresentation))

	req.Header.Add("Content-Type", "application/json; charset=UTF-8")
	req.Header.Add("Authorization", "Bearer API_KEY")

	res, err := http.DefaultClient.Do(req)
	if err != nil {
		log.Fatal("Error:", err)
	}

	res.Body.Close()
}
```

```csharp C# theme={"system"}
using System;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;

namespace CommentsReplyPOSTRequest_csharp
{
    class CommentsReply
    {
        static async Task Main(string[] args)
        {
            string API_KEY = "API_KEY";
            string url = "https://api.ayrshare.com/api/comments/reply/Ut1fWU6XkqkMayHGnJZ";

            using (var httpClient = new HttpClient())
            {
                httpClient.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);

                var json = @"{
                    ""platforms"": [""bluesky"", ""facebook"", ""instagram"", ""linkedin"", ""twitter"", ""youtube""],
                    ""comment"": ""An amazing comment!""
                }";

                var content = new StringContent(
                    json,
                    Encoding.UTF8,
                    "application/json"
                );

                try
                {
                    var response = await httpClient.PostAsync(url, content);
                    response.EnsureSuccessStatusCode();
                    string responseBody = await response.Content.ReadAsStringAsync();
                    Console.WriteLine(responseBody);
                }
                catch (HttpRequestException e)
                {
                    Console.WriteLine($"Error: {e.Message}");
                }
            }
        }
    }
}
```

```json 200: Success theme={"system"}
{
  "commentId": "Eh61xHheGHvAqXqGISGVa",
  "bluesky": {
    "status": "success",
    "commentId": "at://did:plc:62musrcyanhro2lydyhlw7ci/app.bsky.feed.post/3lf4bquqrxd2d",
    "cid": "bafyreie2jt5iw6rk2ekmiq6aljyiv7nj4sjucbpkamqc73tmggh5fmrqha",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "bluesky",
    "postUrl": "https://bsky.app/profile/ayrshare.com/post/3lf4bquqrxd2d",
    "sourceCommentId": "at://did:plc:62musrcyanhro2lydyhlw7ci/app.bsky.feed.post/3lf4b4j3dqy2i"
  },
  "facebook": {
    "status": "success",
    "commentId": "729149842469573_696560159169326",
    "sourceCommentId": "729149842469573_738966840899770",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "facebook"
  },
  "instagram": {
    "status": "success",
    "commentId": "18020060386920755",
    "sourceCommentId": "17998452434360734",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "instagram"
  },
  "linkedin": {
    "status": "success",
    "commentId": "7140161360574713856",
    "sourceCommentId": "urn:li:ugcPost:7140160850354397187",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "linkedin"
  },
  "tiktok": {
    "status": "success",
    "commentId": "7484295933044572922",
    "sourceCommentId": "7484407021429703422",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "tiktok",
    "videoId": "7484993689815715122"
  },
  "twitter": {
    "status": "success",
    "commentId": "1734395672961441821",
    "sourceCommentId": "1734395509526155733",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "twitter",
    "postUrl": "https://twitter.com/ayrshare/status/1734395672961441821"
  },
  "youtube": {
    "status": "success",
    "commentId": "UgxZ55j-FDri8lrTgVR4AaABAg.9yCaV71m1fo9yCaZvu7Hj4",
    "sourceCommentId": "UgxZ55j-FDri8lrTgVR4AaABAg",
    "comment": "Truth is ever to be found in simplicity.",
    "platform": "youtube"
  },
  "status": "success",
  "id": "ytDgi5vyz36F2yshlJka"
}
```

```json 400: Unknown commentId theme={"system"}
{
  "facebook": {
    "action": "post",
    "status": "error",
    "code": 215,
    "message": "Error posting comment. Please be sure you are posting a valid comment, the original post exists, the original post is publicly available."
  },
  "code": 215,
  "status": "error",
  "errors": [
    {
      "action": "post",
      "status": "error",
      "code": 215,
      "message": "Error posting comment. Please be sure you are posting a valid comment, the original post exists, the original post is publicly available.",
      "platform": "facebook"
    }
  ],
  "id": "5360106757501_178916202161"
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.