Skip to content

Content planner: writing keywords, pillars and edges

The planner is the site’s editorial plan: keywords (terms), pillars (keywords with role pillar that group clusters) and edges (desired links between two keywords). Reading (GET /v1/plan, GET /v1/plan/keywords/{id}/brief) has existed since v1. This page covers writing. Field reference: plan. Every route exists in two mounts with the same handler: /v1/plan/... (the key’s or grant’s site) and /v1/sites/{site}/plan/....

The SEO service decides whether the planner exists for a site, through the SEO_PLANNER_ENABLED variable:

Value Effect
off (default; empty or unknown also means off) the planner routes are not mounted in seo
on every site
piloto only the sites listed in SEO_PLANNER_SITES (comma-separated ids)

When seo answers 404 without the nao_encontrado marker, the API returns 404 PLAN_NOT_AVAILABLE (the content planner is not enabled for this site). If the response carries nao_encontrado, it is 404 PLAN_KEYWORD_NOT_FOUND (keyword not found in this site's plan). So PLAN_NOT_AVAILABLE means “this site is not in the planner”, not “this keyword does not exist”. The API has no planner flag of its own; OAUTH_ESCOPOS_V2_ENABLED only turns the new routes on or off.

Route Scope (flag on) v1 package that grants it
GET /v1/plan/keywords plan:read none (literal fine-grained)
POST /v1/plan/keywords plan:keywords:write; plus plan:pillars:write if any item has role: "pillar" none (literal fine-grained only)
PATCH /v1/plan/keywords/{id}, only post_id and/or version plan:write (or the fine-grained plan:keywords:link) plan:write
PATCH /v1/plan/keywords/{id}, any other field plan:keywords:write; plus plan:pillars:write if the keyword is or becomes a pillar; plus plan:keywords:link if the body carries post_id none
DELETE /v1/plan/keywords/{id} plan:keywords:write; plus plan:pillars:write if it is a pillar none
POST /v1/plan/edges, DELETE /v1/plan/edges/{id} plan:pillars:write none

plan:keywords:write and plan:pillars:write can only be obtained literally, through an OAuth grant (cvt_): a ck_ key does not issue them and no v1 package expands to them. The plan:write package expands only to plan:keywords:link. All these write scopes count against the grant’s write quota (60 per minute). For a cvt_ bearer, the live permission required on the site is site.content:create, edit_own or edit_any; reading requires site.content:read. See scopes and rate limits.

Write authorship (x-actor-id, x-org-id) comes from the key’s record, never from the client. A key with no author or organization gets 403 forbidden (this key has no author or organization on record; issue a new key).

Janela do terminal
curl -s "https://api.canverly.net/v1/plan/keywords?role=pillar&limit=50" \
-H "Authorization: Bearer $TOKEN"
Parameter Rule
language pt-BR format (2 to 3 lowercase letters and alphanumeric subtags of 2 to 8), up to 35 bytes
role pillar or cluster
q up to 200 characters
cursor an id (ULID), the previous next_cursor
limit 1 to 200 (default 100)

The response is 200 with { "items": [...], "next_cursor": ... }, Cache-Control: private, no-store. Each item carries id, term, language, intent, priority, role, pillar_id, post_id, note and version. An invalid parameter returns 422 INVALID_PARAMETER with field (for example limit must be between 1 and 200).

Idempotency-Key is required. Missing or empty: 400 bad_request (Idempotency-Key header (visible ASCII) is required); above 255 bytes: 400 (Idempotency-Key too long (max 255 chars)).

Janela do terminal
curl -s -X POST https://api.canverly.net/v1/plan/keywords \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: plan-2026-10-24-01" \
-d '{"items": [
{"term": "automation with n8n", "language": "en", "role": "pillar", "intent": "informational", "priority": 1},
{"term": "n8n webhook", "language": "en", "role": "cluster", "pillar_id": "01J..."}
]}'

Body: { "items": [ {term, language, intent?, priority?, role?, pillar_id?, post_id?, note?} ] }, 1 to 200 items. An unknown field in the body is 400 bad_request (invalid request body). An item count outside 1 to 200 is 422 INVALID_PARAMETER (items must have between 1 and 200 entries).

Validation in the API rejects the whole request (422 INVALID_PARAMETER, field = items[i].field): intent in informational, commercial, transactional, navigational; priority 1, 2 or 3; role pillar or cluster; pillar_id and post_id as ULIDs. Defaults applied by seo: informational intent, priority 2, role cluster.

Validation in seo, item by item: a rejected item goes to rejected without failing the batch. term 1 to 200 characters after trimming; language in the trimmed BCP-47 format; note up to 1000 characters; duplicate term (same language and normalized term) inside the batch or in the site; post_id from another site; pillar_id that is not a pillar of the site; role: "pillar" together with pillar_id; a site that already has 2,000 keywords.

Success response, 201:

{
"created": [{ "id": "01J...", "term": "automation with n8n", "language": "en", "role": "pillar", "version": 1 }],
"rejected": [{ "index": 1, "term": "n8n webhook", "reason": "invalid_pillar" }]
}
rejected[].reason Origin (seo code)
duplicate termo_duplicado
invalid invalido
invalid_pillar invalid_pillar (seo now uses the same name)
post_not_in_site post_de_outro_site
site_limit_reached teto_do_site
rejected any other reason

The field detail that seo reports does not cross into rejected[]. If no keyword was created, the response is 422 with the same body { "created": [], "rejected": [...] }, without the error envelope, and that response is not stored for replay.

