Edit & delete posts

Learn how to edit and delete Facebook posts using Unipile API.

A post written by one of the account's activated Pages is edited or deleted by that Page: you don't need to specify it.


Edit a post

To edit a post, use Update a Post with the new content in text. The post keeps its media and its audience.

Facebook does not support changing who can comment: setting can_comment returns 400 api/invalid_parameters.

const { data } = await postsApi.updatePost({
  path: {
    account_id: "acc_123456789",
    post_id: "post_id",
  },
  body: {
    text: "This post has been edited!",
  },
});
post = posts_api.update_post(
    "post_id",
    "acc_123456789",
    {"text": "This post has been edited!"},
)
curl --request PATCH \
     --url https://api.unipile.com/v2/acc_123456789/posts/post_id \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json' \
     --header 'content-type: application/json' \
     --data '
{
  "text": "This post has been edited!"
}
'

Delete a post

To delete a post, use Delete a Post.

await postsApi.deletePost({
  path: {
    account_id: "acc_123456789",
    post_id: "post_id",
  },
});
posts_api.delete_post("post_id", "acc_123456789")
curl --request DELETE \
     --url https://api.unipile.com/v2/acc_123456789/posts/post_id \
     --header 'X-API-KEY: api-key' \
     --header 'accept: application/json'
📘

Deleted posts go to the trash

As on facebook.com, a deleted post is moved to the trash, where its author can still read it for 30 days.


Did this page help you?