Content blocks
A post body is a block document, not a single HTML string. This keeps content portable across themes and safe to render. You send it as the blocks_json field of POST /v1/posts.
This page describes the block types the platform accepts and renders, taken from the code running in the test environment (.net): canverly-authoring 868a24d, canverly-api f7b18b6, canverly-web-public 3fd9896, canverly-seo 732af04. The product card has its own page: Product card.
Envelope
Section titled “Envelope”{ "v": 1, "blocks": [ { "id": "p1", "type": "paragraph", "text": "…" } ]}v— schema version. Only1exists. On creation, a missingvbecomes1; onPATCHand pending edits, a missingvis rejected (400 INVALID_BLOCK).blocks— an ordered array. Render order = array order.
Every block has:
| Field | Type | Required | Notes |
|---|---|---|---|
id |
string | yes | Not empty (e.g. p1, h1, b_ab12). Uniqueness within the document is not checked by any layer; use unique ids anyway. |
type |
string | yes | Not empty. See the types below. |
text |
string | depends | Must be a string; any other JSON type breaks the parse (400 BAD_REQUEST). |
attrs |
object | depends | Type attributes. Any JSON is accepted on write; what each type reads is below. |
What is validated on write
Section titled “What is validated on write”- Authoring (the service that writes) validates only the envelope:
vbetween 1 and 1, and non-emptyidandtype. Failure →400 INVALID_BLOCK(e.g.invalid blocks: block 0: missing id). It does not validate theattrsof any type and accepts anytype, including one the platform does not render. - Public API (
ck_key):blocks_jsonis required, but the API imposes no shape on it; a malformedblocks_jsonor a body with an unknown field comes back as400(invalid body) orINVALID_BLOCK(passed through from authoring). The API then appliesnormalize(listonly) and sanitizes the HTML of the fields listed in HTML sanitization. - External image: authoring imports to the CDN the images pointed to by an external URL in
image,gallery,product_card,video.posterand<img>inside HTML. If the ingestion service permanently rejects the URL (404/410, not an image, too large, forbidden scheme), the whole save is refused with422 IMAGEM_EXTERNA_INVALIDAand a list of up to 20 images (campo,url,motivo). A transient failure does not refuse: it saves and tries again later. - Size limit: the request body is capped at 4 MiB. There is no limit on the number of blocks or on depth at write time; the SEO score refuses documents with more than 5,000 blocks.
Block types
Section titled “Block types”The Site column is what the site renderer (canverly-web-public) does; content_html is what GET /v1/posts/{reference} returns from the public API.
type |
Carries | Site | content_html |
|---|---|---|---|
paragraph |
text (inline HTML) |
<p> |
<p> |
heading |
attrs.level, attrs.anchor, text (plain text) |
<h1>…<h6> with id and section link |
<h1>…<h6> |
list |
text (one item per line) or attrs.items, attrs.ordered/attrs.style |
<ul> / <ol> |
<ul> / <ol> |
quote |
text, attrs.cite, attrs.source_url |
<blockquote> |
<blockquote> (text only) |
code |
text (literal), attrs.language |
<pre><code> |
<pre><code> |
callout |
text, attrs.variant, attrs.title |
<aside role="note"> |
<aside> |
image |
attrs.src or attrs.media_id, alt, caption, credit, align, width, height |
<figure><picture> |
<figure><img> |
gallery |
attrs.images[], attrs.layout |
grid or carousel | <div> with images |
video |
attrs.src, poster, autoplay, muted, loop, controls |
<iframe> (YouTube/Vimeo) or <video> |
just a link |
embed |
attrs.url, attrs.provider |
<iframe> |
just a link |
table |
attrs.headers, attrs.rows |
<table> |
<table> |
columns |
attrs.columns[].width, attrs.columns[].blocks |
column grid | columns become sections in sequence |
divider |
— | <hr> |
<hr> |
html |
text (HTML) |
sanitized HTML | sanitized HTML |
related_posts |
attrs.quantidade, attrs.manuais, attrs.titulo |
cards of articles from the same site | omitted |
product_card |
attrs.product_id (or standalone card) |
product card | omitted |
ad |
attrs.unit_id |
the site’s ad unit | omitted |
Legacy types, which the site still renders because thousands of imported posts depend on them: raw_html, rich_text, bullet_list, ordered_list, separator. See Legacy types.
paragraph
Section titled “paragraph”text may contain inline HTML: <a href>, <strong>, <em>, <code>, <br>. It is sanitized on write by the API and again on render.
{ "id": "p1", "type": "paragraph", "text": "Read the <a href=\"https://docs.canverly.com\">documentation</a> for <strong>more details</strong>." }heading
Section titled “heading”attrs.level goes from 1 to 6; the default is 2 (out-of-range values are clamped to 1–6). text is plain text: HTML tags appear as literal text, because the heading is escaped on output.
The heading id is generated from the text (lowercase, accents removed, only [a-z0-9-], up to 80 characters, with a suffix for repeated headings). To freeze a section link even if you edit the heading, send attrs.anchor; it always wins over the derived anchor. The site adds a # link to the section itself next to every level 2 to 6 heading.
{ "id": "h1", "type": "heading", "attrs": { "level": 2, "anchor": "como-escolher" }, "text": "How to choose" }Items in text, separated by \n, or in attrs.items (array of strings). The list is ordered with attrs.style: "ordered" or attrs.ordered: true. Each item accepts inline HTML.
{ "id": "l1", "type": "list", "attrs": { "style": "unordered" }, "text": "First item\nSecond item\nThird with <a href=\"https://exemplo.com\">link</a>" }When writing through the public API, a list without attrs.items gets attrs = { "ordered": …, "items": […] } derived from the text (the text is kept). Equivalent form sent ready-made:
{ "id": "l2", "type": "list", "attrs": { "ordered": true, "items": ["First", "Second"] } }text is the quotation (sanitized inline HTML). attrs.cite is the source name; attrs.source_url is its address, which becomes the cite attribute of the <blockquote> and the link of the source name (rel="noopener noreferrer").
{ "id": "q1", "type": "quote", "attrs": { "cite": "Canverly Documentation", "source_url": "https://developers.canverly.com/" }, "text": "Publishing should be a single API call." }attrs.cite and attrs.source_url are neither sanitized nor validated on write; send only https:// URLs.
text is preserved literally (never interpreted as HTML). attrs.language sets the highlight class (language-<x>, lowercase); if omitted, the block comes out without a language.
{ "id": "c1", "type": "code", "attrs": { "language": "bash" }, "text": "curl https://api.canverly.com/v1/sites/me -H 'Authorization: Bearer ck_…'" }callout
Section titled “callout”Highlighted notice. attrs.variant is one of: info (default), warning, success, danger. attrs.title is optional and becomes the bold title (plain text). text accepts inline HTML.
{ "id": "co1", "type": "callout", "attrs": { "variant": "warning", "title": "Warning" }, "text": "The price may change. Check the store before buying." }Reference an image by URL (attrs.src) or by a Canverly media id (attrs.media_id, obtained in Media upload). With neither, the block renders nothing.
Field (attrs) |
Type | Notes |
|---|---|---|
src |
string | Image URL. An external URL is imported to the CDN on save. |
media_id |
string | Asset id. If the block has no src, the API fills in src and the dimensions from the asset; what you saved always wins. |
alt |
string | Alternative text. Empty: uses the media’s alt_text. The SEO score reads only attrs.alt. |
caption |
string | Plain text caption. |
credit |
object | Stock image credit: { "caption_parts": [{ "text", "href"? }] }, at most 8 parts of 200 characters; href only https: with no user, password or port. |
align |
string | left, center (default), right or full. |
width, height |
number | Only valid together; they reserve the image space (CLS). |
{ "id": "i1", "type": "image", "attrs": { "src": "https://cdn.exemplo.com/capa.jpg", "alt": "Guide cover", "caption": "Photo: team", "width": 1200, "height": 675 } }gallery
Section titled “gallery”{ "id": "g1", "type": "gallery", "attrs": { "layout": "grid", "images": [ { "src": "https://cdn.exemplo.com/a.jpg", "alt": "Photo A", "caption": "A" }, { "src": "https://cdn.exemplo.com/b.jpg", "alt": "Photo B" } ] } }attrs.layout is grid (default, 2 columns on mobile and 3 on desktop) or carousel. Without images, the block does not render. The SEO score counts the gallery as media but does not read the alt of its images.
{ "id": "v1", "type": "video", "attrs": { "src": "https://www.youtube.com/watch?v=dQw4w9WgXcQ" } }A YouTube or Vimeo URL becomes a player <iframe>; any other URL in attrs.src becomes a <video> (poster, autoplay, muted, loop and controls are booleans; controls is true by default). In the API’s content_html, the video becomes just a link, with no player.
{ "id": "e1", "type": "embed", "attrs": { "url": "https://open.spotify.com/track/ID", "provider": "spotify" } }attrs.provider is youtube, vimeo, twitter, instagram or spotify; if omitted, it is detected from the address. Without attrs.url, it does not render. The site reads only attrs.url; the API, in content_html, reads url or src and emits a link. No layer restricts the host of attrs.url on write.
attrs.headers is an array of strings; attrs.rows, an array of arrays of strings. Each cell accepts sanitized inline HTML. Without headers, the table comes out without a header.
{ "id": "t1", "type": "table", "attrs": { "headers": ["Plan", "Price", "Sites"], "rows": [ ["Free", "R$ 0", "1"], ["Pro", "R$ 49", "<strong>10</strong>"] ] } }columns
Section titled “columns”{ "id": "col1", "type": "columns", "attrs": { "columns": [ { "width": "1/2", "blocks": [ { "id": "col1a", "type": "paragraph", "text": "Left" } ] }, { "width": "1/2", "blocks": [ { "id": "col1b", "type": "paragraph", "text": "Right" } ] } ] } }The inner blocks live in attrs.columns[].blocks[] (not in content[]). width is 1/4, 1/3, 1/2 (default), 2/3 or 3/4, on a 12-column grid that collapses to a single column on mobile. Write-time sanitization and image import descend into the columns. In the API’s content_html, the columns become sections in sequence.
divider
Section titled “divider”{ "id": "d1", "type": "divider" }Raw HTML, for what the other blocks do not cover. On write through the API the HTML is sanitized; on the site it goes through an allowlist again before reaching the page. See HTML sanitization.
{ "id": "h9", "type": "html", "text": "<details><summary>See more</summary><p>Extra content.</p></details>" }related_posts
Section titled “related_posts”“Related articles” section. The block stores the intent, not the posts: the site resolves the list at render time, first the posts you chose (manuais, in your order) and then fills in with the closest ones from the same site, without repeats and without the article itself. Only published posts, of type post, from the same site are included.
{ "id": "r1", "type": "related_posts", "attrs": { "quantidade": 3, "titulo": "Read also", "manuais": ["01J9Z3K8M2XQ4R7T5V6W8Y0A1B"] } }quantidade accepts 3, 4 or 5 (any other value becomes 3); manuais is a list of post ids (up to quantidade); titulo is optional. If nothing is resolved, the block renders neither the list nor the title. The API’s content_html omits the block; to build related posts through the API use GET /v1/posts?category=.
product_card
Section titled “product_card”Sales card for a registered product. It has its own page, with price, link, image, click tracking and the registry rules: Product card.
{ "id": "pc1", "type": "product_card", "attrs": { "product_id": "01J9Z3K8M2XQ4R7T5V6W8Y0A1B" } }Manual position of an ad unit configured on the site: attrs.unit_id points to the unit. Without a unit with that id in the site’s ad configuration, it does not render. The site owner’s dashboard defines the units; the API’s content_html omits the block so as not to inject the site’s monetization into a third party’s page.
{ "id": "ad1", "type": "ad", "attrs": { "unit_id": "in-content-1" } }Legacy types
Section titled “Legacy types”They exist for imported posts (about 1,900 depend on them) and keep rendering. Do not use them in new content.
type |
Format | Renders |
|---|---|---|
raw_html |
text (HTML) |
<div> with sanitized HTML |
rich_text |
text (plain text, escaped), attrs.tag (h2, h3, h4) or attrs.code |
<h2>–<h4>, <pre><code> or <p> |
bullet_list, ordered_list |
content[] with { "text" } per item |
<ul> / <ol> |
separator |
— | <hr> |
The story_page block (story slide) exists in the dashboard editor, but only makes sense on the AMP stories route; on the regular site and in the API it renders nothing (the site emits the unsupported-block comment).
HTML sanitization
Section titled “HTML sanitization”Inline HTML is sanitized at two points, with different allowlists.
On write through the public API (ck_ key, in post POST and PATCH), the API applies the default ammonia 4.1.4 allowlist to the fields:
textofparagraph,quote,callout,heading,html,raw_htmlandrich_text;- each item of
attrs.itemsoflist; - each cell of
attrs.headersandattrs.rowsoftable; - the blocks inside
attrs.columns[].blocks[](recursion).
Kept: a, abbr, b, blockquote, br, caption, cite, code, dd, del, details, div, dl, dt, em, figcaption, figure, h1–h6, hr, i, img, ins, kbd, li, mark, ol, p, pre, q, s, small, span, strong, sub, summary, sup, table, tbody, td, th, thead, time, tr, u, ul and other formatting tags. Attributes: lang and title on any tag; href and hreflang on a; src, alt, width, height on img; colspan, rowspan, scope on cells. URL schemes: http, https, mailto, tel and a few others; javascript: and data: are removed.
Removed: script and style (with their content), iframe, video, form, input, svg, on* attributes, class, id, style, target and srcset. A tag outside the list is removed while keeping the text.
Every <a> comes out with rel="noopener noreferrer". You may add sponsored, nofollow and ugc to your rel; any other token (including opener) is dropped.
Not sanitized on write: list.text (only the derived attrs.items), callout.attrs.title, quote.attrs.* and the attrs of image, gallery, video, embed, product_card, related_posts and ad. The renderer escapes what it prints as text, but the URL attributes of these blocks are not filtered by scheme: send only http:// and https://.
On site render, paragraph, quote, callout, list, table, html and raw_html go through another allowlist (DOMPurify): it also keeps class, id, target, srcset, picture, video, audio, details and data-* and aria-* attributes, and removes style, iframe, form, svg, math and script. On links with target="_blank" the rel is forced to noopener noreferrer, which drops sponsored/nofollow on those links.
In the API’s content_html, the whole output goes through a third, closed allowlist, which removes even the embed iframe (that is why embed and video become a link) and keeps class, id and rel with the tokens sponsored, nofollow and ugc.
If you need plain text, send plain text: it passes through unchanged.
Divergences between the renderer and writes
Section titled “Divergences between the renderer and writes”Points where what the site renders and what authoring and the API validate do not match. None of them is blocked on write.
| Case | What happens |
|---|---|
Unknown type |
Authoring and the API accept and save it. The site emits the comment <!-- unsupported block: <type> -->; the API’s content_html ignores the block; the SEO score ignores the block. |
button_cta, faq, how_to, recipe, review |
Declared as types in authoring (blocks.go), but without a renderer on the site and without a JSON-LD consumer: they appear as “unsupported block”. |
callout |
The dashboard editor writes attrs.tone (info, tip, warning, danger); the site and the API read attrs.variant (info, warning, success, danger). tone is ignored; variant: "tip" breaks the site component. |
gallery |
The dashboard editor writes attrs.items; the site and content_html read attrs.images. Authoring imports images from both fields. Through the API, write attrs.images. |
embed |
The site reads only attrs.url; content_html reads url or src. An embed with only src shows up in the API and disappears on the site. |
heading.level |
The renderer accepts 1 to 6; the SEO score fails H1 in the body. |
product_card without a resolvable product |
Saved without error; the site does not render the card (see Product card). |
image without src or media_id |
Saved without error; renders nothing. |
Missing v |
Accepted on creation (becomes 1); rejected on PATCH. |
Repeated id |
No layer checks it. |
How the SEO score reads each block
Section titled “How the SEO score reads each block”The 0 to 100 score (guia-3) is computed by canverly-seo over blocks_json, and the publish lock requires the minimum (default 85) on posts of type article. See POST /v1/posts/seo/analyze and the SEO and writing criteria. What depends on the block type:
| Block | Body words | Links counted | Other effects |
|---|---|---|---|
paragraph |
yes | text |
short paragraphs, colons, long sentences, dash |
heading |
no | text |
hierarchy, minimum section (40 words between headings), focus in subheadings, FAQ questions |
list |
yes, text only |
text and attrs.items |
ordered list (attrs.style: "ordered") feeds recommendations |
quote |
yes | text and attrs.source_url |
— |
callout |
yes (includes attrs.title) |
text |
— |
table |
no | attrs.headers and attrs.rows |
comparison table recommendation |
image |
— | — | counts as media; attrs.alt feeds imagens_alt and kw_alt |
video, gallery, embed |
— | — | count as media; no evaluable alt |
html, raw_html |
no | text |
“rich” block |
code, ad, related_posts, product_card, story_page |
no | — | “rich” block |
columns |
descends into children (up to 32 levels) | same as children | — |
rich_text, bullet_list, ordered_list, separator, divider, unknown type |
no | rich_text counts links |
ignored in the structure |
Two weighted rules affect the non-text blocks: a heading directly followed by a rich block (image, video, embed, table, gallery, html, raw_html, code, ad, related_posts, product_card, story_page) loses points in rico_apos_heading (weight 4); and the media rule (weight 3) requires at least one image, video, gallery or embed (the cover also counts). The body needs 1,600 words for the full score in corpo_tamanho, counted only in paragraph, list, quote and callout (plus the editorial fields). A block with more than 5,000 items makes the analysis refuse the document.
The kit’s writing validator (Markdown converted to blocks only for measuring) emits heading, paragraph, quote, table and list, never product_card, html, image, callout or code, and measures the 1,600-word floor by summing the text of all blocks without tags, including the headings. The count differs from the SEO score, which does not count headings.
JSON-LD
Section titled “JSON-LD”No block generates structured data. For the post, the site emits the WebSite, Organization, Article/BlogPosting/NewsArticle (type defined by seo_json.schema_type) and BreadcrumbList graph. Only two derived values come from the blocks: wordCount and timeRequired (text of any block, without tags, at 220 words per minute) and, when the post has no summary, the description, taken from the rich_text and raw_html blocks. The structured data image comes from the cover, not from image blocks. The site does not emit FAQPage, HowTo, VideoObject, Product/Offer or ItemList from blocks.
A complete body
Section titled “A complete body”A post with an opening, a highlight, a comparison table and a product card:
{ "v": 1, "blocks": [ { "id": "p1", "type": "paragraph", "text": "Choosing wireless earbuds depends on use. See the <a href=\"https://exemplo.com/guia\">full guide</a> and the comparison below." }, { "id": "h1", "type": "heading", "attrs": { "level": 2 }, "text": "How to choose" }, { "id": "p2", "type": "paragraph", "text": "Compare battery, noise cancellation and price before deciding. The models below were tested for a week." }, { "id": "co1", "type": "callout", "attrs": { "variant": "warning", "title": "Price" }, "text": "Prices change often. Check the amount at the store before buying." }, { "id": "h2", "type": "heading", "attrs": { "level": 2 }, "text": "Quick comparison" }, { "id": "p3", "type": "paragraph", "text": "The table summarizes what each model delivers." }, { "id": "t1", "type": "table", "attrs": { "headers": ["Model", "Battery", "Noise cancellation"], "rows": [ ["Model A", "30 h", "Yes"], ["Model B", "22 h", "<strong>No</strong>"] ] } }, { "id": "h3", "type": "heading", "attrs": { "level": 2 }, "text": "Our pick" }, { "id": "p4", "type": "paragraph", "text": "For daily use, Model A balances battery and price. This is a commercial link: the card below points to the store." }, { "id": "pc1", "type": "product_card", "attrs": { "product_id": "01J9Z3K8M2XQ4R7T5V6W8Y0A1B" } } ]}No heading in this example is directly followed by a rich block: there is a paragraph between h2 and t1, and between h3 and pc1. The product_id must exist in the site’s product registry; see Product card.
Send the document in POST /v1/posts:
curl -X POST https://api.canverly.com/v1/posts \ -H "Authorization: Bearer $CANVERLY_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "title": "Melhores fones sem fio", "status": "draft", "blocks_json": { "v": 1, "blocks": [ … ] } }'A smaller body, with text types only:
{ "v": 1, "blocks": [ { "id": "p1", "type": "paragraph", "text": "An introduction with a <a href=\"https://canverly.com\">link</a>." }, { "id": "h1", "type": "heading", "attrs": { "level": 2 }, "text": "Steps" }, { "id": "l1", "type": "list", "attrs": { "style": "ordered" }, "text": "Get a key\nPOST /v1/posts\nCheck that it is live" }, { "id": "c1", "type": "code", "attrs": { "language": "bash" }, "text": "curl https://api.canverly.com/v1/sites/me -H 'Authorization: Bearer ck_…'" }, { "id": "q1", "type": "quote", "text": "Publishing should be a single API call." } ]}