Skip to content

API v2: fine-grained scopes

Until now the public API asked for coarse scope packages: posts:write covered creating, editing, publishing and deleting. The v2 layer splits those packages into fine-grained scopes, one per action (posts:create, posts:update, posts:publish, posts:delete, …), and adds routes that only make sense with them: revisions, pending edits, the keyword plan, per-post analytics, site creation.

Three points hold for the whole page:

  • The API key (ck_) does not issue new fine scopes. They arrive through an OAuth grant (cvt_, see Connect Canverly). A ck_ key works through the frozen expansion of the v1 packages it already has.
  • The full scope catalog is in Scopes. This page covers their effect on routes.
  • Besides the scope, the bearer needs the person’s live permission on the site (see Live permission).

Both the API and the authorization server read the flag. Unset, empty or any value other than true, 1, yes, on (case-insensitive) means off. It is independent of OAUTH_BEARER_ENABLED.

Route situation Flag off Flag on
Existing route with an equivalent v1 scope Requires the literal v1 scope on the credential. A fine scope alone does not work: 403 Requires the fine scope. The literal fine scope or a v1 package whose expansion contains it works
New route with no v1 equivalent (revisions, plan/keywords writes, plan/edges) 404 not_found, before reading the Authorization header Requires the fine scope
New route with an existing v1 scope (pending, per-post analytics, seo/backlog/refresh, PATCH briefing, GET plan/keywords) 404 not_found Requires the fine scope or the package that contains it
403 message Names the v1 scope: scope `posts:write` not granted Names the fine scope: scope `posts:publish` not granted
Bearer live permission The v1 equivalent, except posts:publish, posts:unpublish and posts:delete (see Publish and delete) The fine scope
If-Match, version and ETag Work Work

The body of the flag-off 404 is this, identical to that of a route that does not exist:

{"error":{"code":"not_found","message":"not found","request_id":"..."}}
  • The seven revision and pending-edit routes.
  • GET /v1/analytics/posts/{reference} and GET /v1/analytics/posts/batch.
  • POST /v1/posts/batch-read and POST /v1/sites/{site}/posts/batch-read (Batch reads).
  • POST /v1/seo/backlog/refresh and GET /v1/seo/backlog/refresh/{job_id}.
  • PATCH /v1/sites/me/briefing.
  • GET, POST and DELETE on plan/keywords, and POST and DELETE on plan/edges.

All of them exist in both mounts: /v1/... (the key’s site or a one-site grant) and /v1/sites/{site}/....

There is no capabilities endpoint, no field in GET /v1/sites/me and no OpenAPI marker that reflects the flag. The served OpenAPI lists the v2-only routes regardless of the flag. What you can observe:

  1. Call a v2-only route with a valid token, for example GET /v1/sites/{site}/posts/{reference}/pending. A 404 with code: "not_found" and message: "not found" means the flag is off.
  2. Beware of the other 404s: post not found and site not found have their own messages and mean the flag is on.
  3. Second signal: a 403 that names `posts:write` where you expected the fine scope means the flag is off.

All apply in both mounts (/v1/... and /v1/sites/{site}/...). The “v1 package that also works” column shows what a credential with the old package can do when the flag is on.

