Search Modaic documentation

Find a Modaic guide or API reference

Reference›API›models

Update model

Update model metadata or commit a new model.json configuration. Repository write access is required.

PATCH/v1/models/{modelId}

Authorization

Authorizationstringrequired

Send a Modaic bearer token in the Authorization header.

Parameters

modelIdUUIDrequired

Model repository ID.

branchstring

Branch to update. Defaults to the model's default branch.

descriptionstring | null

Replace or clear the repository description. Requires repository admin access.

modelstring

Root model used for decisions.

questionsRecord<string, Question>

Replace the model's typed questions. Question shapes match POST /v1/systemone.

messagestring

Commit message, up to 500 characters, for a configuration change.

expectedHeadShastring

Optimistic concurrency. The branch head you last read: commit.commitSha from Get model or a previous update. If the branch has since advanced, the update is refused with 409 expected_head_mismatch and details.currentHeadSha, so a stale client cannot overwrite newer commits. Applies to updates that carry model or questions; a description-only update is metadata, not a commit, and is not checked. Omitted, the update is permissive.

discardAlignmentboolean

Required to replace questions that alignment wrote. Once a model has an alignment checkpoint, questions that differ from the stored ones are refused with 409 alignment_would_be_discarded unless this is true.

At least one of description, model, or questions is required; an empty update returns 422 model_update_empty. Updating model or questions resets the checkpoint to 0 and clears prior evaluation metrics, while preserving the confidence threshold and capture policy.

Alignment writes its optimized instructions into the same questions field. A setup script that re-pushes the schema as authored would therefore revert an aligned model to checkpoint 0. To prevent that, once the model has a checkpoint this endpoint refuses questions that differ from the stored ones with 409 alignment_would_be_discarded; its details carry the branch, commitSha, and checkpoint. Omit questions to keep the aligned instructions, or send discardAlignment: true to replace them deliberately. Read the stored configuration first if you want to compare.

Response

idUUIDrequired
workspaceEntityrequired
slugstringrequired
descriptionstring | nullrequired
defaultBranchstringrequired
visibilityprivaterequired
createdAtISO 8601 datetimerequired
updatedAtISO 8601 datetimerequired
configurationModelConfiguration

The current schemaVersion, root model, checkpoint, questions, and any saved metrics or capture policy.

commitobject

Present when model or questions was supplied. Includes commitSha, branch, and previousSha. For a no-op, commitSha equals previousSha and both are the current head.

unchangedboolean

true when the supplied model and questions already match the stored configuration. Nothing is committed, the checkpoint and metrics are left as they are, and configuration is the stored one. Aliases and key order are ignored in the comparison.

A missing model or branch returns 404. The endpoint returns 409 expected_head_mismatch when the branch is not at expectedHeadSha, 409 when the branch advances while the update is being committed, and 409 alignment_would_be_discarded when questions would overwrite an alignment checkpoint without discardAlignment: true. An overwritten version can be restored with Roll back a branch.

Was this page helpful?