Skip to content

Agent integration guide

This page is written for autonomous agents (and the engineers wiring them up). It states the contract with zero ambiguity so a model can call the API correctly on the first try. Everything an agent needs is also available as machine-readable files:

  • /llms.txt — the full, curated contract in one plain-text file. Fetch this and you can publish.
  • /llms-full.txt — llms.txt plus the agent-flow guide and the error table, in one file (to paste whole into a context).
  • /specs/content-openapi.yaml — the OpenAPI 3.1 contract of the public API, at a stable URL (also auth, forms and tenancy at /specs/<id>-openapi.yaml).
  • https://api.canverly.com/openapi.json — OpenAPI schema served by the API itself, for tool/function-calling.
  • Endpoint: POST https://api.canverly.com/v1/posts
  • Headers: Authorization: Bearer <CANVERLY_API_KEY>, Content-Type: application/json
  • Body (minimum): { "title": string, "blocks_json": { "v": 1, "blocks": Block[] }, "status": "published" }
  • Block: { "id": string, "type": string, "text"?: string, "attrs"?: object }. Types that render: paragraph, heading, list, quote, code, callout, image, gallery, video, embed, table, columns, divider, html, related_posts, product_card and ad. An unknown type is stored without error and does not show. Fields, examples and limits of each one in Content blocks; the product card in Product card.
  • Success: 201 → { "id", "slug", "status", "public_url" }
  • The site is fixed by the key. Never put site_id anywhere; you cannot target another site.

An article only goes live with an SEO score at or above the minimum. The flow that wastes no calls:

  1. Measure without saving: POST /v1/posts/seo/analyze with the same body as create (scope seo:read). Read score, minimum_to_publish, missing and suggestions[] (already sorted by points gained per effort).
  2. Fix and measure again until score >= minimum_to_publish. Read the minimum from the response; do not hardcode it. The editorial fields (executive summary, key points, facts, FAQ, sources) count toward the score.
  3. Create and publish: POST /v1/posts with status: "published" and a stable Idempotency-Key. Send the same focus_keyword ({"primary": "…", "secondary": ["…"]}) to analyze and to create: without a focus the score loses 10 points. If the response carries warnings: ["SEO_FOCUS_NOT_SAVED"], the post was saved but the focus was not: resend it with PATCH.
  4. On 422 SEO_SCORE_BELOW_MINIMUM: create already made a draft, and error.post_id identifies it. Do not call create again. Fix it with PATCH /v1/posts/{post_id}, confirm with GET /v1/posts/{post_id}/seo/score and publish with POST /v1/posts/{post_id}/publish.
  5. On 503 (SEO_SCORE_UNVERIFIABLE when publishing, SEO_SCORE_UNAVAILABLE when measuring): nothing was published. Wait Retry-After seconds and repeat the same call.
  6. On 429: wait Retry-After and repeat.
  7. Verify: GET https://<primary_domain>/<slug> returns 200.
import time, requests
API = "https://api.canverly.com"
KEY = "ck_live_xxx" # load the secret from an environment variable / secret store, never from code
def chamar(metodo, caminho, extra_headers=None, **kw):
"""Retry on 429/503 honoring Retry-After (max 3 retries)."""
headers = {"Authorization": f"Bearer {KEY}", **(extra_headers or {})}
for tentativa in range(4):
r = requests.request(metodo, API + caminho, headers=headers, timeout=30, **kw)
if r.status_code in (429, 503) and tentativa < 3:
time.sleep(int(r.headers.get("Retry-After", 30)))
continue
return r
return r
artigo = {"title": "…", "blocks_json": {"v": 1, "blocks": [...]}}
nota = chamar("POST", "/v1/posts/seo/analyze", json=artigo).json()
# apply nota["suggestions"] to the article until nota["score"] >= nota["minimum_to_publish"]
r = chamar("POST", "/v1/posts", json={**artigo, "status": "published"},
extra_headers={"Idempotency-Key": "item-42"})
if r.status_code == 422 and r.json()["error"]["code"] == "SEO_SCORE_BELOW_MINIMUM":
post_id = r.json()["error"]["post_id"] # the draft already exists
# chamar("PATCH", f"/v1/posts/{post_id}", json={...})
r = chamar("POST", f"/v1/posts/{post_id}/publish")
r.raise_for_status()

