Search Modaic documentation

Find a Modaic guide or API reference

Reference›API›Models

Roll back a branch

Restore a branch to the state of an earlier commit. The rollback is itself a new commit whose files are the target's, so model.json comes back with the checkpoint, questions, and metrics it had at that commit, and gepa.json returns if the target had one. History is preserved; nothing is rewritten. Repository write access is required.

POST/v1/models/{workspace}/{model}/rollbacks

Authorization

Authorizationstringrequired

Send a Modaic bearer token in the Authorization header.

Path Parameters

workspacestringrequired

User or organization workspace slug.

modelstringrequired

Model repository slug. The caller needs the route-specific repository access.

Body

branchstringrequired

Branch to move.

targetCommitShastringrequired

Commit whose files become the branch head again. Find it with List commits or from an optimization job's resultCommitSha.

expectedHeadShastringrequired

The branch's current head. If it has moved, the request fails with 409 expected_head_mismatch and nothing changes.

messagestring

Commit message for the rollback.

Response

commitShastringrequired

The new head.

branchstringrequired
previousShastringrequired

The head before the rollback.

This is how to recover an optimization run that a later update overwrote: list the commits, find the run's commit, and roll the branch back to it. New decisions then record the restored checkpoint again.

Was this page helpful?