Open a dataset draft
const url = 'https://api.modeldesk.io/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"branchId":"2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}'};
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/datasets/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/draft \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "branchId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0" }'Open the caller’s draft on a branch of the dataset, or return the one they already have. Answers 201 when this call created it and 200 when it was already open on that same branch. A caller holds one draft per dataset: a request naming another branch while a draft is open is refused with 400, and so is a branchId that is not a branch of this dataset. Creating a draft copies no rows — a draft is an overlay on the branch it targets, so it costs one document whatever the dataset holds.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Request Body
Section titled “Request Body”object
The branch to draft on. Omitted, as the whole body may be, means main.
Example generated
{ "branchId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0"}Responses
Section titled “Responses”The draft was already open on this branch
One user’s private staging ref on a branch of the model. updatedAt is derived rather than stored: the newer of the draft’s creation and its head commit, so it moves with every staged change.
object
The draft’s ref id, which is also what ?ref= takes on the read routes.
The branch the draft lands on.
The target branch’s head the draft started from.
The draft’s own head, equal to the baseline while nothing is staged.
How many changes are staged: the length of the draft’s chain from its head down to its baseline. Computed per read rather than stored, and 0 on a draft nothing has been staged into. A change is the undo grain, so five edits to one element count as five.
For a dataset draft that moves the dataset to another release of its base, that release’s name; the dataset is pinned to it once the draft lands.
A draft’s most recent handoff for review, set by POST /models/{modelId}/draft/handoff. Absent on a draft never handed off. Neither a commit nor a staged change: it goes with the draft when the draft is committed or discarded, and a staged change, an undo or a rebase leaves it in place.
object
The author’s own words about the draft. Written by whoever handed it off, often an agent, so a client renders it as plain text and never as markup.
The draft head when it was handed off. A headCommitId on the draft other than this one means the draft changed after the handoff.
When the draft was handed off.
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "targetRefId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "baselineCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "headCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "changeCount": 1, "createdAt": "2026-04-15T12:00:00Z", "updatedAt": "2026-04-15T12:00:00Z", "movesBaseTo": "example", "handoff": { "summary": "example", "headCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "at": "2026-04-15T12:00:00Z" }}Created
One user’s private staging ref on a branch of the model. updatedAt is derived rather than stored: the newer of the draft’s creation and its head commit, so it moves with every staged change.
object
The draft’s ref id, which is also what ?ref= takes on the read routes.
The branch the draft lands on.
The target branch’s head the draft started from.
The draft’s own head, equal to the baseline while nothing is staged.
How many changes are staged: the length of the draft’s chain from its head down to its baseline. Computed per read rather than stored, and 0 on a draft nothing has been staged into. A change is the undo grain, so five edits to one element count as five.
For a dataset draft that moves the dataset to another release of its base, that release’s name; the dataset is pinned to it once the draft lands.
A draft’s most recent handoff for review, set by POST /models/{modelId}/draft/handoff. Absent on a draft never handed off. Neither a commit nor a staged change: it goes with the draft when the draft is committed or discarded, and a staged change, an undo or a rebase leaves it in place.
object
The author’s own words about the draft. Written by whoever handed it off, often an agent, so a client renders it as plain text and never as markup.
The draft head when it was handed off. A headCommitId on the draft other than this one means the draft changed after the handoff.
When the draft was handed off.
Example generated
{ "id": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "targetRefId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "baselineCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "headCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "changeCount": 1, "createdAt": "2026-04-15T12:00:00Z", "updatedAt": "2026-04-15T12:00:00Z", "movesBaseTo": "example", "handoff": { "summary": "example", "headCommitId": "2489E9AD-2EE2-8E00-8EC9-32D5F69181C0", "at": "2026-04-15T12:00:00Z" }}The branchId is not a branch of this dataset, or a draft is already open on another branch. The second is DraftTargetTakenProblem, carrying targetRefId, the ref that blocks this one, so a client can offer to open or finish that one instead.
A Problem answered when a draft was refused because one is already open on another branch: opening a draft, or staging a change whose branchId names a branch other than the one the open draft targets. It names the branch that blocks the request. A branchId that is not a branch of this model is a different refusal, answered without saying anything about the id that was named.
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 400 from the plain one the same routes answer for a body or a target they cannot accept.
The ref the caller’s open draft targets, which blocks this request.
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/draft-target-taken"}The dataset is theirs to read but not to change.
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" } ]}Not found
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" } ]}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" } ]}