Publishing

Post Status and Deleting

Track each post from scheduled to published or failed, read its link, and delete it from the platform.

Each account's post moves through its own statuses. Read the status to know whether a post is live, and delete a live post to remove it from the platform.

Post Status

Get a post with GET /v1/posts/{id}.

import { Configuration, PostsApi } from "@onepostly/sdk";

const postsApi = new PostsApi(
  new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);

const response = await postsApi.getPost({
  id: "pst_3c8a2d6e91b44f7a8e250d6b4c1f9a73",
});
console.log(response);
{
  "id": "pst_3c8a2d6e91b44f7a8e250d6b4c1f9a73",
  "groupId": "grp_7d2e5b1a9c4f4a68b3e07f1c2d9a6e45",
  "accountId": "acc_YOUR_FACEBOOK_ACCOUNT_ID",
  "platform": "facebook",
  "source": "onepostly",
  "status": "published",
  "text": "New release notes are up.",
  "mediaKind": "text",
  "media": [],
  "thread": [],
  "scheduledFor": null,
  "timezone": null,
  "options": {},
  "platformPostId": "104987654321098_122134567890123456",
  "url": "https://www.facebook.com/yourbrand/posts/pfbid02Xk8c7rFqZJ1nT5sV9wYbLmQe3hGdR6uAoPiK4zCxN2",
  "error": null,
  "publishedAt": "2027-03-15T09:00:04.000Z",
  "metrics": {
    "impressions": 1234,
    "reach": 987,
    "likes": 123,
    "comments": 12,
    "shares": 4,
    "saves": null,
    "views": 456,
    "engagement": 139
  },
  "createdAt": "2027-03-15T09:00:00.000Z",
  "updatedAt": "2027-03-15T10:00:00.000Z"
}
statusMeaningFinal
scheduledWaiting for scheduledForNo
publishingOn its way to the platformNo
publishedLive on the platformYes, unless you delete it
failedNot published. The reason is in errorYes
cancelledCancelled before it was publishedYes
deletedRemoved from the platformYes

New statuses can be added, so handle a value you do not know.

The posts of one request share a groupId, but each has its own status. The X post can be published while the Instagram post is failed. To get notified instead of checking, use the post webhooks such as post.published and post.failed.

Failed Posts

A failed post has an error with a code and a message.

{
  "id": "pst_8b7f2c641e3d4f9ab2c56d0e8a4f1b27",
  "platform": "instagram",
  "status": "failed",
  "platformPostId": null,
  "url": null,
  "error": {
    "code": "MEDIA_UNFETCHABLE",
    "message": "Could not download media URL (HTTP 403)."
  }
}
  • A failed post is final. It is not published again, and waiting does not change it. Fix the cause and create a new post for that account.
  • Build your logic on error.code. The message is for people and its wording can change.
  • PUBLISH_INTERRUPTED means the outcome is unknown, and the post may be live. Check the account on the platform before you post again.
  • A failed X post is refunded to the wallet, unless part of its thread went live.

The codes are in each platform page's Errors section, such as X, and in Error Codes.

Threads That Fail Partway

On X, Threads and Bluesky, a reply of a thread can fail after the first posts went live. The post then ends as failed, and its platformPostId and url point to the first post of the thread. To remove the posts that went live, delete the post.

Post Links

A published post has a platformPostId, the platform's own id, and a url, its public link.

  • url can be null on a published post. On some platforms it fills in a few minutes after publishing.
  • On TikTok, platformPostId and url change once TikTok makes the video public.
  • A post that is not published has null for both, except a thread that failed partway.

Delete a Post

DELETE /v1/posts/{id} does what fits the post's status and returns the post.

import { Configuration, PostsApi } from "@onepostly/sdk";

const postsApi = new PostsApi(
  new Configuration({ accessToken: process.env.ONEPOSTLY_API_KEY })
);

const response = await postsApi.deletePost({
  id: "pst_3c8a2d6e91b44f7a8e250d6b4c1f9a73",
});
console.log(response);
{
  "id": "pst_3c8a2d6e91b44f7a8e250d6b4c1f9a73",
  "groupId": "grp_7d2e5b1a9c4f4a68b3e07f1c2d9a6e45",
  "accountId": "acc_YOUR_FACEBOOK_ACCOUNT_ID",
  "platform": "facebook",
  "source": "onepostly",
  "status": "deleted",
  "text": "New release notes are up.",
  "mediaKind": "text",
  "media": [],
  "thread": [],
  "scheduledFor": null,
  "timezone": null,
  "options": {},
  "platformPostId": "104987654321098_122134567890123456",
  "url": "https://www.facebook.com/yourbrand/posts/pfbid02Xk8c7rFqZJ1nT5sV9wYbLmQe3hGdR6uAoPiK4zCxN2",
  "error": null,
  "publishedAt": "2027-03-15T09:00:04.000Z",
  "metrics": {
    "impressions": 1234,
    "reach": 987,
    "likes": 123,
    "comments": 12,
    "shares": 4,
    "saves": null,
    "views": 456,
    "engagement": 139
  },
  "createdAt": "2027-03-15T09:00:00.000Z",
  "updatedAt": "2027-03-16T09:00:00.000Z"
}
StatusWhat happens
scheduledThe post is cancelled and becomes cancelled
publishingThe post is cancelled if it has not reached the platform yet. Otherwise you get 409 POST_PUBLISHING. Try again once its status is final
publishedThe post is deleted from the platform and becomes deleted. A thread is deleted with all its replies
failedIf part of the post went live, such as the first posts of a thread, that part is deleted. Otherwise you get 409 NOT_DELETABLE
cancelled, deletedNothing changes
  • The delete happens during the request. A 200 with status: "deleted" means the platform removed the post, and the post.deleted webhook fires.
  • The post keeps its record in Onepostly with its final status.
  • Other posts of the same group are not affected.
  • Posts made outside Onepostly return 409 NOT_DELETABLE. Delete them on the platform.
  • On X, each delete is paid from the wallet, once for each post of a thread. See X Wallet.

Platform Support

Every platform can delete published posts except TikTok, which returns 400 UNSUPPORTED_PLATFORM. Instagram can only delete posts of accounts connected with Facebook Login. Accounts connected with Instagram Login return 400 MEDIA_DELETE_UNSUPPORTED. Every platform is compared in Capabilities.

Errors

CodeHTTPCauseFix
UNSUPPORTED_PLATFORM400The platform cannot delete posts through the API, such as TikTokDelete the post on the platform
MEDIA_DELETE_UNSUPPORTED400The Instagram account is connected with Instagram LoginReconnect with Facebook Login, or delete the post in Instagram
INSUFFICIENT_WALLET402The wallet does not cover deleting an X postTop up the wallet, then try again
NOT_DELETABLE409Nothing of the post is live, or it was made outside OnepostlyOnly delete posts that are live
POST_PUBLISHING409The post is being published right nowTry again once its status is final
TOKEN_INVALID, TOKEN_EXPIRED409The account's access was revoked or expiredReconnect the account, then try again
DELETE_PERMISSION, PERMISSION_DENIED422The account cannot delete this post, or the platform refusedReconnect and approve every permission, and check that the account owns the post
QUOTA_EXCEEDED429The platform is at capacity for deletesTry again after the time in the message
THREAD_DELETE_PARTIAL502The first post was deleted, but some posts of its thread were notSend the delete again
DELETE_FAILED, PLATFORM_UNAVAILABLE502The platform did not delete the post, or did not respondTry again later, and check the post on the platform

Every other code is in Errors.