# Canverly Public API > Public REST API for a Canverly site: publish and edit posts, read the public > archive, upload media, set SEO, change site settings, read analytics and form > leads, and move content in and out in bulk. Any tool, automation or AI agent > can use it. JSON over HTTPS. Authentication is a per-site API key > (`Authorization: Bearer ck_...`). The site is fixed by the key — a key can only > ever touch its own site. Post bodies are a block document (`blocks_json`), not > raw HTML. This file contains everything an agent needs. Base URL: https://api.canverly.com OpenAPI: https://api.canverly.com/openapi.json (served by the API) Contract: https://developers.canverly.com/specs/content-openapi.yaml (version 1.0.0, 34 operations under /v1) Full text (this file + agent flow + errors): https://developers.canverly.com/llms-full.txt Docs: https://developers.canverly.com/en/ (pt-BR: https://developers.canverly.com/) Max request body: 4 MiB JSON (8 MiB for media upload and NDJSON import) ## Authentication Send on every request: Authorization: Bearer ck_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx Two key classes: - ck_ secret key. Server-side only. Can write. Required by every route except the two public read routes, which also accept pk_. - pk_ public read key. Read-only, one site, only from origins the owner registered. May be sent as ?key=pk_... (avoids a CORS preflight). Reaches ONLY GET /v1/posts and GET /v1/posts/{reference}; every other route answers 401 to a pk_ key. A ck_ key in ?key= is a 400. Keys are created in the admin (Configurações → Integrações API) and shown once. No API key can create, list or revoke a key — key management is a site-owner browser session, not an API surface. Scopes are opt-in per key. The full list: posts:write posts:read post_types:read sites:read site:read site:write seo:read seo:write media:read media:write analytics:read leads:read export import plan:read plan:write plan:read / plan:write (content planner) and site:write (writes the briefing) are opt-in and never part of a default key; grant only what the job needs. Measuring the SEO score (see "SEO score gate") needs seo:read; publishing needs posts:write. An agent that writes AND measures needs both on its key. Note: sites:read (identity) and site:read (settings blob) are DIFFERENT scopes. A key may also carry per-request restrictions, all fail-closed: IP/CIDR allowlist, country allowlist (GeoIP; an indeterminate country DENIES), a time window in an IANA zone, and — for pk_ — an origin allowlist. A violation is 403 naming the dimension, e.g. "request blocked by this key's IP restriction". ## OAuth for apps (coming soon on .com; test environment only today) Third-party apps will be able to sign people in ("Sign in with Canverly") and act on their sites ("Connect Canverly") with no API key: OAuth authorization code + PKCE (S256). Not live on .com yet, so keep using a ck_ key there. Opaque access tokens (cvt_, 15 min) and rotating refresh tokens (cvr_) are a third credential kind; they do not replace ck_/pk_. Guides: https://developers.canverly.com/en/guides/login-com-canverly/ and https://developers.canverly.com/en/guides/conectar-canverly/ Scopes: https://developers.canverly.com/en/apps/scopes/ Draft contract: https://developers.canverly.com/rascunhos/oauth-apps-openapi.yaml Examples (no dependencies, no secrets): /examples/canverly-oauth.mjs, /examples/canverly_oauth.py ## Rate limits - 60 req/min per key .......... every route except the two public read routes - 600 req/min per key ......... GET /v1/posts, GET /v1/posts/{reference} - 60 req/min per (key, IP) .... the same two routes, pk_ keys only - 10 req/min per key .......... /v1/leads, /v1/leads/{id}, export of leads (layered ON TOP of the 60/min bucket) 429 carries Retry-After (seconds). A request refused by a key restriction costs no quota. ## SEO score gate (read this before publishing) An ARTICLE (post_type "post") only goes live when its SEO score is at or above a minimum. The minimum is returned by the API (`minimum_to_publish`) - read it, never hardcode it. Pages and custom post types are exempt (`publish_gate_applies: false`). The gate applies to POST /v1/posts with status "published" or "scheduled" and to POST /v1/posts/{reference}/publish. Agent flow (analyze -> create -> publish): 1. POST /v1/posts/seo/analyze with the same body as create (scope seo:read). Saves nothing, uses no creation quota. Returns the score object (see below). 2. Apply suggestions[] (sorted by points gained per effort), analyze again, until score >= minimum_to_publish. Editorial fields count toward the score. 3. POST /v1/posts with status "published" and an Idempotency-Key. 4. 422 SEO_SCORE_BELOW_MINIMUM => a DRAFT WAS ALREADY CREATED; error.post_id names it. Do NOT call create again (duplicate). PATCH /v1/posts/{post_id} to fix it, check GET /v1/posts/{post_id}/seo/score, then POST /v1/posts/{post_id}/publish. 5. 503 SEO_SCORE_UNVERIFIABLE (publish) or SEO_SCORE_UNAVAILABLE (analyze/score) => nothing was published; wait Retry-After seconds (30 if absent) and repeat the SAME call. 429 => wait Retry-After and repeat. Refusal body (422): { "error": { "code": "SEO_SCORE_BELOW_MINIMUM", "message": "...", "score": 72, "minimum_to_publish": 85, "missing": 13, "suggestions": [ { "id", "title", "hint", "points_gain", "effort", "block_id"? } ], "post_id": "", "post_status": "draft" } } Score object (analyze and GET .../seo/score; shown computed live, never cached): score (0-100), band (green|yellow|red|empty), minimum_to_publish, missing, can_publish, publish_gate_applies, word_count, engine_version?, source ("live"), computed_at, post_updated_at? (score route only), checks[] { id, group (basic|additional|title|content|planning), status (ok|warning|error|na), weight, title, hint, block_id?, items? }, suggestions[] { id, title, hint, points_gain, effort (easy|medium|hard), block_id? }. `can_publish` only compares score with the minimum; the gate applies only when publish_gate_applies is true. Compare two scores only if engine_version matches. ## Endpoint: POST /v1/posts (scope: posts:write) Create a post; publish immediately with status "published" (subject to the SEO score gate above). Optional header: Idempotency-Key: A replay with the same key AND body returns the original 201 (with header Idempotency-Replayed: true) and creates no duplicate. Cached 24h, scoped per api key. Errors cache nothing (safe to retry). Request body (application/json): - title string REQUIRED - blocks_json object REQUIRED { "v": 1, "blocks": Block[] } - status string optional "draft" (default) | "published" | "scheduled" ("scheduled" needs published_at in the future, else 422 INVALID_SCHEDULE and nothing is created) - published_at string optional RFC3339 with offset. With "published": backdate or set the date; with "scheduled": when it goes live. Ignored on drafts. - slug string optional auto from title; send a stable slug for safe retries - excerpt string optional stored as SEO description - language string optional BCP-47, default "pt-BR" - post_type string optional "post" (default) | "page" | custom slug - category_slugs string[] optional (must be categories the site already has, else 400 UNKNOWN_CATEGORY listing the valid ones; nothing created) - tag_slugs string[] optional - editorial object optional counts toward the SEO score; every field optional: executive_summary (string <=2000), key_points (string[] <=12 x <=400), key_facts ({claim<=600, source<=300}[] <=20), faq ({question<=300, answer<=2000}[] <=20), sources ({title<=300, url absolute http(s) <=2000}[] <=30). Over a limit: 422 INVALID_EDITORIAL naming the field. - featured_image_id string optional cover: the id from POST /v1/media (same site); else 400 - focus_keyword object optional { "primary": string 1-200, "secondary": string[] <=5 }. Saved BEFORE publishing so the gate measures with it. Invalid: 422 INVALID_FOCUS_KEYWORD. If the post is saved but the focus is not, the 201 carries warnings: ["SEO_FOCUS_NOT_SAVED"]: resend it with PATCH. Never send site_id / org_id / author_id — they are bound to the key and ignored. Block (each needs a unique non-empty "id"): - { "id":"p1", "type":"paragraph", "text":"inline HTML: ,,,,
" } - { "id":"h1", "type":"heading", "attrs":{"level":2}, "text":"Heading" } (level 2–6) - { "id":"l1", "type":"list", "attrs":{"style":"unordered"}, "text":"item1\nitem2" } (style: "unordered"|"ordered"; or attrs.items[]+attrs.ordered) - { "id":"c1", "type":"code", "attrs":{"language":"python"}, "text":"verbatim code" } - { "id":"q1", "type":"quote", "text":"A quote." } - { "id":"i1", "type":"image", "attrs":{"src":"https://.../x.jpg","alt":"..."} } HTML in block text is allowlist-sanitized: