Skip to content

Commit your dataset draft

POST
/datasets/{datasetId}/draft/commit
curl --request POST \
--url https://api.modeldesk.io/datasets/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 branch’s rows take the revisions and the verdicts the draft holds; nothing is re-judged and nothing is copied. The commit carries the caller’s message, if they sent one that is not blank, and, as its requestId, the caller’s commitRequestId. The 201 names the draft head the commit squashed in draftHeadCommitId.

There is no head to send: a landing takes whatever the draft holds when it runs. A retried landing whose first attempt succeeded finds no draft and is answered 404; the client then reads the branch’s history and finds its commitRequestId on the head.

datasetId
required
string format: uuid
Media typeapplication/json

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
expectedDraftHeadId

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.

string format: uuid
message

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.

string
<= 2000 characters
commitRequestId
required

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.

string
>= 1 characters <= 200 characters

Example generated

{
"expectedDraftHeadId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0",
"message": "example",
"commitRequestId": "example"
}

The draft landed as one commit

Media typeapplication/json

The commit a landed dataset draft became, the branch it landed on, and the draft head the commit squashed.

object
refId
required
string format: uuid
commit
required

One commit of a dataset’s history. What a commit points at stays opaque; how many rows it touched is what a reader wants from it. This is the shape every route but the history reads carries (a landing’s answer, a stale head’s gap, a rebase’s dropped changes); the listing adds the size of a landing’s record (DatasetCommitLogView) and the single read the record itself (DatasetCommitRecordView).

object
id
required
string format: uuid
datasetId
required
string format: uuid
parentIds

None for the first commit, one for an ordinary one, two for a merge.

Array<string>
createdAt
string format: date-time
createdBy
object
id
required
string format: uuid
type
required

USER is a person, MACHINE a service account, and SYSTEM the platform itself, whose commits (metamodel seeding and re-pins) the commit log hides unless asked for them.

string
Allowed values: USER ORGANIZATION SYSTEM MACHINE
name

The display name, where one is known: a person’s from their account, a service account’s as stored with what it wrote. Left out for the platform and for a person whose account holds no name.

string
message

What the commit records about the change. Absent on a staged change sent without one.

string
requestId
string
rowsChanged

How many rows the commit wrote or removed. For a change staged on a draft, listed in a stale head’s gap or among a rebase’s dropped changes, the rows that one change touched.

integer
draftHeadCommitId
required

The draft head the commit squashed, as a model’s landing names it: a client whose own last acknowledged head is this one already holds the landed state.

string format: uuid

Example

{
"commit": {
"createdBy": {
"type": "USER"
}
}
}

The landing would take the dataset past its row cap, or commitRequestId already names a commit of the dataset.

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}

The dataset is theirs to read but not to change. Checked again here, because access can be lost between staging a change and landing it.

Media typeapplication/problem+json
Any of:

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
type
required

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string
type
required

Stable constant a client branches on, which is what tells this 403 from an access refusal.

string format: uri
Allowed values: https://modeldesk.io/problems/feature-not-enabled
feature
required

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.

string
organizationId

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.

string format: uuid

Example

{
"type": "https://modeldesk.io/problems/feature-not-enabled",
"feature": "alignment"
}

The dataset 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.

Media typeapplication/problem+json
Any of:

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
type
required

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string
type
required

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.

string format: uri
Allowed values: https://modeldesk.io/problems/ref-not-found

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 — what the branch gained since the draft’s baseline — 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.

Media typeapplication/problem+json
One of:

A Problem that additionally carries the gap, answered when the draftHeadId a dataset draft write was written against is no longer the current head, and when a landing finds the branch moved past the draft’s baseline. It is the model’s DraftHeadConflictProblem with the gap in the dataset’s own words: each commit as the dataset’s history lists one, counting the rows its own change touched.

object
type
required

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string
type
required
string format: uri
Allowed values: https://modeldesk.io/problems/draft-head-conflict
conflict
required
object
branchId
required

The ref the head belongs to: the caller’s draft, or the branch it targets while there is none and when a landing is refused.

string format: uuid
baselineCommitId
required

The head the caller sent, which is no longer the current one; for a refused landing, the baseline the draft is still based on.

string format: uuid
currentHeadCommitId

The head as it now stands.

string format: uuid
ancestor
required

Whether the head the caller sent is still on the chain below the current one. False when an undo popped it or a rebase rewrote the chain; a client that reads false re-reads the draft.

boolean
commits

The chain from the current head down to the head the caller sent, exclusive, newest first. Absent when ancestor is false.

Array<object>

One commit of a dataset’s history. What a commit points at stays opaque; how many rows it touched is what a reader wants from it. This is the shape every route but the history reads carries (a landing’s answer, a stale head’s gap, a rebase’s dropped changes); the listing adds the size of a landing’s record (DatasetCommitLogView) and the single read the record itself (DatasetCommitRecordView).

object
id
required
string format: uuid
datasetId
required
string format: uuid
parentIds

None for the first commit, one for an ordinary one, two for a merge.

Array<string>
createdAt
string format: date-time
createdBy
object
id
required
string format: uuid
type
required

USER is a person, MACHINE a service account, and SYSTEM the platform itself, whose commits (metamodel seeding and re-pins) the commit log hides unless asked for them.

string
Allowed values: USER ORGANIZATION SYSTEM MACHINE
name

The display name, where one is known: a person’s from their account, a service account’s as stored with what it wrote. Left out for the platform and for a person whose account holds no name.

string
message

What the commit records about the change. Absent on a staged change sent without one.

string
requestId
string
rowsChanged

How many rows the commit wrote or removed. For a change staged on a draft, listed in a stale head’s gap or among a rebase’s dropped changes, the rows that one change touched.

integer

Example

{
"type": "https://modeldesk.io/problems/draft-head-conflict",
"commits": [
{
"createdBy": {
"type": "USER"
}
}
]
}

Error

Media typeapplication/problem+json

An RFC 9457 problem document, always sent as application/problem+json.

object
type

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.

string format: uri
title
required
string
status
required
integer
detail
required
string
instance

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.

string
violations

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.

Array<object>
object
property
required
string
message
required
string

Example generated

{
"type": "https://example.com",
"title": "example",
"status": 1,
"detail": "example",
"instance": "example",
"violations": [
{
"property": "example",
"message": "example"
}
]
}