Posts
The API lets you manage the whole post lifecycle: create, get, update, and delete. All examples assume you have already obtained a token and send it in the Authorization header. The accounts you publish to must be connected in the web app; their IDs come from listSocialAccounts.
| Operation | Method | Page |
|---|---|---|
| Create a post | mutation createPost | Creating a post |
| Get a post | query post | Getting posts |
| List posts | query posts, postsCount | Getting posts |
| Update a post | mutation updatePost | Updating a post |
| Delete a post | mutation deletePost | Deleting a post |
Post object fields | — | Post object |
Mutations require an active plan and a token with write access (not read-only); the post and posts queries are also available to a read-only token.
Creating
mutation {
createPost(
post: {
fields: { text: "Post text" }
networks: { accounts: ["account_id"] }
}
) {
id
status
}
}
More in createPost: media, UTM tags, VKontakte and Facebook settings, scheduling, drafts.
Getting
query {
post(id: "post_id") {
id
status
publishAt
results {
accountId
success
linkToSocialPost
errorMsg
}
}
}
More in post and posts.
Updating and deleting
mutation {
updatePost(id: "post_id", post: { fields: { text: "New text" } }) {
id
}
}
mutation {
deletePost(id: "post_id") {
id
}
}
More in updatePost and deletePost.
Good to know
- Publishing is asynchronous.
createPostreturns the post right away, and per-account results appear later inresults; the overall outcome is instatus. - Media is loaded by link. The service downloads images and files from
imageUrlsandfileUrlsitself, so the links must be reachable from the internet. - Interval between posts. Settings → Posts sets the minimum interval between publications (in seconds, from 1 to 3600; default 60). You can create posts through the API at any rate, but the actual send time is shifted so that the interval is respected. This interval does not apply to automation.
- Time is UTC. All dates are sent and returned in UTC.
