Content modelling guide for agents
The rules to follow before creating a schema - formats, blocks for page sections, references for shared content and the mistakes to avoid.
Read this before you create or change a schema. It is written for coding agents, and for people who want the rules without the tour.
Every content type is a set of typed fields. Page sections go in a blocks field: an ordered list of typed sections stored inside the entry. Content shared between entries is linked with reference fields that point at other entries. There are no nested groups.
The requests on this page use the Content Management API. Its base is https://mojimoto.com/api/v1/{project}/manage, and every request carries Authorization: Bearer mjmt_your_write_token. The same operations exist as tools on the MCP server.
The rules in short
- Read the existing content model before you change it. Never guess a field id.
- Give every content type the right
format:page,singleorcomponent. - Put page sections in a
blocksfield. - Put content that is shared between entries in its own entries, and link them with
referenceorreferencesfields. - Do not serialise a page structure, such as a Prismic slice zone, into a
jsonfield. It gets no validation, no editor UI and no media handling. - Write every api id in snake_case.
- Upload a file before you write it into a
mediafield. - Saving is not publishing. Publish with a separate call, and expect field rules to be checked then.
Read the model first
Any of these returns the current model:
/api/v1/{project}/content-types/api/v1/{project}/typesOver MCP, read the mojimoto://content-model resource or call list-content-types-tool.
Creating is never an overwrite. Creating a content type whose api_id is taken fails, and so does adding a field that already exists. That protects what a person set up by hand, so check what is there and work with it.
Choose a format for every content type
Every content type has a format. It decides how many entries the type has and whether they have a uid.
format |
What it is | uid |
Entries |
|---|---|---|---|
page |
A collection: many entries, browsed as a list. The default. | Required, and unique within the type. It is the entry's URL slug. | Many |
single |
One entry, such as navigation or site settings. | Forced to null. |
One. Creating a second is rejected. |
component |
A building block edited inside its parent, such as a shared page section or a nav item. Hidden from the main content list and reached only through the entry that references it. | Forced to null. |
Many |
/api/v1/{project}/manage/content-types{ "api_id": "site_settings", "label": "Site settings", "format": "single" }Rules:
- The legacy
repeatableboolean does not control this. Settingrepeatable: falsealone does not make a single. Useformat. - There is no
kindorsingletonparameter. Unknown parameters are rejected with a422:Unknown parameter(s): kind. Accepted: api_id, label, format ("page" | "single" | "component"), icon. - A
pagetype refuses an entry without auid:A URL slug is required - "page" is a collection (format "page"), so each entry is addressed by uid. Only types with format "single" or "component" omit it. - A
singletype refuses a second entry:This single entry already exists. - Give a
pagetype oneslugfield. Saving a value in it sets the entry'suid, so write the same string in both.
To fix a type made with the wrong format, send PUT /content-types/{type} with the new format. A type can become single only while it has at most one entry, and page only when every entry has a uid. A type's api_id cannot be changed: delete the type with DELETE /content-types/{type}, which is allowed only while it has no entries, and create it again.
Name everything in snake_case
Content type api ids, field ids, block type ids and the field ids inside blocks must all match ^[a-z][a-z0-9_]*$: a lowercase letter, then lowercase letters, digits and underscores. blog_post is valid. blogPost, blog-post and 2col are refused, for example with The api_id "blog-post" must be snake_case.
Always send a label in a field's config. It is what editors see.
Decide where each piece of content goes
| The content | Model it as |
|---|---|
| Many things of one kind, each with its own URL: pages, posts, products | A page type. One entry each, with a uid. |
| One of something for the whole site: settings, navigation, footer | A single type. |
| The sections of one page, in an order the editor chooses | A blocks field on the page type. |
| A section or item reused on several pages: a shared call to action, a testimonial | A component type, linked from a references field. |
| One thing an entry points at: a post's author, a product's category | A reference field that allows the other content type. |
| A repeating group of fields | A blocks field with one block type. There are no nested groups. |
| Data with no fixed shape that no editor will touch | A json field. An escape hatch only. |
Page sections with a blocks field
This is the page → sections pattern, and the default way to build a page. Model the page as a page type with a blocks field. The field's config.blocks maps each block type's api id to its label and fields.
Create the type:
/api/v1/{project}/manage/content-types{ "api_id": "page", "label": "Page", "format": "page" }Add the blocks field. This one has two block types, hero and quote:
/api/v1/{project}/manage/content-types/page/fields{
"field": "sections",
"definition": {
"type": "blocks",
"config": {
"label": "Sections",
"blocks": {
"hero": {
"label": "Hero",
"fields": {
"heading": { "type": "symbol", "config": { "label": "Heading", "required": true } },
"image": { "type": "media", "config": { "label": "Image" } }
}
},
"quote": {
"label": "Quote",
"fields": {
"text": { "type": "text", "config": { "label": "Text" } }
}
}
}
}
}
}Create an entry. The value of a blocks field is an ordered array of {"type", "data"}:
/api/v1/{project}/manage/documents{
"type": "page",
"uid": "home",
"data": {
"sections": [
{ "type": "hero", "data": { "heading": "Welcome", "image": { "asset_id": 7, "fit": "cover" } } },
{ "type": "quote", "data": { "text": "The best bread in town." } }
]
}
}That answers 201 with {"id": 12, "uid": "home", "version_id": 31} and saves data as a draft. Publish it:
/api/v1/{project}/manage/documents/12/publishThe delivery API then returns each block as {"id", "type", "data"}, in order, with media expanded to the full asset:
{
"id": 12,
"uid": "home",
"type": "page",
"lang": "en-gb",
"status": "published",
"published_at": "2026-11-26T09:15:02+00:00",
"updated_at": "2026-11-26T09:15:02+00:00",
"data": {
"sections": [
{
"id": "1d7f277f3b",
"type": "hero",
"data": {
"heading": "Welcome",
"image": {
"id": 7,
"url": "https://…/hero.jpg",
"alt": "A loaf on a wooden board",
"width": 2400,
"height": 1200,
"content_type": "image/jpeg",
"fit": "cover"
}
}
},
{
"id": "2aa9b6fea1",
"type": "quote",
"data": { "text": "The best bread in town." }
}
]
}
}Rules for blocks
- Field types. A block's fields may be
symbol,text,rich_text,number,boolean,date,select,media,locationorjson. No references inside blocks yet, and no blocks inside blocks. A block that needs to point at another entry is a job for areferencesfield on the page. config.blocksis required. It is a map keyed by block type api id, never a list, and each block type needs at least one field.minandmaxin the field'sconfiglimit how many blocks an entry may have. They are checked on publish.- Block data uses the same write formats as top-level fields. A
mediafield in a block takes{"asset_id": 7, "fit": "cover"}, and arich_textfield takes a block array or an HTML string. idis the render key. Send anid(any string) with a block to keep its key stable across edits. If you leave it out, one is derived from the block's position and content, so it can change when you rewrite the entry.- Changing the field replaces all of it.
PUT /content-types/{type}/fields/{field}takes a whole new definition. To add one block type, send every existing block type as well.
What publishing checks in a blocks field
Publish errors name the block. The key is the block's position and the message is written for a person:
{
"message": "Sections, block 1 (Hero): Heading is required.",
"errors": {
"sections.0.data.heading": ["Sections, block 1 (Hero): Heading is required."]
}
}A block of a type the field does not have fails under the key sections.0, with Sections, block 1: unknown block type. Use one of: hero, quote.
Shared sections with references
When a section is reused across pages, make it an entry of a component type and link it with an ordered references field. This is a different model from the one above, not a further step: here the page's sections field is a references field.
1. The section type. A component has no uid and is edited inside its parent.
/api/v1/{project}/manage/content-types{ "api_id": "hero_section", "label": "Hero", "format": "component" }/api/v1/{project}/manage/content-types/hero_section/fields{ "field": "heading", "definition": { "type": "symbol", "config": { "label": "Heading" } } }{ "field": "image", "definition": { "type": "media", "config": { "label": "Image" } } }Fields are added one request at a time, so those are two requests to the same address.
2. The page type, a collection with an ordered sections field. content_types is the allow-list of types the field may link to.
/api/v1/{project}/manage/content-types{ "api_id": "page", "label": "Page", "format": "page" }/api/v1/{project}/manage/content-types/page/fields{
"field": "sections",
"definition": {
"type": "references",
"config": { "label": "Sections", "content_types": ["hero_section"] }
}
}3. The content. Create and publish a section, then the page that references it.
/api/v1/{project}/manage/documents{ "type": "hero_section" }That answers {"id": 11, "uid": null}. Publish it with its content:
/api/v1/{project}/manage/documents/11/publish{ "data": { "heading": "Welcome", "image": { "asset_id": 7, "fit": "cover" } } }Now the page. Creating it answers {"id": 12, "uid": "home"}:
/api/v1/{project}/manage/documents{ "type": "page", "uid": "home" }/api/v1/{project}/manage/documents/12/publish{ "data": { "sections": [11] } }4. Delivery resolves the references, in order.
/api/v1/{project}/documents?type=page&uid=home&depth=2{
"results": [
{
"id": 12,
"uid": "home",
"type": "page",
"lang": "en-gb",
"status": "published",
"published_at": "2026-11-26T09:15:02+00:00",
"updated_at": "2026-11-26T09:15:02+00:00",
"data": {
"sections": [
{
"id": 11,
"uid": null,
"type": "hero_section",
"lang": "en-gb",
"status": "published",
"published_at": "2026-11-26T09:14:40+00:00",
"updated_at": "2026-11-26T09:14:40+00:00",
"data": {
"heading": "Welcome",
"image": {
"id": 7,
"url": "https://…/hero.jpg",
"alt": "A loaf on a wooden board",
"width": 2400,
"height": 1200,
"content_type": "image/jpeg",
"fit": "cover"
}
}
}
]
}
}
],
"page": 1,
"per_page": 20,
"total_results": 1,
"total_pages": 1,
"lang": "en-gb",
"ref": "published"
}Rules for reference fields
content_typesis required onreferenceandreferencesfields. Every type it lists must already exist in the project, so create the component type before the field that points at it.- The value is an entry id. A
referencetakes one id, such as42. Areferencesfield takes an ordered array, such as[11, 12, 13]. The order is kept and is the render order. - Ids are checked on publish. Every entry must exist in the same project, or the publish fails with
Sections references an entry that does not exist in this project.The entry's type is not checked againstcontent_types, so link the right kind of entry yourself. depthsets how far links are followed. It defaults to1and is clamped to1to3.depth=1resolves the sections themselves. Usedepth=2when sections have references of their own.mediafields resolve to full asset objects at any depth.- Beyond the depth, a link collapses to a stub:
{"id": 11, "type": "hero_section", "uid": null}. - A linked entry is only included when it has something to serve. Published content resolves published entries, and
ref=previewresolves drafts too. If a reference comes back as a stub or with emptydata, check that the linked entry was published and not only created. - Deleting a linked entry makes a
referenceto it resolve tonull, and drops it from areferenceslist.
Mistakes the API will not catch
These are accepted without an error, so they are yours to avoid.
- A misspelt field id in
data. A key that is not a field of the content type is stored and delivered as written, and the real field stays empty. Use the exact ids from the model. - Sending only the fields you changed.
PUT /documents/{id}saves a new draft that is exactly thedatayou send. Fields you leave out are not carried over from the last draft, so send them all. - Expecting a draft to be checked. Field rules such as
required,min,maxandpatternare not enforced when you save a draft. They are enforced on publish, which answers422with an error for each field that fails. - An entry created without
data. It has no versions yet. It is a404on the delivery API, and a reference to it resolves to a bare{"id", "type", "uid"}stub, until content is saved and published. - A page structure in a
jsonfield. It is accepted, and then has no validation, no editor UI and no media handling. Use ablocksfield.
Before you write content
- The write format of every field type is on the Field types page. The ones that catch agents out: a
mediafield takes{"asset_id": 7, "fit": "cover"}after you upload the file, a raw image object is refused, andrich_texttakes an array of blocks. langon a write has to be one of the project's locales. It defaults to the project's default locale. Naming a locale the project does not have is a422that lists the ones it has.- Every endpoint used here, with its parameters and responses, is in the Content Management API reference.
- How blocks look in the editor and render on a site is on the Blocks page. How references resolve is on the Links page.
- Moving a Prismic repository over has its own page: Importing from Prismic.
Something wrong or missing on this page? Tell us and we will fix it.