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

> Delete published or scheduled posts by Ayrshare Post ID, bulk delete several posts, or delete all pending scheduled posts for a User Profile at once.

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

Delete a post using the post ID returned from the [/post](https://www.ayrshare.com/docs/apis/post/post.md) endpoint.
You can delete both published and scheduled posts, but there are some differences based on the social network `platform`:

<ul>
  <li>Scheduled posts can be deleted for all social networks `platforms`.</li>

  <li>
    Published posts can be deleted for all social networks `platforms` except
    for Instagram and TikTok. Instagram and TikTok do not provide API support
    for deleting published posts. If you need to delete a published post on
    these platforms, you must do so manually using their respective mobile apps.
  </li>

  <li>
    Facebook does not permit deleting image stories via their API (video stories
    can be deleted). If you need to delete an image story, please go to the
    Facebook mobile app and perform the deletion manually.
  </li>
</ul>

> [!NOTE]
>
> Instagram and TikTok do not support delete via their APIs. Please go to the
> Instagram or TikTok mobile apps to delete the posts.
>
> Facebook does not support image story deletion via its API. Please go to the
> Facebook mobile app to delete stories.

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

## Body Parameters

**id** `string` *required*

Ayrshare Post ID of the post to delete.

Not required if `bulk` or `deleteAllScheduled` parameter sent.

If the post is scheduled and still `pending`, the scheduled posts will be deleted and not sent to the networks.

If the post has already been sent to the networks, the post will be deleted from the networks.

**bulk** `array`

Array of Strings post Ids to bulk delete.

Required if `id` or `deleteAllScheduled` parameter not sent.

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

If `true` will delete all scheduled posts still in a pending state, i.e. posts that have not yet been published to the networks, for the User Profile.

The `id` parameter is ignored if set to `true`. If `bulk` is also sent, `bulk` is used and `deleteAllScheduled` is ignored.

> [!TIP]
>
> This will delete all scheduled posts, so be sure to use this with caution.

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

If `true`, the post will mark as deleted in Ayrshare and Ayrshare will not try to delete the post at the networks.

A common use case for this is when the post was manually deleted at the networks and you want to mark it as deleted in Ayrshare.

Prior to marking the post as deleted, please ensure that the post was already manually deleted on the social networks.

```bash cURL theme={"system"}
curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"id": "Post ID"}' \
-X DELETE https://api.ayrshare.com/api/post
```

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

fetch("https://api.ayrshare.com/api/post", {
      method: "DELETE",
      headers: {
        "Content-Type": "application/json",
        "Authorization": `Bearer ${API_KEY}`
      },
      body: JSON.stringify({ id }),
    })
      .then((res) => res.json())
      .then((json) => console.log(json))
      .catch(console.error);
```

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

payload = {'id': 'Post ID'}
headers = {'Content-Type': 'application/json',
        'Authorization': 'Bearer API_KEY'}

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

print(r.json())
```

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

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

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

$data = json_encode(['id' => $postId]);

$curl = curl_init($apiUrl);
curl_setopt_array($curl, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_CUSTOMREQUEST => 'DELETE',
    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);
```

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

namespace DeletePOSTRequest_csharp
{
    class Delete
    {
        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/post";

            // Set up request headers
            client.DefaultRequestHeaders.Add("Authorization", "Bearer " + API_KEY);

            // Prepare JSON content
            string json = "{\"id\" : \"Post ID\"}";
            var content = new StringContent(json, Encoding.UTF8, "application/json");

            try
            {
                // Create and send DELETE request with content
                var request = new HttpRequestMessage
                {
                    Method = HttpMethod.Delete,
                    RequestUri = new Uri(url),
                    Content = content
                };

                HttpResponseMessage response = await client.SendAsync(request);
                response.EnsureSuccessStatusCode();

                // Read response
                string responseBody = await response.Content.ReadAsStringAsync();
                Console.WriteLine(responseBody);
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine($"Error: {e.Message}");
            }
        }
    }
}
```

```javascript 200: Success theme={"system"}
{
    "twitter": {
        "action": "delete",
        "status": "success",
        "id": "1288900099663775749" // Twitter Social Post ID
    },
    "facebook": {
        "action": "delete",
        "status": "success",
        "id": "104920007983682_108683297607743" // Facebook Social PostID
    },
    "status": "success"
}
```

```json 200: Success with markManualDeleted theme={"system"}
{
  "status": "success",
  "id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
```

```json 400: ID Not Found theme={"system"}
{
  "action": "delete",
  "status": "error",
  "code": 114,
  "message": "Delete id not found.",
  "id": "IdpUOyihLEpIx0d0N9mI" // Ayrshare Post ID used for delete, comment, analytics, etc.
}
```

```json 400: Post Already Deleted theme={"system"}
{
  "action": "delete",
  "status": "error",
  "code": 383,
  "message": "The post is already deleted.",
  "id": "p8Ee6xDPx8PRxsjtDXf3" // Ayrshare Post ID
}
```

```json 400: Mark Manual Deleted Error theme={"system"}
{
  "action": "delete",
  "status": "error",
  "code": 382,
  "message": "The post was not manually deleted at the social network. By using the markManualDeleted option, you are responsible for deleting the post at the social network. Please delete the post and try again.",
  "id": "DD3fA2DC4qe2T48hSdgs",
  "markManualDeleted": true
}
```


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