Revisions, pending edits and concurrency
All routes exist in both mounts: /v1/posts/{reference}/... and /v1/sites/{site}/posts/{reference}/.... {reference} is the post id or slug.
Scopes
Section titled “Scopes”| Route | Fine scope | v1 package that also works |
|---|---|---|
GET .../revisions and GET .../revisions/{rev_id} |
posts:revisions:read |
none |
POST .../revisions/{rev_id}/restore |
posts:revisions:restore |
none |
GET .../pending |
posts:drafts:read |
posts:write |
PUT .../pending and DELETE .../pending |
posts:update |
posts:write |
POST .../pending/promote |
posts:update:live |
posts:write |
PUT .../pending/schedule |
posts:update:live |
posts:write |
posts:update does not promote: promoting is posts:update:live, and so is scheduling the promotion (see Scheduled promotion). The revision scopes come in no package, only through an OAuth grant with the literal fine scope. See also live permission in API v2.
Revisions
Section titled “Revisions”Each relevant write to a post stores a revision. Restoring creates a new revision; nothing rewrites the history. Restore brings back slug, cover and categories; status only goes back between draft and archived.
GET /v1/posts/{reference}/revisions?language=&limit=
languagedisambiguates the slug.limitis an integer greater than zero, capped at 100; an invalid value or zero is ignored, with no 400.- 200 response:
{"items":[{"id","post_id","revision_number","title","excerpt","created_at","actor"}]}. There is nonext_cursor. actor:{"type","user_id","on_behalf_of_user_id","origin","via_app","name"}.via_appis the app’sclient_id. IP, user agent and key or grant ids never leave.
Read one
Section titled “Read one”GET /v1/posts/{reference}/revisions/{rev_id} returns the summary plus blocks_json, seo_json and, when the revision stores the full state, slug, status and featured_image_id. rev_id accepts only [A-Za-z0-9-], 1 to 64 characters; any other value gives 400 bad_request (invalid revision id). A revision of another post gives 404.
Restore (If-Match required)
Section titled “Restore (If-Match required)”POST /v1/posts/{reference}/revisions/{rev_id}/restore, no body.
- The
If-Matchheader is required: the post’s current ETag, or*(“exists”). - Without it: 428
PRECONDITION_REQUIRED, with the messagerestoring a revision requires If-Match with the post's current ETag (or `*`). Nothing is sent to authoring. - A stale, weak, list or malformed ETag: 412
PRECONDITION_FAILED. - 200:
{"id","restored_revision_id","version"}and the newETagheader.
The If-Match check is done at the API edge, comparing with the post’s current ETag; the authoring service does not receive If-Match on restore.
Pending edit
Section titled “Pending edit”A pending edit is a proposal to change a published post, stored without touching what is live. There is one pending edit per post: a new PUT replaces it. The post stays live with the old content throughout the cycle; only promote changes the live version.
| Route | Effect |
|---|---|
GET .../pending |
Reads the unpromoted pending edit |
PUT .../pending |
Creates or replaces |
DELETE .../pending |
Discards (204 no body) |
POST .../pending/promote |
Applies it to the live post |
PUT .../pending/schedule |
Schedules, changes or cancels the automatic promotion |
Optional ?language=. 200 response:
{ "post_id": "...", "base_version": "tok9", "current_version": "tok9", "stale": false, "created_at": "...", "updated_at": "...", "actor": {}, "title": "...", "excerpt": "...", "blocks_json": [], "seo": {}, "featured_image_id": "...", "promote_at": null, "schedule_status": null}promote_at and schedule_status are always present (null with no schedule); on failed schedule_failure is present too. See Scheduled promotion. base_version is the post’s version when the pending edit was saved. current_version and stale (true if the post changed afterwards) come only on GET. The content fields appear only when the pending edit changes them.
JSON body that rejects unknown fields. Accepted fields: title, excerpt, blocks_json, category_slugs, tag_slugs, featured_image_id (absent, null or text: three states), base_version and promote_at (schedules the promotion; see Scheduled promotion). A partial seo is merged into the live SEO before sending. A body with no useful field: 400 no updatable fields provided; an unknown field: 400 invalid request body. The body is only refused after authenticating. Unpublished post: 409 POST_NOT_PUBLISHED (edit drafts with PATCH).
Precondition: If-Match (412) wins over base_version (409). See the concurrency section.
curl -s -X PUT "https://api.canverly.net/v1/sites/$SITE/posts/$POST/pending" \ -H "Authorization: Bearer $ACCESS_TOKEN" \ -H "Content-Type: application/json" \ -d '{"title":"New title","base_version":"tok9"}'Promote
Section titled “Promote”POST .../pending/promote[?force=true], no body, with an optional Idempotency-Key (text up to 255; longer gives 400). The 200 response is the post as it went live, plus version and the ETag header. Repeating with the same key returns the same 200.
Server decision order: key replay, pending edit exists, stale base, SEO gate, write with expected version.
| Situation | Status | error.code |
|---|---|---|
| No pending edit (GET, DELETE, promote) | 404 | PENDING_NOT_FOUND |
| Post not published (PUT, promote) | 409 | POST_NOT_PUBLISHED |
Post changed after the pending edit, without force |
412 | PRECONDITION_FAILED, with current_version, current_etag and the ETag header |
| SEO score below the minimum | 422 | SEO_SCORE_BELOW_MINIMUM, with score, minimum_to_publish, missing, suggestions[]; the pending edit stays |
| SEO down | 503 | SEO_SCORE_UNVERIFIABLE, with Retry-After |
| External image or invalid field | 422 | authoring codes (for example IMAGEM_EXTERNA_INVALIDA) |
SEO gate on promote and force=true
Section titled “SEO gate on promote and force=true”- The score is evaluated on the candidate content: the live post with the pending edit applied (title, excerpt, body, SEO, cover).
- The gate applies to
type=postwithout a custom content type; pages and custom types are exempt. If the site’s gate is off, it lets it through. - Unlike publish: the
publishedstatus does not exempt, and the per-post exemption (seo_trava_isento) does not apply on promote. With SEO down, it denies. force=trueskips only the stale base (the 412). It does not skip the SEO gate: the 422 or 503 refusal still applies.- Whoever reaches promote already has
posts:update:live; the API forwardsforce=truefor that credential.
503 UPSTREAM_INDISPONIVEL
Section titled “503 UPSTREAM_INDISPONIVEL”If the authoring service lacks the pending-edit feature (flag AUTHORING_PENDING_ENABLED off, which answers PENDING_DISABLED), any of the five pending-edit routes answers 503 with error.code UPSTREAM_INDISPONIVEL. Every 5xx has its message replaced by "internal error" on the wire:
{"error":{"code":"UPSTREAM_INDISPONIVEL","message":"internal error","request_id":"..."}}Decide by the code, not the message. The planned readable message (“pending edits are not available”) does not reach the client.
Scheduled promotion
Section titled “Scheduled promotion”Instead of calling promote right away, you set when the pending edit goes live. At that time the authoring service promotes it by itself, through the same path as the manual promote: base version check, SEO gate and the same write as PATCH, without force. The promotion goes out on behalf of whoever saved the pending edit (person, key or app), with origin system in the revision and the events. The loop runs every minute, in the same cycle that publishes scheduled posts, and takes at most 20 due pending edits per cycle.
Schedule, change and cancel
Section titled “Schedule, change and cancel”There are two ways, and both need posts:update:live (the v1 package posts:write works):
PUT .../pending/schedule, without resending the content. Body{"promote_at": "2026-11-01T09:00:00-03:00"}. Thepromote_atkey is required;nullcancels the schedule (this also needsposts:update:live). 200 response: the pending edit, with the schedule fields.promote_attogether withPUT .../pending. With a string it also needsposts:update:live; withnullit does not. Alone in the body it is not an edit: 400no updatable fields provided. EveryPUT .../pendingreplaces the previous schedule: with nopromote_atin the body, any existing schedule is cancelled.
curl -s -X PUT "https://api.canverly.net/v1/sites/$SITE/posts/$POST/pending/schedule" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -d '{"promote_at":"2026-11-01T09:00:00-03:00"}'Validations, all before anything is sent to authoring (400 bad_request):
| Rule | Message |
|---|---|
Value that is neither a string nor null |
promote_at must be an RFC 3339 timestamp string or null |
String that is not RFC 3339 or has no offset (Z or ±hh:mm) |
promote_at must be an RFC 3339 timestamp with a UTC offset |
| Time not in the future | promote_at must be in the future |
| Time more than 365 days ahead | promote_at must be at most 1 year ahead |
A missing promote_at key or an unknown field on PUT .../pending/schedule is also 400. The time is stored normalized to UTC. The other errors are those of the pending edit: 404 PENDING_NOT_FOUND (no pending edit), 409 POST_NOT_PUBLISHED, 403 insufficient_scope and, with the feature off in authoring, 503 UPSTREAM_INDISPONIVEL. Like the other routes on this page, the schedule route is v2-only: with the flag off, 404.
Discarding the pending edit (DELETE .../pending) cancels the schedule. Rescheduling or cancelling also clears the previous failure.
Schedule state
Section titled “Schedule state”GET .../pending and the PUT responses always carry promote_at (RFC 3339 in UTC, or null) and schedule_status (or null). On failed they also carry schedule_failure.
{ "promote_at": "2026-11-01T12:00:00Z", "schedule_status": "failed", "schedule_failure": { "code": "SEO_SCORE_BELOW_MINIMUM", "reason": "error text, up to 500 characters", "failed_at": "2026-11-01T12:00:03Z" }}schedule_status |
Meaning |
|---|---|
null |
No schedule. |
scheduled |
Waiting for the time. |
promoting |
The loop claimed the pending edit and is promoting it. A claim older than 10 minutes is taken over (the loop that held it died). |
failed |
The promotion did not happen. The pending edit stays for review, with schedule_failure. |
promoted |
The state authoring writes when it promotes. Reads only return a not-yet-promoted pending edit, so afterwards GET answers 404 PENDING_NOT_FOUND. |
schedule_failure.code has four values:
code |
Cause | Retried? |
|---|---|---|
VERSION_CONFLICT |
The live post changed after the pending edit’s base version. | No: fails at once. |
SEO_SCORE_BELOW_MINIMUM |
The SEO score of the candidate content is below the minimum. | No: fails at once. |
SEO_SCORE_UNVERIFIABLE |
The SEO service did not answer (the gate denies by default). | Yes, every cycle; on the 5th attempt it becomes failed. |
PROMOTION_FAILED |
Any other refusal. Unpublished or missing post, validation, external image and refused fields fail at once; an infrastructure error is retried like the previous one. | Depends on the cause. |
To leave failed, fix the cause (re-read the post, adjust the pending edit, fix the SEO) and schedule again, or promote by hand with POST .../pending/promote.
Events
Section titled “Events”- Scheduling, changing or cancelling emits
authoring.post.pending_saved.v1withmeta.promote_atandmeta.schedule_status. - The failure emits
authoring.post.pending_promotion_failed.v1(resulterror, withcode,reasonand the attempt count inmeta), in the same transaction that marksfailed. - Success emits
authoring.post.pending_promoted.v1and the usualupdated.
Through webhooks, the app receives post.pending.promoted (and post.updated, except for the suppression of its own edits). The failure is not delivered by webhook: read schedule_status on the pending edit.
Optimistic concurrency
Section titled “Optimistic concurrency”To avoid overwriting an edit made by another person or app, read the version and send it back on the write.
Format
Section titled “Format”The ETag is strong, in quotes: "<token>", where the token is the post’s updated_at in microseconds since the epoch, in base 36 (example from the tests: "tok9"). The version field is the same token without quotes, opaque: do not interpret it.
Where to read
Section titled “Where to read”GET /v1/posts/{reference}/sourcereturns theETagheader and theversionfield (nullif authoring gave no ETag).PATCH /v1/posts/{reference}returns the post,versionin the body and the newETagin the header.GET /v1/posts/{reference}(public) does not return an ETag orversion.
Where to send
Section titled “Where to send”| Route | If-Match |
version / base_version in the body |
|---|---|---|
PATCH /v1/posts/{reference} |
yes | version |
POST .../publish |
yes | no |
POST .../unpublish |
yes | no |
DELETE /v1/posts/{reference} |
yes | no |
POST .../revisions/{rev_id}/restore |
required (428 without it) | no |
PUT .../pending |
yes | base_version |
POST .../pending/promote |
not read from the client; the stale base comes from the pending edit’s state | no |
Without a precondition (POST /v1/posts, plan routes, briefing) there is no check. The briefing has its own integer version and the BRIEFING_CONFLICT error, a different mechanism.
If-Match rules: * means “the post exists”; absent or empty means “no precondition”; a weak ETag (W/"..."), a list ("a", "b") or one without quotes gives 412. When both are sent, If-Match wins over the body’s version.
Errors: 412 and 409
Section titled “Errors: 412 and 409”| How you sent it | Status | error.code |
|---|---|---|
If-Match header differs from the current one |
412 | PRECONDITION_FAILED |
Body version or base_version differs from the current one, or is unreadable |
409 | POST_VERSION_CONFLICT |
Restore without If-Match |
428 | PRECONDITION_REQUIRED |
412 body, with the ETag: "v1" header:
{"error":{"code":"PRECONDITION_FAILED","message":"the post changed since the ETag in If-Match was read; re-read it and retry","current_version":"v1","current_etag":"\"v1\""}}409 body:
{"error":{"code":"POST_VERSION_CONFLICT","message":"the post changed since `version` was read; re-read it and retry","current_version":"v1","current_etag":"\"v1\""}}current_version and current_etag are null if authoring returned no readable ETag. In both cases nothing was written: read again, reapply your change and try once more.
Order on PATCH and a caveat
Section titled “Order on PATCH and a caveat”On PATCH, the API checks the version before any write. Then, with the flag on and the post published, it also requires posts:update:live. If the PATCH writes no editorial fields, If-Match is forwarded to authoring, which closes the race window with an atomic UPDATE; a 412 from that UPDATE reaches the client as a 412 with the current version re-read.
Without If-Match or version, PATCH writes as usual (compatible), without the extra read.
Example sequence
Section titled “Example sequence”Flow: read the source, propose a pending edit, promote; then restore a revision. $SITE and $POST are the site id and the post id or slug.
BASE="https://api.canverly.net/v1/sites/$SITE/posts/$POST"
# 1. Read the source and keep the ETag (header) and version (body)curl -si "$BASE/source" -H "Authorization: Bearer $ACCESS_TOKEN"# ETag: "tok9" body: {"version":"tok9", ...}
# 2. Save the pending edit; the post stays live with the old textcurl -s -X PUT "$BASE/pending" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Content-Type: application/json" \ -d '{"title":"New title","base_version":"tok9"}'# stale base_version -> 409 POST_VERSION_CONFLICT; nothing is written
# 3. Check whether the post changed sincecurl -s "$BASE/pending" -H "Authorization: Bearer $ACCESS_TOKEN"# "stale": false -> safe to promote
# 4. Promote, with an idempotency keycurl -si -X POST "$BASE/pending/promote" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H "Idempotency-Key: promote-001"# 200 + new ETag; 412 if the post changed (redo step 3);# 422 SEO_SCORE_BELOW_MINIMUM if the score falls short (the pending edit stays)
# 5. List revisions and restore one, with If-Match requiredcurl -s "$BASE/revisions?limit=10" -H "Authorization: Bearer $ACCESS_TOKEN"curl -si -X POST "$BASE/revisions/$REV_ID/restore" \ -H "Authorization: Bearer $ACCESS_TOKEN" -H 'If-Match: "tok9"'# no If-Match -> 428; stale ETag -> 412 with current_versionThe served OpenAPI declares the If-Match header and the 409/412 of PATCH /v1/posts/{reference}.
See also: API v2, Update post, Limits and errors, Failure diagnosis.