Replace a draft or scheduled post, and publish or schedule a draft.
PUT /v1/posts/{id} replaces the whole editable state of a draft or scheduled post: content, targets,
media and publish mode. The body is the same as create without idempotencyKey, and it
must again contain exactly one of publishNow: true, scheduledFor or saveAsDraft: true.
Publish a draft now:
curl -s -X PUT https://api.betterpost.dev/v1/posts/post_8f3k2m9q1x7v4n6b0c5d2a1z \
-H "x-access-key: $BETTERPOST_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"content": "Go live",
"platforms": [{ "platform": "linkedin", "accountId": "acc_5l1n7k3j9h2g8f4d6s0a1q3w" }],
"publishNow": true
}'What happens depends on the mode in the body:
| Body mode | Result | Credits | Status code |
|---|---|---|---|
saveAsDraft: true | Stays (or becomes) a draft | A scheduled post is refunded | 200 |
scheduledFor | Scheduled at the new time | Charged; an already scheduled post is reconciled | 202 |
publishNow: true | Published now | Charged | 202 |
Reconciling means: targets you keep are not charged twice, removed targets are refunded, added targets are charged,
and a kept X target whose cost changes (for example, a link was added) is refunded and charged at the new cost. If
the new total is more than you have, the API answers 402 and nothing changes.
Posts in any other state (or with some targets already published) return 409 not_editable. To change only the
time of a scheduled post use reschedule.
Reference: PUT /v1/posts/{id}.