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"
}status | Meaning | Final |
|---|---|---|
scheduled | Waiting for scheduledFor | No |
publishing | On its way to the platform | No |
published | Live on the platform | Yes, unless you delete it |
failed | Not published. The reason is in error | Yes |
cancelled | Cancelled before it was published | Yes |
deleted | Removed from the platform | Yes |
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. Themessageis for people and its wording can change. PUBLISH_INTERRUPTEDmeans 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.
urlcan benullon a published post. On some platforms it fills in a few minutes after publishing.- On TikTok,
platformPostIdandurlchange once TikTok makes the video public. - A post that is not published has
nullfor 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"
}| Status | What happens |
|---|---|
scheduled | The post is cancelled and becomes cancelled |
publishing | The post is cancelled if it has not reached the platform yet. Otherwise you get 409 POST_PUBLISHING. Try again once its status is final |
published | The post is deleted from the platform and becomes deleted. A thread is deleted with all its replies |
failed | If 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, deleted | Nothing changes |
- The delete happens during the request. A
200withstatus: "deleted"means the platform removed the post, and thepost.deletedwebhook 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
| Code | HTTP | Cause | Fix |
|---|---|---|---|
UNSUPPORTED_PLATFORM | 400 | The platform cannot delete posts through the API, such as TikTok | Delete the post on the platform |
MEDIA_DELETE_UNSUPPORTED | 400 | The Instagram account is connected with Instagram Login | Reconnect with Facebook Login, or delete the post in Instagram |
INSUFFICIENT_WALLET | 402 | The wallet does not cover deleting an X post | Top up the wallet, then try again |
NOT_DELETABLE | 409 | Nothing of the post is live, or it was made outside Onepostly | Only delete posts that are live |
POST_PUBLISHING | 409 | The post is being published right now | Try again once its status is final |
TOKEN_INVALID, TOKEN_EXPIRED | 409 | The account's access was revoked or expired | Reconnect the account, then try again |
DELETE_PERMISSION, PERMISSION_DENIED | 422 | The account cannot delete this post, or the platform refused | Reconnect and approve every permission, and check that the account owns the post |
QUOTA_EXCEEDED | 429 | The platform is at capacity for deletes | Try again after the time in the message |
THREAD_DELETE_PARTIAL | 502 | The first post was deleted, but some posts of its thread were not | Send the delete again |
DELETE_FAILED, PLATFORM_UNAVAILABLE | 502 | The platform did not delete the post, or did not respond | Try again later, and check the post on the platform |
Every other code is in Errors.