Build a site
Schema
Push a site's content schema, read it back, list the section types and upload section thumbnails.
View as MarkdownThese four endpoints connect a site repo to its store. All live under /v1/api/objects and need the objects module (403 {"error":"Module not enabled: objects"} otherwise). The two writes need objects:schema, which only a connected site's push key carries (see The two keys); the two reads need objects:read.
These four endpoints connect a site repo to its store. All live under /v1/api/objects and need the objects module (403 {"error":"Module not enabled: objects"} otherwise). The two writes need objects:schema, which only a connected site's push key carries (see The two keys); the two reads need objects:read.
PUT /v1/api/objects/schema
Plans or applies a compiled manifest. The body is the manifest as JSON. Requires the objects:schema scope.
| Name | Type | Required | Description |
|---|---|---|---|
dry_run | query, 0 or 1 | no | 1 plans and writes nothing. Default 0. |
yes | query, 0 or 1 | no | 1 lets an apply archive properties, types or section types that hold values or records. Without it such a push is planned but not applied. Default 0. |
Status: 200 OK, also when the plan refuses something (then applied is false).
| Field | Type | Description |
|---|---|---|
plan | array | The ops in the order they apply, each {op, target, key, detail}. op is add, update, archive, unarchive or refuse; target is type, property, section_type, section_field or page. See The plan. |
applied | boolean | true when the push changed the store. false on a dry run, when any op is refuse, when an archive holds values and yes was not 1, when the manifest is unchanged, and when the plan has no ops (the new hash is still stored). |
needs_yes | boolean | true when the plan archives values or records, so it applies only with yes=1. |
refused | boolean | true when any op is refuse; nothing applies until the manifest changes. |
manifest_hash | string | SHA-256 (64 hex characters) of the normalized manifest. When it equals the hash of the last applied push, plan is [] and nothing runs. |
Every call, dry runs and failed ones included, is kept in the site's push history (a failed one with its errors). The starter section types are created first when missing, so a manifest may name them without declaring them. An applied push records the hash, the time and the key that pushed it, and sends the webhook event object_schema.updated. An apply runs in one transaction: it applies every op or none.
Errors
422{"code": "no_site", "message": "No website is connected. Connect one under Settings > Website first."}when the store has no connected site.422{"message": "...", "errors": {"types.0.key": ["..."]}}when the manifest has the wrong shape. Errors are keyed by dotted path into the manifest.422{"code": "site_mismatch", "message": "The manifest is for site other-web; this store's site is bakery-web."}when the manifest'ssiteis not the connected site's key.403{"message":"Invalid ability provided."}when the key lacksobjects:schema.
curl -X PUT "https://api.borkol.com/v1/api/objects/schema?dry_run=1" \
-H "Authorization: Bearer {push_key}" \
-H "Content-Type: application/json" \
--data @manifest.json{
"plan": [
{ "op": "add", "target": "section_type", "key": "hero", "detail": "2 fields, looks full, split, thumbnail" },
{ "op": "add", "target": "type", "key": "bread", "detail": "2 properties" },
{ "op": "add", "target": "property", "key": "bread.name", "detail": "text" },
{ "op": "add", "target": "property", "key": "bread.body", "detail": "sections" }
],
"applied": false,
"needs_yes": false,
"refused": false,
"manifest_hash": "f78d42f8be58f6d5a4157b40a4ecbff94eb46e742ad56f7e1bc6327b8ba8c860"
}PUT /v1/api/objects/schema
Plans or applies a compiled manifest. The body is the manifest as JSON. Requires the objects:schema scope.
| Name | Type | Required | Description |
|---|---|---|---|
dry_run | query, 0 or 1 | no | 1 plans and writes nothing. Default 0. |
yes | query, 0 or 1 | no | 1 lets an apply archive properties, types or section types that hold values or records. Without it such a push is planned but not applied. Default 0. |
curl -X PUT "https://api.borkol.com/v1/api/objects/schema?dry_run=1" \
-H "Authorization: Bearer {push_key}" \
-H "Content-Type: application/json" \
--data @manifest.jsonStatus: 200 OK, also when the plan refuses something (then applied is false).
| Field | Type | Description |
|---|---|---|
plan | array | The ops in the order they apply, each {op, target, key, detail}. op is add, update, archive, unarchive or refuse; target is type, property, section_type, section_field or page. See The plan. |
applied | boolean | true when the push changed the store. false on a dry run, when any op is refuse, when an archive holds values and yes was not 1, when the manifest is unchanged, and when the plan has no ops (the new hash is still stored). |
needs_yes | boolean | true when the plan archives values or records, so it applies only with yes=1. |
refused | boolean | true when any op is refuse; nothing applies until the manifest changes. |
manifest_hash | string | SHA-256 (64 hex characters) of the normalized manifest. When it equals the hash of the last applied push, plan is [] and nothing runs. |
{
"plan": [
{ "op": "add", "target": "section_type", "key": "hero", "detail": "2 fields, looks full, split, thumbnail" },
{ "op": "add", "target": "type", "key": "bread", "detail": "2 properties" },
{ "op": "add", "target": "property", "key": "bread.name", "detail": "text" },
{ "op": "add", "target": "property", "key": "bread.body", "detail": "sections" }
],
"applied": false,
"needs_yes": false,
"refused": false,
"manifest_hash": "f78d42f8be58f6d5a4157b40a4ecbff94eb46e742ad56f7e1bc6327b8ba8c860"
}Every call, dry runs and failed ones included, is kept in the site's push history (a failed one with its errors). The starter section types are created first when missing, so a manifest may name them without declaring them. An applied push records the hash, the time and the key that pushed it, and sends the webhook event object_schema.updated. An apply runs in one transaction: it applies every op or none.
Errors
422{"code": "no_site", "message": "No website is connected. Connect one under Settings > Website first."}when the store has no connected site.422{"message": "...", "errors": {"types.0.key": ["..."]}}when the manifest has the wrong shape. Errors are keyed by dotted path into the manifest.422{"code": "site_mismatch", "message": "The manifest is for site other-web; this store's site is bakery-web."}when the manifest'ssiteis not the connected site's key.403{"message":"Invalid ability provided."}when the key lacksobjects:schema.
GET /v1/api/objects/schema
The connected site, every object type with its active properties, and every active section type. The CLI's drift check compares a local manifest with it. Requires the objects:read scope. No parameters.
Status: 200 OK.
| Field | Type | Description |
|---|---|---|
site | object or null | {key, name, site_url} of the connected site; null when none is connected. |
types | array | Every object type, in the shape of GET /v1/api/objects/types, ordered by name. |
section_types | array | Every active section type, in the shape of GET /v1/api/objects/section-types below, ordered by name. |
Errors
403{"message":"Invalid ability provided."}when the key lacksobjects:read.
curl https://api.borkol.com/v1/api/objects/schema \
-H "Authorization: Bearer {api_key}"{
"site": { "key": "bakery-web", "name": "Bakery", "site_url": "https://bakery.example.com" },
"types": [
{
"name": "Bread",
"plural_name": "Breads",
"key": "bread",
"system_key": null,
"site": "bakery-web",
"help": "One loaf per record.",
"settings": {
"publishable": true,
"menu": { "placement": "objects", "icon": null, "position": 100 },
"singleton": false,
"hierarchical": false,
"slug": { "source": "name", "prefixes": { "en": "/bread" } }
},
"properties": [
{ "key": "name", "label": "Name", "help": "Max 4 words.", "type": "text", "options": null, "localized": false, "config": null, "is_required": true, "position": 0 },
{ "key": "body", "label": "Body", "help": null, "type": "sections", "options": null, "localized": false, "config": null, "is_required": false, "position": 1, "section_type_keys": ["hero"] }
]
}
],
"section_types": [
{
"key": "hero",
"name": "Hero",
"site": "bakery-web",
"icon": "image",
"group": "Intro",
"help": "The first block of a page.",
"looks": [{ "key": "full", "name": "Full" }, { "key": "split", "name": "Split" }],
"fields": [{ "key": "title", "label": "Title", "kind": "text", "required": true, "localized": true, "help": "Max 6 words." }],
"item_label_field": "title",
"thumbnail_url": "https://cdn.borkol.com/tenants/abc/media/2b3c/hero.png"
}
]
}GET /v1/api/objects/schema
The connected site, every object type with its active properties, and every active section type. The CLI's drift check compares a local manifest with it. Requires the objects:read scope. No parameters.
curl https://api.borkol.com/v1/api/objects/schema \
-H "Authorization: Bearer {api_key}"Status: 200 OK.
| Field | Type | Description |
|---|---|---|
site | object or null | {key, name, site_url} of the connected site; null when none is connected. |
types | array | Every object type, in the shape of GET /v1/api/objects/types, ordered by name. |
section_types | array | Every active section type, in the shape of GET /v1/api/objects/section-types below, ordered by name. |
{
"site": { "key": "bakery-web", "name": "Bakery", "site_url": "https://bakery.example.com" },
"types": [
{
"name": "Bread",
"plural_name": "Breads",
"key": "bread",
"system_key": null,
"site": "bakery-web",
"help": "One loaf per record.",
"settings": {
"publishable": true,
"menu": { "placement": "objects", "icon": null, "position": 100 },
"singleton": false,
"hierarchical": false,
"slug": { "source": "name", "prefixes": { "en": "/bread" } }
},
"properties": [
{ "key": "name", "label": "Name", "help": "Max 4 words.", "type": "text", "options": null, "localized": false, "config": null, "is_required": true, "position": 0 },
{ "key": "body", "label": "Body", "help": null, "type": "sections", "options": null, "localized": false, "config": null, "is_required": false, "position": 1, "section_type_keys": ["hero"] }
]
}
],
"section_types": [
{
"key": "hero",
"name": "Hero",
"site": "bakery-web",
"icon": "image",
"group": "Intro",
"help": "The first block of a page.",
"looks": [{ "key": "full", "name": "Full" }, { "key": "split", "name": "Split" }],
"fields": [{ "key": "title", "label": "Title", "kind": "text", "required": true, "localized": true, "help": "Max 6 words." }],
"item_label_field": "title",
"thumbnail_url": "https://cdn.borkol.com/tenants/abc/media/2b3c/hero.png"
}
]
}Errors
403{"message":"Invalid ability provided."}when the key lacksobjects:read.
GET /v1/api/objects/section-types
The store's active section types: the vocabulary a sections value can hold. Archived section types are left out; the starter section types are always listed unless a site archived them. Requires the objects:read scope. No parameters.
Status: 200 OK. data is a plain array, ordered by name; each item contains:
| Field | Type | Description |
|---|---|---|
key | string | The section type key, the type of a section instance. |
name | string | Display name. |
site | string or null | The connected site's key when the site pushed this section type; null for a starter or dashboard-made section type. |
icon | string or null | Lucide icon name. |
group | string or null | The group the section picker shows it under. |
help | string or null | What the section is for, shown in the picker. |
looks | array | {key, name} per visual variant. An empty list means one look, default. |
fields | array | The field definitions: {key, label, kind, required, localized, config, help?}; config carries row fields of a repeater. Field kinds and value shapes are those of the property types. |
item_label_field | string or null | The field that names an instance in the editor. |
thumbnail_url | string or null | Public URL of the picker thumbnail; null when none was uploaded. |
The route is read-only: POST, PUT and DELETE answer 405. Section types change through a schema push.
Errors
403{"message":"Invalid ability provided."}when the key lacksobjects:read.
curl https://api.borkol.com/v1/api/objects/section-types \
-H "Authorization: Bearer {api_key}"{
"data": [
{
"key": "hero",
"name": "Hero",
"site": "bakery-web",
"icon": "image",
"group": "Intro",
"help": "The first block of a page.",
"looks": [{ "key": "full", "name": "Full" }, { "key": "split", "name": "Split" }],
"fields": [{ "key": "title", "label": "Title", "kind": "text", "required": true, "localized": true, "help": "Max 6 words." }],
"item_label_field": "title",
"thumbnail_url": "https://cdn.borkol.com/tenants/abc/media/2b3c/hero.png"
}
]
}GET /v1/api/objects/section-types
The store's active section types: the vocabulary a sections value can hold. Archived section types are left out; the starter section types are always listed unless a site archived them. Requires the objects:read scope. No parameters.
curl https://api.borkol.com/v1/api/objects/section-types \
-H "Authorization: Bearer {api_key}"Status: 200 OK. data is a plain array, ordered by name; each item contains:
| Field | Type | Description |
|---|---|---|
key | string | The section type key, the type of a section instance. |
name | string | Display name. |
site | string or null | The connected site's key when the site pushed this section type; null for a starter or dashboard-made section type. |
icon | string or null | Lucide icon name. |
group | string or null | The group the section picker shows it under. |
help | string or null | What the section is for, shown in the picker. |
looks | array | {key, name} per visual variant. An empty list means one look, default. |
fields | array | The field definitions: {key, label, kind, required, localized, config, help?}; config carries row fields of a repeater. Field kinds and value shapes are those of the property types. |
item_label_field | string or null | The field that names an instance in the editor. |
thumbnail_url | string or null | Public URL of the picker thumbnail; null when none was uploaded. |
{
"data": [
{
"key": "hero",
"name": "Hero",
"site": "bakery-web",
"icon": "image",
"group": "Intro",
"help": "The first block of a page.",
"looks": [{ "key": "full", "name": "Full" }, { "key": "split", "name": "Split" }],
"fields": [{ "key": "title", "label": "Title", "kind": "text", "required": true, "localized": true, "help": "Max 6 words." }],
"item_label_field": "title",
"thumbnail_url": "https://cdn.borkol.com/tenants/abc/media/2b3c/hero.png"
}
]
}The route is read-only: POST, PUT and DELETE answer 405. Section types change through a schema push.
Errors
403{"message":"Invalid ability provided."}when the key lacksobjects:read.
POST /v1/api/objects/media
Uploads a section type thumbnail during a push. Send multipart/form-data. Requires the objects:schema scope. The image is re-encoded like a dashboard upload (metadata stripped) and kept out of the merchant's media library.
| Name | Type | Required | Description |
|---|---|---|---|
file | file | yes | A jpeg, png, webp or avif image, at most 20 MB. SVG and other formats are refused. |
Status: 201 Created.
| Field | Type | Description |
|---|---|---|
id | string (UUID) | The media id. Put it in the section type's thumbnail_media_id in the manifest. |
url | string | Public URL of the stored image. |
Errors
422{"message": "...", "errors": {"file": ["..."]}}when the file is missing, too large or not one of the allowed formats.422{"message": "The file is not a processable image."}when the bytes are not an image the server can decode.422{"message": "Images may be at most 25 megapixels (for example 5000 x 5000)."}when the image has more than 25 million pixels.403{"message":"Invalid ability provided."}when the key lacksobjects:schema.
curl -X POST https://api.borkol.com/v1/api/objects/media \
-H "Authorization: Bearer {push_key}" \
-F "file=@borkol/thumbs/hero.png"{
"id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"url": "https://cdn.borkol.com/tenants/abc/media/2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e/hero.png"
}POST /v1/api/objects/media
Uploads a section type thumbnail during a push. Send multipart/form-data. Requires the objects:schema scope. The image is re-encoded like a dashboard upload (metadata stripped) and kept out of the merchant's media library.
| Name | Type | Required | Description |
|---|---|---|---|
file | file | yes | A jpeg, png, webp or avif image, at most 20 MB. SVG and other formats are refused. |
curl -X POST https://api.borkol.com/v1/api/objects/media \
-H "Authorization: Bearer {push_key}" \
-F "file=@borkol/thumbs/hero.png"Status: 201 Created.
| Field | Type | Description |
|---|---|---|
id | string (UUID) | The media id. Put it in the section type's thumbnail_media_id in the manifest. |
url | string | Public URL of the stored image. |
{
"id": "2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e",
"url": "https://cdn.borkol.com/tenants/abc/media/2b3c4d5e-6f7a-4b8c-9d0e-1f2a3b4c5d6e/hero.png"
}Errors
422{"message": "...", "errors": {"file": ["..."]}}when the file is missing, too large or not one of the allowed formats.422{"message": "The file is not a processable image."}when the bytes are not an image the server can decode.422{"message": "Images may be at most 25 megapixels (for example 5000 x 5000)."}when the image has more than 25 million pixels.403{"message":"Invalid ability provided."}when the key lacksobjects:schema.