Per-route details: SEO score and publishing.

Publishing is the common case, but the API is not publish-only. Every route below is reachable with the same bearer key, subject to that key’s scopes.

Goal Call Scope
Measure the SEO score of a draft (saves nothing) POST /v1/posts/seo/analyze seo:read
Measure the score of a saved post GET /v1/posts/{reference}/seo/score seo:read
Publish an article POST /v1/posts posts:write
Publish or schedule an existing draft POST /v1/posts/{reference}/publish posts:write
Take a post down (becomes archived) POST /v1/posts/{reference}/unpublish posts:write
Read the editable source (blocks as stored) GET /v1/posts/{reference}/source posts:write
Fix or re-date a post (id or slug, drafts included) PATCH /v1/posts/{reference} posts:write
Read what is already published GET /v1/posts (keyset, ?since= for incremental sync) posts:read
Read one article with its body GET /v1/posts/{reference} (id or slug) posts:read
Avoid duplicating an existing article GET /v1/posts?q=<title> before writing posts:read
Set title/description/canonical/no_index PATCH /v1/posts/{reference}/seo seo:write
Upload an image to use in a post POST /v1/media (multipart, field file) media:write
Check which post types exist GET /v1/post-types post_types:read
Resolve the public domain and the site niche GET /v1/sites/me (editorial: vertical, label) sites:read
Read the site’s editorial briefing (audience, tone, sources, banned topics) GET /v1/sites/me/briefing sites:read
Write the briefing (a human or operator, not the writing agent) PUT /v1/sites/me/briefing site:write
Read the content plan and a keyword’s brief (opt-in, off by default: 404 PLAN_NOT_AVAILABLE) GET /v1/plan, GET /v1/plan/keywords/{id}/brief plan:read
Link or unlink the post of a plan keyword PATCH /v1/plan/keywords/{id} plan:write
See which posts to improve first (stored score, easy gain) GET /v1/seo/backlog?order=easiest seo:read
Read traffic numbers GET /v1/analytics/summary analytics:read
Load many posts at once POST /v1/import (NDJSON) import + posts:write
Pull the archive out GET /v1/export?resource=posts (NDJSON) export

Full parameters and responses: the API reference.

Give your agent this verbatim (fill in the key via a tool/secret, never inline it in the prompt):