Route Fine scope v1 package that also works Live permission (bearer) Details
GET /posts/{ref}/revisions posts:revisions:read none read Revisions
GET /posts/{ref}/revisions/{rev_id} posts:revisions:read none read same
POST /posts/{ref}/revisions/{rev_id}/restore posts:revisions:restore none edit same
GET /posts/{ref}/pending posts:drafts:read posts:write write same
PUT /posts/{ref}/pending posts:update posts:write edit same
DELETE /posts/{ref}/pending posts:update posts:write edit same
POST /posts/{ref}/pending/promote posts:update:live posts:write edit same
GET /analytics/posts/{ref} analytics:read analytics:read read metrics Analytics
GET /analytics/posts/batch?refs= analytics:read analytics:read read metrics up to 50 distinct refs; 51 gives 400 INVALID_PARAMETER
POST /posts/batch-read posts:read posts:read read up to 50 refs, published only, 1 quota unit per item; Batch reads
POST /seo/backlog/refresh seo:analyze seo:read read SEO
GET /seo/backlog/refresh/{job_id} seo:read seo:read read same
GET /plan/keywords plan:read plan:read read Plan
POST /plan/keywords plan:keywords:write none write 1 to 200 items; Idempotency-Key required; an item with role=pillar also needs plan:pillars:write
DELETE /plan/keywords/{id} plan:keywords:write none write a pillar also needs plan:pillars:write; with clusters, ?release_clusters=true or 409 PILLAR_HAS_CLUSTERS
POST /plan/edges plan:pillars:write none write same as plan
DELETE /plan/edges/{id} plan:pillars:write none write same as plan
PATCH /briefing (/sites/me/briefing in the /v1 mount) briefing:write site:write write Briefing
POST /v1/team/sites sites:create none company owner Create sites

The scopes posts:revisions:read, posts:revisions:restore, plan:keywords:write and plan:pillars:write are in no v1 package: only an OAuth grant with the literal fine scope has them. A posts:write grant with the flag on gets 403 on GET .../revisions.

v1 package Fine scopes it grants
posts:write posts:drafts:read, posts:create, posts:update, posts:update:live, posts:publish, posts:unpublish, posts:delete
media:write media:upload, media:delete
seo:write seo:write, seo:site:write
plan:write plan:keywords:link
site:write briefing:write, site:settings:write
site:read site:settings:read
sites:read sites:read, briefing:read
seo:read seo:read, seo:analyze
export export:posts, export:analytics, export:leads
import import:posts

With the flag on, these routes require the fine scope. With the flag off, the usual v1 applies.

Route Before Now
POST /posts posts:write posts:create (plus posts:publish if it publishes or schedules)
PATCH /posts/{ref} posts:write posts:update (plus posts:update:live if the post is published)
POST /posts/{ref}/publish posts:write posts:publish
POST /posts/{ref}/unpublish posts:write posts:unpublish
DELETE /posts/{ref} posts:write posts:delete
GET /posts/{ref}/source posts:write posts:drafts:read
GET /posts?status= posts:write posts:drafts:read
POST /posts/seo/analyze seo:read seo:analyze
GET /posts/{ref}/seo/score seo:read seo:read (unchanged)
POST /team/sites sites:create sites:create, company owner and per-grant limit
briefing, settings, media, site SEO sites:read, site:write, media:* briefing:read, briefing:write, site:settings:read, site:settings:write, media:upload, media:delete, seo:site:write

A post’s URL never changes after first publication

Section titled “A post’s URL never changes after first publication”

PATCH /v1/posts/{ref} accepts slug (lowercase letters, digits and hyphens, up to 200 characters: ^[a-z0-9]+(-[a-z0-9]+)*$). The rule:

  • The slug is only applied to a draft that was never published. On a published or scheduled post, or one that was ever published (even if it went back to draft), the URL is locked.
  • On a locked post the slug field is ignored without error: the PATCH answers 2xx, saves the other fields and the response carries the original slug.
  • When the requested slug (trimmed) differs from what the post has now, the response carries the header Canverly-Slug-Locked: true. If the request equals the current slug, or the body sends no slug, the header is absent.
  • On a never-published draft, a slug outside the format is 400, and a slug already used by another post of the same site and language is 409 SLUG_TAKEN (no automatic suffix).
PATCH /v1/posts/01J9Z3...
Content-Type: application/json
{ "title": "New title", "slug": "another-address" }
HTTP/1.1 200 OK
Canverly-Slug-Locked: true
{ "slug": "original-address", "title": "New title", "...": "..." }

To change a live URL, use the admin, which creates the redirect. Through the API a published URL is permanent. If you need the new URL, create a new post.

POST /v1/posts asks for posts:create. It asks for posts:publish as well when the body takes the post out of draft:

  • status equal to published, publish, public or live (case-insensitive);
  • status: "scheduled" (with a future published_at; otherwise 422 INVALID_SCHEDULE).

published_at alone on a draft is ignored and does not require posts:publish. The check runs before any effect: no draft is created when it fails.

There is no error.code named SCOPE_REQUIRED. The text SCOPE_REQUIRED:seo:read appears only as a warnings item (see ?include=focus_keyword): the read still returns 200. The real scope refusals are 403 and vary with the credential:

Situation Status error.code error.message
ck_ key without the scope, flag on 403 forbidden scope `posts:publish` not granted
ck_ key without the scope, flag off 403 forbidden scope `posts:write` not granted
cvt_ grant without the scope 403 insufficient_scope scope `<scope>` not granted (with WWW-Authenticate: Bearer error="insufficient_scope")
Grant’s person without the live permission 403 insufficient_scope you no longer have permission for `<scope>` on this site
Bearer with no access to the site 404 not_found site not found (same for a nonexistent site)

Decide by code and status, not by the message.

Publish and delete need their own live permission

Section titled “Publish and delete need their own live permission”

Publishing, unpublishing and deleting require the person’s matching live permission on the site, with the flag on or off:

Action Live permission
publish, unpublish, create already published or scheduled site.content:publish
delete delete_any, or delete_own on a post whose author is the grant’s person

Someone who can only create cannot publish, unpublish, delete or create an already published post. delete_own on someone else’s post answers 403 you may delete only your own posts; with no delete permission at all, 403 you may not delete posts on this site. The ck_ key has no live permission: only the scope applies to it.

Besides the scope on the token, on every call the API checks what the person who connected can do now on the site. The scope-to-permission map:

Scope Live permission
posts:revisions:read, briefing:read, site:settings:read, seo:analyze read content
posts:drafts:read, briefing:write, plan:keywords:write, plan:keywords:link, plan:pillars:write create or edit (own or any)
posts:create site.content:create
posts:update, posts:update:live, posts:revisions:restore edit_own or edit_any
posts:publish, posts:unpublish site.content:publish
posts:delete delete_own or delete_any
sites:create company owner

Listing drafts (GET /posts?status=...) requires posts:drafts:read plus write permission; a read-only person gets 403.

  • The edge.decision.v1 event (version 1.2) gained scope_used (the fine scope the route required) and scope_via (fine, package:<name> or legacy), plus client_id and grant_id when the credential is an OAuth app. Only standalone writes by a company key or OAuth on the /v1/sites/{site}/... routes with a 2xx response publish these fields; reads and denials do not.
  • Metrics: canverly_api_scope_calls_total{scope,app} and canverly_api_scope_denied_total{scope,app}. The app label is the OAuth app name or chave; a scope outside the catalog becomes outro.
  • In revisions and pending edits the author appears as oauth_app, with the app in via_app. IP and user agent never leave.

The values did not change: write 60 per minute (burst 10), read 600 per minute (burst 60 on an OAuth grant; 30 on a ck_ key at GET /v1/posts), app 6000 per minute (burst 200). The classification changed: posts:create, posts:update, posts:update:live, posts:publish, posts:unpublish, posts:delete, posts:revisions:restore, media:upload, media:delete, plan:keywords:link and import:posts count as write, besides those ending in :write. seo:analyze, posts:drafts:read and export:* count as read. Batch reads charge 1 unit per ref. See Rate limits.

The served OpenAPI (/openapi.json) includes the /v1/sites/{site}/... routes, the briefing PATCH, the If-Match header with the 409/412 of PATCH /v1/posts/{reference}, the SITES_CREATE_DAILY_LIMIT 429 of sites:create and the new codes. The published specs in openapi/fontes.json only advance when .com has the services.

.net receives each change first; .com only later, by the owner’s decision. See Availability for the current state.