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

# Delete Comments

> Delete a single comment or all comments under a post sent via Ayrshare, or delete comments sent outside of Ayrshare using the Social Comment ID.

> [!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.

The delete endpoint allows you to either delete comments sent via Ayrshare or comments that were sent outside of Ayrshare.

Please see the [Comments Overview](https://www.ayrshare.com/docs/apis/comments/overview.md) for more information on the different ID types.

### Delete Comments Sent from Ayrshare

Delete either a single comment or all comments under a post that were sent via Ayrshare.
Please see the [Ayrshare Post ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-post-id) and [Ayrshare Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-comment-id) for more information.

Supported platforms: Bluesky, Facebook, Instagram, LinkedIn, Reddit, TikTok, X/Twitter, 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 delete 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`.

### Delete Comments Sent Outside of Ayrshare

Delete a comment that was not sent via Ayrshare by using the `commentId` returned for a particular social network.
This is the [Social Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id) from the social networks, not the Ayrshare ID.

Supported platforms: Bluesky, Facebook, Instagram, Threads, TikTok, X/Twitter, and YouTube.

> [!NOTE]
>
> **TikTok — own-authored comments only.** On TikTok, `DELETE /comments` only succeeds for comments authored by the authenticated TikTok account itself (for example, replies you posted via Ayrshare's [reply endpoint](https://www.ayrshare.com/docs/apis/comments/reply-to-comment.md) or directly inside the TikTok app). Attempting to delete a comment authored by another user — even one left on a video you own — returns Ayrshare `code: 328`. If you need to moderate third-party comments on your own TikTok videos, contact support so we can confirm what's available for your linked account type.

For example, you get all the comments for a particular Instagram post using the [Get Comments](https://www.ayrshare.com/docs/apis/comments/get-comments.md) endpoint with the `searchPlatformId` set to `true`.

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

The returned JSON will have a `commentId` for each comment, which you can use to delete the comment. Remember to set the `searchPlatformId` to `true`.

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

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

**id** `string` *required*

Delete a comments sent from Ayrshare:

<ul>
  <li>Delete all comments sent via Ayrshare by providing the [Ayrshare Post ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-post-id).</li>
  <li>Delete a single comment by providing the [Ayrshare Comment ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-ayrshare-comment-id).</li>
</ul>

Delete a comment sent outside of Ayrshare:

<ul>
  <li>
    Delete a single comment by providing the [Social Comment
    ID](https://www.ayrshare.com/docs/apis/comments/overview.md#comments-with-social-comment-id) from the social network.
  </li>

  <li>Must include the `searchPlatformId` set to `true`.</li>
</ul>

## Body Parameters

**platforms** `array`

Required if deleting comments sent via Ayrshare. The platforms to delete comments from.

Supported platforms: `bluesky`, `facebook`, `instagram`, `linkedin`, `reddit`, `threads`, `tiktok`, `twitter`, `youtube`.

```json Deleting comments sent via Ayrshare theme={"system"}
DELETE /comments/:id // Ayrshare Post ID or Ayrshare Comment ID
{
  "platforms": ["bluesky", "facebook", "instagram", "linkedin", "reddit", "threads", "tiktok", "twitter", "youtube"]
}
```

**platform** `string`

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

Supported platforms: `bluesky`, `facebook`, `instagram`, `threads`, `tiktok`, `twitter`, `youtube`. Only one platform is supported at a time.

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

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

```json Deleting comments with Social Comment ID theme={"system"}
DELETE /comments/:id // Social Comment ID
{
  "searchPlatformId": true,
  // bluesky, facebook, instagram, threads, tiktok, twitter, youtube
  "platform": "facebook"
}
```

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

TikTok only. Set to `true`, together with `videoId`, to hide a TikTok comment from public viewers instead of deleting it. The success response returns `action: "hide"` and echoes the comment. Sending `hide=true` without `videoId` returns HTTP `400`.

Hidden comments remain visible to the video owner in TikTok Studio.

```json Hiding a TikTok comment theme={"system"}
DELETE /comments/:id // Social Comment ID
{
  "searchPlatformId": true,
  "platform": "tiktok",
  "hide": true,
  "videoId": "7303719953248109358"
}
```

**videoId** `string`

Required when hiding a TikTok comment (`hide=true`). The TikTok video ID the comment belongs to.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API_KEY" \
-X DELETE https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ
```

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

fetch("https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ", {
  method: "DELETE",
  headers: {
    Authorization: `Bearer ${API_KEY}`,
  },
})
  .then((res) => res.json())
  .then((json) => console.log(json))
  .catch(console.error);
```

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

headers = {'Authorization': 'Bearer API_KEY'}

r = requests.delete('https://api.ayrshare.com/api/comments/Ut1fWU6XkqkMayHGnJZ', headers=headers)

print(r.json())
```

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

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

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

$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    CURLOPT_HTTPHEADER => $headers
]);

