Commit your draft
const url = 'https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft/commit';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"expectedDraftHeadId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0","message":"example","commitRequestId":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft/commit \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "expectedDraftHeadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "message": "example", "commitRequestId": "example" }'Land the caller’s own draft on the branch it targets as one commit, and take the draft away. The commit’s content is the draft head’s and its actions are every change of the chain, oldest first, so its diff and its recorded action types describe the whole of what was staged rather than the last edit.
There is no draftHeadId. A landing takes whatever the draft holds when it reads it, and the delete that ends it is gated on that same head, so a change staged in between is refused with the code draft-moved rather than thrown away: the caller reads the draft again and commits once more, which lands the longer chain.
The message is optional, and a blank one is stored as none. The 201 names the draft head the commit squashed in draftHeadCommitId, so a client can tell whether the landed state is the one it already holds.
A retry whose first attempt landed finds no draft and answers 404. The client then reads the branch, through GET /models/{modelId} or GET /models/{modelId}/delta, and recognises its own work by the commitRequestId it sent, on the head or in the gap if others have committed since. Nothing is stored per request, so this is the whole of the idempotency.
A draft whose baseline is behind the branch head is refused with the gap. Rebasing is a separate, explicit call, because it can refuse staged changes and the caller has to see that before anything lands.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Bodyrequired
Section titled “Request Bodyrequired”What landing a draft takes. The draft head is optional: without it a landing takes whatever the draft holds when it reads it, and the gated delete that ends it is what keeps a change staged in between from being thrown away. With it, a draft at any other head answers draft-moved with nothing written.
object
The draft head the caller last read. The draft is resolved from the caller’s identity, so a retry of a landing whose answer was lost would otherwise land whatever draft that identity holds by then, which may be a new one opened since from another session or an agent. Naming the head keeps the retry to the work it was sent for: a draft at another head is refused with draft-moved, and the caller reads it again and decides.
What the landing commit is called in history. Optional: the action types the commit records already say what changed, as they do for every direct commit, so an author with nothing to add sends none. A blank or whitespace-only message is stored as absent, so history never holds an empty string. The cap holds whatever is sent.
The caller’s own key for this request, stored as the landing commit’s request id and opaque to the server. Never parsed, only compared, which is what lets a caller whose answer was lost recognise its own landing rather than committing the same work twice.
Example generated
{ "expectedDraftHeadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "message": "example", "commitRequestId": "example"}Responses
Section titled “Responses”The chain landed as one commit and the draft is gone
A landed draft: the commit the whole chain became, the branch it landed on, and the draft head the commit squashed. The draft itself is not described, because there is none left.
object
The branch the chain landed on.
The landing commit, in the shape a walked commit is listed in. Its requestId is the commitRequestId that was sent, and its actionTypes are the whole chain’s. It has no message when none, or only whitespace, was sent.
object
Absent on the initial commit.
The author’s description of the change. Absent on a commit made without one. For a staged change it is the message that was sent, absent when it was blank or left out.
The key of the request that produced the commit, absent on a commit made without one. For a staged change it is the changeRequestId that was sent.
The deduped, sorted type values of the commit’s actions. Empty rather than absent on a commit that records none.
Present, and true, on a merge commit whose actionTypes include a dependency or metamodel-pin type for every change it made to the model’s dependencies and metamodel pin. A merge commit names the elements it changed as element actions whatever they are, so one without it says nothing about those: a client has to assume they may have moved. Absent on every other commit, whose actionTypes always tell.
The draft head the commit squashed: everything staged up to and including that change landed. A landing takes whatever the draft holds when it reads it, so a change another session staged a moment before is part of it. A client whose own last acknowledged head is this one already holds the landed state; one whose head is not reads the branch again.
Example generated
{ "refId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "commit": { "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "parentId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "authorId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "message": "example", "requestId": "example", "createdAt": "2026-04-15T12:00:00Z", "actionTypes": [ "example" ], "closureRecorded": true }, "draftHeadCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}The body is missing a required member or is over a length cap
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}The model is theirs to read but not to change. Checked again here, because access can be lost between staging a change and landing it. Or the caller is an agent acting for a person who did not grant it the right to commit, and the draft targets a branch whose name does not start with agent/ (in any case), answered as AgentCommitNotGrantedProblem with nothing written. Every landing by an agent, with or without that grant, is held to the draft head its target was read at, so a draft reopened on another branch in between is refused with the code draft-moved. Or the caller is an agent acting for a person, and the landing on main would reach people outside the organization, answered as AgentPublishNotGrantedProblem with nothing written, whatever else the agent was granted. Or the caller is an agent acting for a person, and the organization that owns the model has not enabled the agent’s AI platform, answered as AgentPlatformNotEnabledProblem. Or the caller is an agent acting for a person who did not grant it the right to commit, and the draft holds a change staged elsewhere, by the person or another agent, answered as AgentChangeNotOwnProblem on any branch, before the target is judged, with nothing written. Or the caller is an agent acting for a person, and the request reaches further than the maximum level the organization that owns the model lets agents reach, answered as AgentLevelNotAllowedProblem with nothing written, whatever the agent was granted.
A Problem answered when an agent acting for a person made a request that reaches further than the maximum level the organization that owns the model lets agents reach, set in the organization’s AI agent platforms setting: staging into a draft or working on a branch where the maximum is read, a merge, a landing on a branch that is not an agent’s own, or taking back or landing another’s staged change where it is propose, and anything that reaches people outside the organization where it is below publish. The person’s grant does not lift it, since a grant spans the person’s organizations and the maximum is each organization’s own; an organization admin can raise it. Nothing was written. A change of the setting applies to new requests within a minute.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not change, and from the refusals a permission the person grants lifts.
A Problem answered when an agent acting for a person reached a model whose owning organization has not enabled the AI platform the agent runs on, which its token names. Model content reaches the platform an agent runs on, so the organization decides: until an organization admin turns the platform on in the organization’s AI agent platforms setting, every route on the model refuses the agent, conditional reads and the events stream included, and the model list and every page that names other models leave the organization’s models out. A change of the setting applies to new requests within a minute; an events stream that is already open ends at its token’s expiry, at most ten minutes later.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not read.
A Problem answered when an agent acting for a person tried to take back or land a staged change it did not stage itself, the person’s or another agent’s, and the person did not grant it the right to commit: an undo of such a change, a rebase that drops one, or a landing of a draft that holds one, on any branch. A change is the agent’s own when its changeRequestId names the agent’s session. Nothing was changed. Such an agent leaves the change to the person, who decides what becomes of it in the app.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not change, and from the refusal of a landing elsewhere, which a branch of the agent’s own avoids.
A Problem answered when an agent acting for a person tried to land work on a shared branch, and the person did not grant it the right to commit: a merge, or a draft landing on a branch whose name does not start with agent/ (in any case). Nothing was written. Such an agent lands its draft on a branch of its own, which a person reviews and merges.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not change.
A Problem answered when an agent acting for a person made a request that reaches people outside the person’s organization, and its token holds no permission to publish: a release; a landing on main that would change whether the model, or its working version, is public; any landing on main of a model whose working version is public; and a landing on main that changes the metadata of a public model. The commit permission does not cover these; the person grants publishing as a permission of its own, and the organization that owns the model has to let agents reach that far too. Nothing was written. Without the permission an agent commits on a branch of its own, which a person reviews and merges.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 403 from the plain one the same routes answer for a model the caller may not change, and from the refusal of a commit, which another permission lifts.
A Problem answered when an organization feature the request needs is not open to the caller on this resource. A 403, as an access refusal is, and told apart from one by its type: a caller refused a feature can still read the resource, and only loses what the feature offers. feature says which: on a draft route it is a feature an action inside the staged change needs, such as alignment for an ALIGNMENT_CREATE, and only that change is refused.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 403 from an access refusal.
The organization feature the caller lacks, spelled as it is on the organization, such as alignment or catalog. Where any of several features would admit the caller, the first of them is named.
The organization the refusal was judged against. Absent for a resource no organization owns (one a user owns, or one nobody owns), which no organization feature can open: the refusal then names no one.
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example
{ "type": "https://modeldesk.io/problems/agent-level-not-allowed"}The model does not exist, answered with the plain problem, or the caller holds no draft on it, answered as RefNotFoundProblem: to a client that is the news a read at a gone ref brings, that the draft it was working in, perhaps committed or discarded in another session, is no longer there. A retried commit whose first attempt landed meets this same answer, and finds its commitRequestId on the branch.
A Problem answered when a ref the request reads at is not there for the caller, on a resource they may read: a ref id that names nothing, a ref of another resource, and another user’s draft, which reads exactly as a ref that does not exist. The draft routes answer it too when the caller holds no draft.
A 404, as a missing resource is, and told apart from one by its type. A resource the caller cannot read keeps the plain answer it always had, whatever ref was named, so this one never says anything about a resource the caller could not see. To a client it means that the ref it was reading, typically a draft committed or discarded in another session, is gone while the resource stays: it goes back to the branch. The problem names no ref, so the answer for an id that names nothing and for another user’s draft is the same, byte for byte.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 404 from a resource that is missing or not the caller’s to read.
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example
{ "type": "https://modeldesk.io/problems/ref-not-found"}One of four, each told apart by type. The branch has advanced past the commit the draft is based on, in which case the problem carries the gap and the remedy is a rebase; the draft moved between the read this landing was built from and the delete that would have ended it, carrying the code draft-moved; or the draft has nothing staged to land, carrying the code nothing-to-commit.
The gap is walked once the refused transaction has rolled back, so where there is no longer a draft to walk it from, because it was discarded while the landing was being refused, the BranchHeadConflictProblem travels instead: the same conflict, under its own type, and no gap. None of the four writes anything.
A Problem that additionally carries the gap, answered when the draftHeadId a change or an undo was written against is no longer the draft’s head. Listing what landed in between is what makes a retry safe: a caller that finds its own changeRequestId in commits knows its change was applied and does not send it twice.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 409 from the other.
object
The head the caller sent, which is no longer the current one.
The head as it now stands. Absent when the follow-up read that fills it did not succeed.
Whether the head the caller sent is still on the chain below the current one. False when an undo popped it, a rebase rewrote the chain, or a commit closed the draft. A client that reads false reseeds instead of replaying.
The chain from the current head down to the head the caller sent, exclusive, newest first. Absent when ancestor is false, because there is then no gap to list.
A commit as a walk over history lists it: its identity, its provenance and the kinds of action it holds, without the actions themselves.
object
Absent on the initial commit.
The author’s description of the change. Absent on a commit made without one. For a staged change it is the message that was sent, absent when it was blank or left out.
The key of the request that produced the commit, absent on a commit made without one. For a staged change it is the changeRequestId that was sent.
The deduped, sorted type values of the commit’s actions. Empty rather than absent on a commit that records none.
Present, and true, on a merge commit whose actionTypes include a dependency or metamodel-pin type for every change it made to the model’s dependencies and metamodel pin. A merge commit names the elements it changed as element actions whatever they are, so one without it says nothing about those: a client has to assume they may have moved. Absent on every other commit, whose actionTypes always tell.
A Problem answered when a change was staged between the read a landing was built from and the delete that would have ended the draft. Nothing was written, and nothing was lost: the draft still holds everything, the new change included. The caller reads it again and commits once more, which lands the longer chain.
A head-gated discard answers it when the draft moved past draftHeadId, and a handoff when the draft moved between the read of it and the write of the handoff; neither deletes or stores anything, and the caller reads the draft again and asks once more.
Distinct from DraftHeadConflictProblem, which reports being behind the branch and carries the commits to catch up on. Here there is nothing to catch up on, so there is no gap.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 409 from the other two the same route answers with.
Stable constant a client branches on, beside the problem’s own type.
The draft that moved: the caller’s own draft ref, never the branch it targets. It is the id of the Draft this request was built from.
The head the request was built from (the landing’s, the discard’s draftHeadId or the head the handoff read), which is no longer the draft’s.
A Problem answered when a commit is asked for on a draft whose head is still the baseline it was started from. A conflict rather than bad input: the request is well formed and names a draft that really exists, and what refuses it is the state that draft is in. The draft is left exactly where it was, so staging a change and asking again lands it.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 409 from the other two the same route answers with.
Stable constant a client branches on, beside the problem’s own type.
The draft that was asked to commit: the caller’s own draft ref, never the branch it targets. It is the id of the Draft that staged nothing.
The draft’s head, which on a draft that staged nothing is also its baseline.
A Problem answered when a gated write lost its compare-and-set: the head the write was written against was no longer the ref’s head when the write reached it, so nothing was written. It names the ref and the two heads, and carries no gap.
It stands in for DraftHeadConflictProblem where the gap cannot be walked: a landing whose draft was discarded while the refusal was being built, and a rebase whose swap lost to a change staged while the replay was running. On a rebase the conflict.branchId is the draft’s own ref id rather than the branch it targets, because the ref that moved is the draft.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Stable constant a client branches on, which is what tells this 409 from the others the same routes answer with.
Always the sentence Branch HEAD has advanced since this commit's baseline., whichever ref moved. What a human reads, never parsed.
object
The ref whose head the write was gated on.
The head the write was written against, which is no longer the current one.
The head as it now stands. Absent when the follow-up read that fills it found no ref, which is what a discarded draft leaves behind.
Example
{ "type": "https://modeldesk.io/problems/draft-head-conflict"}default
Section titled “default”Error
An RFC 9457 problem document, always sent as application/problem+json.
object
Present only on a typed refusal, whose own schema requires it and fixes its value. An untyped problem omits it, which RFC 9457 defines as about:blank: the status and title are all there is to branch on.
The path of the request that was refused. Absent when the request was refused before it reached the application’s handlers: a 401 for a missing or unusable access token, and a 403 for a service account whose scopes do not reach the route.
Present on a 400 raised by request-body validation, and on a 422 that refuses named fields (a malformed slug or namespace prefix). Each entry names the rejected property, so a client can attach the message to the field that caused it rather than showing one error for the whole form.
object
Example generated
{ "type": "https://example.com", "title": "example", "status": 1, "detail": "example", "instance": "example", "violations": [ { "property": "example", "message": "example" } ]}