delete

delete
Delete a Post

https://app.ayrshare.com/api/delete
Delete a a post from all social networks or bulk delete pending scheduled posts. Takes a post id returned from the /post.
Request
Response
Request
Headers
Authorization
required
string
Format: Authorization: Bearer API_KEY. See Overview for more information.
Body Parameters
id
required
string
Id of the post to delete. Not required if bulk 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. Note: Instagram images can not be deleted via the API and must be deleted directly at Instagram.
bulk
optional
array
Array of String scheduled post IDs to bulk delete. The post must still be pending to be sent to the networks. If the post has already been processed and sent to the networks, it will be ignored in the bulk delete call. Required if no "id" parameter is passed in the body. Will return an array of delete status.
Response
200: OK
Post successfully deleted.
{
"twitter": {
"action": "delete",
"status": "success",
"id": "1288900099663775749"
},
"facebook": {
"action": "delete",
"status": "success",
"id": "104920007983682_108683297607743"
},
"status": "success"
}

Request Example

cURL
Node.js
Python
PHP
C#
cURL
curl \
-H "Authorization: Bearer API Key" \
-H 'Content-Type: application/json' \
-d '{"id": "Post ID"}' \
-X DELETE https://app.ayrshare.com/api/delete
Node.js
const fetch = require("node-fetch");
const API_KEY = "API_KEY";
const id = "Post ID";
fetch("https://app.ayrshare.com/api/delete", {
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
import requests
payload = {'id': 'Post ID'}
headers = {'Content-Type': 'application/json',
'Authorization': 'Bearer API_KEY'}
r = requests.delete('https://app.ayrshare.com/api/delete',
json=payload,
headers=headers)
print(r.json())
PHP
<?php
require 'vendor/autoload.php'; // Composer auto-loader
$client = new GuzzleHttp\Client();
$res = $client->request(
'DELETE',
'https://app.ayrshare.com/api/delete',
[
'headers' => [
'Content-Type' => 'application/json',
'Authorization' => 'Bearer API_KEY'
],
'json' => [
'id' => '7NFVK0QIXET5rCUS9tmf' // top-level id from post request
]
]
);
echo json_encode(json_decode($res->getBody()), JSON_PRETTY_PRINT);
C#
using System;
using System.Net;
using System.IO;
namespace DeletePOSTRequest_charp
{
class Delete
{
static void Main(string[] args)
{
string API_KEY = "API_KEY";
string url = "https://app.ayrshare.com/api/delete";
var httpWebRequest = WebRequest.CreateHttp(url);
httpWebRequest.ContentType = "application/json";
httpWebRequest.Method = "DELETE";
httpWebRequest.Headers.Add("Authorization", "Bearer " + API_KEY);
using (var streamWriter = new StreamWriter(httpWebRequest.GetRequestStream()))
{
string json = "{\"id\" : \"Post ID\"}";
streamWriter.Write(json);
streamWriter.Flush();
}
var httpResponse = (HttpWebResponse)httpWebRequest.GetResponse();
using (var streamReader = new StreamReader(httpResponse.GetResponseStream()))
{
var response = streamReader.ReadToEnd();
Console.WriteLine(response);
}
}
}
}