$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);

```

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

namespace CommentsDELETERequest_csharp
{
    class CommentsDELETE
    {
        private static readonly HttpClient client = new HttpClient();

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

            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);

            try
            {
                HttpResponseMessage response = await client.DeleteAsync(url);
                response.EnsureSuccessStatusCode();
                string responseBody = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseBody);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine($"Error: {e.Message}");
            }
        }
    }
}
```

```json 200: Success Single Comment theme={"system"}
{
  "status": "success",
  "bluesky": {
    "action": "delete",
    "status": "success",
    "id": "at://did:plc:d/app.bsky.feed.post/3lez", // Bluesky Social Comment ID
    "comment": "This is a comment"
  },
  "facebook": {
    "action": "delete",
    "status": "success",
    "id": "938010233_939392023", // Facebook Social Comment ID
    "comment": "This is a comment"
  },
  "instagram": {
    "action": "delete",
    "status": "success",
    "id": "18010439663043269",  // Instagram Social Comment ID
    "comment": "This is a comment"
  },
  "linkedin": {
    "action": "delete",
    "status": "success",
    "id": "7133271664032669696", // LinkedIn Social Comment ID
    "comment": "This is a comment"
  },
  "threads": {
    "action": "delete",
    "status": "success",
    "id": "18064102964006231"   // Threads 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
    "comment": "This is a comment"
  },
  "twitter": {
    "action": "delete",
    "status": "success",
    "id": "1633128546494459904", // Twitter Social Comment ID
    "comment": "This is a comment"
  },
  "youtube": {
    "action": "delete",
    "status": "success",
    "id": "Ugy2m5u-LS9M29Gn3hd4AaABAg", // YouTub Social Comment ID
    "comment": "This is a comment"
  }
}
```

```json 200: Sucesss Multiple Comments theme={"system"}
{
  "status": "success",
  "linkedin": [
    {
      "action": "delete",
      "status": "success",
      "id": "7090782997972410368", // LinkedIn Social Comment ID
      "comment": "This is a comment"
    },
    {
      "action": "delete",
      "status": "success",
      "id": "7090783025164103680", // LinkedIn Social Comment ID
      "comment": "This is a comment"
    }
  ],
  "twitter": [
    {
      "action": "delete",
      "posts": [
        {
          "action": "delete",
          "status": "success",
          "id": "1685017310942134272", // Twitter Social Comment ID
          "comment": "This is a comment"
        }
      ]
    },
    {
      "action": "delete",
      "posts": [
        {
          "action": "delete",
          "status": "success",
          "id": "1685017338184146946", // Twitter Social Comment ID
          "comment": "This is a comment"
        }
      ]
    }
  ],
  "facebook": [
    {
      "action": "delete",
      "status": "success",
      "id": "676770944469840_644047184361660", // Facebook Social Comment ID
      "comment": "This is a comment"
    },
    {
      "action": "delete",
      "status": "success",
      "id": "676770944469840_983782432932944", // Facebook Social Comment ID
      "comment": "This is a comment"
    }
  ]
}
```

```json 200: Success Hide TikTok Comment theme={"system"}
{
  "status": "success",
  "tiktok": {
    "action": "hide",
    "status": "success",
    "id": "7303719953248109358", // TikTok Social Comment ID
    "comment": "This is a comment"
  }
}
```

```json 400: Comment id not found theme={"system"}
{
  "action": "comments",
  "status": "error",
  "code": 219,
  "message": "Error getting comments. Please verify the comments are still available."
}
```


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