Deploy a schema authored as files
Replaces the project's schema with the one in the body (what `cairn schema deploy` sends). Fields are matched to the published schema by name, or by a `renamedFrom` hint for a rename, and existing documents are migrated before the new schema goes live. Requires a credential with settings access.
POST/projects/{projectSlug}/schema/deployRequires an active preview session — either the cairn_preview cookie set by createPreviewHandler, or a preview session token sent as Authorization: Bearer <token>.
Path parameters
projectSlug* | string | The project's slug |
Request body
documentTypes* | array | |
blockTypes | array | |
structure | array | Nav structure; omit for one flat link per document type |
dryRun | boolean | Report changes and impact without deploying |
allowDataLoss | boolean | Deploy even if stored values would be dropped or documents orphaned |
Responses
| 200 | Deployed, unchanged, or (with `dryRun`) the report of what would change |
| 202 | Accepted - documents are being migrated in the background; the new schema goes live when that finishes |
| 400 | The schema is invalid |
| 401 | Authentication required |
| 403 | Origin not allowed, or not a member of this project |
| 404 | Unknown project |
| 409 | The change would lose data - retry with `allowDataLoss` after reviewing `impact` |
| 423 | A previous deploy is still migrating documents |
Request
curl -X POST "https://api.cairn.press/projects/my-project/schema/deploy" \
-H "Authorization: Bearer $CAIRN_PREVIEW_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documentTypes":[{}]}'Response · 200
{
"status": "unchanged",
"changes": {},
"impact": {},
"warnings": [
"string"
]
}