You can publish articles to a Canverly site through its public API.
ENDPOINT: POST https://api.canverly.com/v1/posts
HEADERS: Authorization: Bearer ${CANVERLY_API_KEY}
Content-Type: application/json
BODY (JSON):
- title (string, required)
- status (string): "published" to go live, "draft" to stage. Default "draft".
- blocks_json (object, required): { "v": 1, "blocks": [ ...blocks ] }
- slug (string, optional): omit to auto-generate; for retries send a STABLE slug.
- excerpt (string, optional): one-sentence summary.
- language (string, optional): BCP-47, e.g. "en" or "pt-BR".
- category_slugs (string[], optional), tag_slugs (string[], optional).
- focus_keyword (object, optional): {"primary": string, "secondary": string[<=5]}.
Send the SAME one to analyze and to create; without it the score loses 10 points.
If the 201 carries warnings ["SEO_FOCUS_NOT_SAVED"], resend it with PATCH.
BLOCK SHAPES (each needs a unique "id"):
- { "id":"p1", "type":"paragraph", "text":"inline HTML allowed (<a>,<strong>,<em>,<code>)" }
- { "id":"h1", "type":"heading", "attrs":{"level":2}, "text":"Heading" }
- { "id":"l1", "type":"list", "attrs":{"style":"unordered"}, "text":"item one\nitem two" }
- { "id":"c1", "type":"code", "attrs":{"language":"python"}, "text":"print('hi')" }
- { "id":"q1", "type":"quote", "text":"A quote." }
- { "id":"co1", "type":"callout", "attrs":{"variant":"info|warning|success|danger","title":"Optional"}, "text":"Highlighted note." }
- { "id":"t1", "type":"table", "attrs":{"headers":["A","B"],"rows":[["1","2"]]} }
- { "id":"pc1", "type":"product_card", "attrs":{"product_id":"<id of a product registered in the site panel>"} }
(the card needs a registered product; unknown/unresolved ids render nothing and raise no error;
never put a heading right before it; details: https://developers.canverly.com/apis/content/blocks/product-card/)
- Other types that render: image, gallery, video, embed, columns, divider, html, related_posts, ad.
Unknown "type" values are stored without error and are NOT rendered. Full list: https://developers.canverly.com/apis/content/blocks/
RULES:
- Body content is blocks_json, NOT raw HTML and NOT markdown.
- Do NOT send site_id/org_id/author_id; the key fixes the site.
- <script>, event handlers and javascript: URLs are stripped; do not rely on them.
- For safe retries, send header "Idempotency-Key: <stable id>" (e.g. the source
item id). A replay with the same key+body returns the original 201 (no duplicate).
- On 429, read Retry-After and wait that many seconds, then retry.
- On 201, the response has "slug"; the post is live at https://<site-domain>/<slug>.
PUBLISHING FLOW (articles must reach a minimum SEO score to go live):
1. POST /v1/posts/seo/analyze with the same body (scope seo:read). Saves nothing.
Read score, minimum_to_publish, missing and suggestions[] (best gain per effort first).
2. Apply the suggestions, re-run analyze until score >= minimum_to_publish.
Read minimum_to_publish from the response; never hardcode it.
3. POST /v1/posts with status "published" (and an Idempotency-Key).
4. If 422 SEO_SCORE_BELOW_MINIMUM: a DRAFT was already created, error.post_id names it.
Do NOT call create again. PATCH /v1/posts/{post_id} to fix it, check
GET /v1/posts/{post_id}/seo/score, then POST /v1/posts/{post_id}/publish.
5. If 503 SEO_SCORE_UNVERIFIABLE: nothing was published. Wait Retry-After seconds
(30 if absent) and retry the same call. Same for 503 SEO_SCORE_UNAVAILABLE on analyze/score.
6. 409 NOT_PUBLISHABLE on publish = the post is already live (or archived): stop, do not retry.
- Optional fields that count toward the score: "editorial" {executive_summary,
key_points[], key_facts[{claim,source}], faq[{question,answer}], sources[{title,url}]}.
- status "scheduled" needs published_at in the future (RFC3339), else 422 INVALID_SCHEDULE.
- category_slugs must be categories the site already has, else 400 UNKNOWN_CATEGORY.
OPTIONAL DISCOVERY (each needs its own scope on the key):
- GET /v1/post-types -> valid post_type slugs (default "post").
- GET /v1/sites/me -> { id, slug, primary_domain, default_language }.
- GET /v1/posts?q=... -> check whether you already published this; the response
is { "items": [...], "next_cursor": string|null }. Absent/null cursor = end.
- GET /v1/posts?since=<RFC3339> -> only what changed since your last run.
EDITING AN EXISTING POST:
- PATCH /v1/posts/{reference} (id or slug, drafts included) with only the fields to
change: title, blocks_json, excerpt, category_slugs, tag_slugs, published_at,
editorial, featured_image_id, focus_keyword. There is no status or slug field: publish
a draft with POST /v1/posts/{reference}/publish; you cannot rename a URL, and the API
creates no 301 redirect (a human makes it in the admin).
- A PATCH on a PUBLISHED post goes live immediately and skips the SEO gate. Never assume
it is safe. To REWRITE an existing article: read GET /v1/posts/{reference}/source (never
rebuild from content_html), read GET /v1/sites/me and GET /v1/sites/me/briefing first,
keep the original for rollback, write the new version as a draft or wait for human
approval, measure with analyze (minimum from the response), keep slug and URL.
- excerpt/category_slugs/tag_slugs are MERGED into the post's SEO object, not replaced.
- Do NOT send published_at unless the date is genuinely wrong; it re-pings
IndexNow on every call.
SEO:
- GET /v1/posts/{reference}/seo, then PATCH only the keys you want to change.
The PATCH MERGES: omitted keys are kept; send "" or [] to clear a key.
  1. (optional) Resolve the site — GET /v1/sites/me → cache primary_domain and default_language.
  2. (optional) Check post types — GET /v1/post-types → confirm your post_type slug exists (default post).
  3. (optional) Check for a duplicate — GET /v1/posts?q=<title> → if a close match already exists, patch it instead of publishing a second one.
  4. Measure — POST /v1/posts/seo/analyze with the same body until score >= minimum_to_publish (see the agent flow).
  5. Publish — POST /v1/posts with the body above. Expect 201. On 422 SEO_SCORE_BELOW_MINIMUM, fix the draft in error.post_id and use POST /v1/posts/{post_id}/publish.
  6. (optional) Set SEO — PATCH /v1/posts/{reference}/seo with just the keys to change (it merges).
  7. Verify — GET https://<primary_domain>/<slug> returns 200, or re-read the post through GET /v1/posts/{id}.
{
"title": "Example",
"status": "published",
"blocks_json": { "v": 1, "blocks": [
{ "id": "p1", "type": "paragraph", "text": "Body text." }
] }
}

Function/tool schema (for tool-calling models)

Section titled “Function/tool schema (for tool-calling models)”
{
"name": "canverly_publish_post",
"description": "Create and optionally publish a post on the Canverly site bound to the API key.",
"parameters": {
"type": "object",
"required": ["title", "blocks_json"],
"properties": {
"title": { "type": "string" },
"status": { "type": "string", "enum": ["draft", "published", "scheduled"], "default": "draft" },
"published_at": { "type": "string", "format": "date-time" },
"editorial": { "type": "object" },
"slug": { "type": "string" },
"excerpt": { "type": "string" },
"language": { "type": "string" },
"post_type": { "type": "string", "default": "post" },
"category_slugs": { "type": "array", "items": { "type": "string" } },
"tag_slugs": { "type": "array", "items": { "type": "string" } },
"blocks_json": {
"type": "object",
"required": ["v", "blocks"],
"properties": {
"v": { "type": "integer", "const": 1 },
"blocks": {
"type": "array",
"items": {
"type": "object",
"required": ["id", "type"],
"properties": {
"id": { "type": "string" },
"type": { "type": "string",
"enum": ["paragraph", "heading", "list", "code", "quote", "image"] },
"text": { "type": "string" },
"attrs": { "type": "object" }
}
}
}
}
}
}
}
}
Status Meaning Agent action
401 Bad/missing key Stop; surface a “needs valid API key” message.
403 Missing scope Stop; the key needs posts:write.
400 / 422 Bad payload (empty title, missing blocks_json, wrong types, UNKNOWN_CATEGORY, INVALID_SCHEDULE, INVALID_EDITORIAL) Fix the field the error names and retry once.
422 SEO_SCORE_BELOW_MINIMUM SEO score below the minimum; the draft was created (error.post_id) Apply error.suggestions to the draft (PATCH), measure, then POST …/publish. Do not recreate.
409 NOT_PUBLISHABLE The post is already published or archived Stop; do not repeat.
503 SEO_SCORE_UNVERIFIABLE / SEO_SCORE_UNAVAILABLE The score could not be verified/computed right now; nothing was published Wait Retry-After seconds and repeat the same call.
429 Rate limited Sleep Retry-After seconds, then retry.
404 The post/asset is not on this site (or does not exist — the two are indistinguishable) Stop; do not enumerate ids looking for one that works.
5xx Transient Exponential backoff (e.g. 1s, 2s, 4s), max ~3 tries. Reuse the same Idempotency-Key.

Rate limits differ per route: 60 req/min for writes, 600 req/min for the public read routes, 10 req/min for leads. An agent that reads a lot and writes a little will hit the write bucket first.

See Errors & rate limits for the full table.