Idempotency. The same Idempotency-Key with the same body replays the stored 201 (header idempotency-replayed: true). The same key with a different body: 409 IDEMPOTENCY_KEY_REUSED (this Idempotency-Key was already used with a different request body). Only the 201 is stored; if the idempotency store is down, the call proceeds without replay.

PATCH /v1/plan/keywords/{id} already existed in v1 to link a post (post_id). With the v2 flag on it also accepts term, language, intent, priority, role, pillar_id and note, plus version. pillar_id, post_id and note tell absent from null (null clears). An unknown field is rejected.

  • Scope choice is made from the JSON keys: only post_id and/or version asks for plan:write; any other key asks for plan:keywords:write, with the extras in the scopes table.
  • version: with version, the API uses that version, without re-reading or retrying; a mismatch is 409 PLAN_CONFLICT with current_version. Without version, the API reads the current version; on a body with only post_id it retries once after a 409; on the extended body it does not retry.
  • Body {} or only { "version": N }: 422 INVALID_PARAMETER, field: "post_id" (post_id is required (a post id, or null to unlink)).
  • A route id that is not a ULID: 404 PLAN_KEYWORD_NOT_FOUND, without calling seo.
  • 200 response: with only post_id, the public keyword (id, term, language, intent, priority, role, pillar_id, post_id); with the extended body, the full one (plus note and version).
  • seo rules that become 422 PLAN_INVALID: invalid_pillar (a pillar with pillar_id, a pillar_id equal to the keyword itself or pointing at a non-pillar), aresta_de_outro_idioma (changing language while edges exist, field: "idioma"), post_de_outro_site (field: "post_id"). Changing the term to an existing one is 409 PLAN_CONFLICT with reason: "duplicate".

DELETE /v1/plan/keywords/{id} deletes the keyword and its edges, and clears the pillar_id of the clusters that pointed at it. Optional query release_clusters=true|false (any other value: 422 INVALID_PARAMETER, release_clusters must be true or false).

A pillar that still has clusters is only removed with ?release_clusters=true; without it the response is 409 PILLAR_HAS_CLUSTERS with clusters (the count) and the message this pillar still has clusters; pass ?release_clusters=true to delete it and leave them without a pillar.

{ "removed": "01J...", "edges_removed": 3, "clusters_released": 12 }

A second call, or an id that is not a ULID: 404 PLAN_KEYWORD_NOT_FOUND.

POST /v1/plan/edges requires plan:pillars:write and Idempotency-Key (same rules as the keywords POST). Body { "from_id", "to_id", "anchor_hint"? }; an unknown field is 400. from_id and to_id are ULIDs (422 INVALID_PARAMETER, from_id must be a keyword id (ULID)); anchor_hint accepts up to 200 characters.

Janela do terminal
curl -s -X POST https://api.canverly.net/v1/plan/edges \
-H "Authorization: Bearer $TOKEN" -H "Content-Type: application/json" \
-H "Idempotency-Key: edge-01" \
-d '{"from_id": "01J...", "to_id": "01K...", "anchor_hint": "n8n guide"}'

201 response: { "id", "from_id", "to_id", "anchor_hint", "created_at" }. seo rules:

Situation Response
from_id == to_id 422 PLAN_INVALID, reason: "autolink", field: "destino_id"
keyword does not exist in this site 422 PLAN_INVALID without reason, field: "origem_id" or "destino_id"
different languages 422 PLAN_INVALID, reason: "aresta_de_outro_idioma"
more than 10,000 edges in the site 422 PLAN_INVALID, reason: "teto_do_site"
pair already exists 409 PLAN_CONFLICT, reason: "duplicate"

DELETE /v1/plan/edges/{id} answers 200 { "removed": "<id>" }; a missing edge, or an id that is not a ULID, is 404 PLAN_EDGE_NOT_FOUND (edge not found in this site's plan).

Item Limit
Keywords per site 2,000 (above: teto_do_site / site_limit_reached)
Edges per site 10,000
Items per keywords POST 200
List limit 200
Keyword note 1000 characters
anchor_hint 200 characters
Status error.code When
404 PLAN_NOT_AVAILABLE the planner is not enabled for this site
404 PLAN_KEYWORD_NOT_FOUND, PLAN_EDGE_NOT_FOUND id does not exist or is outside the site
409 PLAN_CONFLICT stale version (current_version) or an equal item already exists (reason: "duplicate")
409 PILLAR_HAS_CLUSTERS, IDEMPOTENCY_KEY_REUSED see above
422 PLAN_INVALID seo rejected it; reason (if on the known list) and field are included
503 PLAN_UNAVAILABLE seo down, slow or unconfigured; Retry-After is included (except when unconfigured)

reason in PLAN_INVALID is one of invalido, post_de_outro_site, invalid_pillar, teto_do_site, aresta_de_outro_idioma, autolink; outside that list the field is omitted. The other 422 reasons still use the raw name; the batch uses invalid, post_not_in_site and site_limit_reached. Other errors: errors and limits.

The reason is invalid_pillar in both places: in rejected[] of the batch create and in the reason of the 422 PLAN_INVALID of PATCH and edges. The raw name pilar_invalido is no longer served, with no alias.

When the write comes from a cvt_ bearer, the API sends seo the x-via-app header with the app’s client_id, and the events seo.plano.keyword.changed.v1 and seo.plano.aresta.changed.v1 carry via_app in the payload. With a ck_ key the header is not sent and the payload does not change. Only a client_id matching [A-Za-z0-9_-]{1,64} passes; otherwise the header is omitted. The keyword note does not travel in the event.

For planner writes by an OAuth credential, the API sends x-grant-id to seo together with x-via-app; so the seo.plano.* events carry grant_id. With a ck_ key neither is sent.