Skip to content

List branches

GET
/models/{modelId}/branches
curl --request GET \
--url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches \
--header 'Authorization: Bearer <token>'

List the model’s branches: main first, then the others in the order they were created, each with the commit it points at. Drafts are never listed, and neither are the branches the mapping generator keeps for itself. Open to every reader of the model.

modelId
required
string format: uuid

OK

Media typeapplication/json
Array<object>

One branch of a model: its name, when it was created, whether it is the model’s main branch, the commit it points at and who made that commit, how many drafts target it and how many of its commits main does not reach.

object
id
required

The branch’s ref id, which is what ?ref= takes on the read routes and branchId on a staged change.

string format: uuid
name
required

The name the branch was created with. A branch is never renamed.

string
createdAt
required
string format: date-time
main
required

True for the model’s main branch only: the one every read without a ref reads, the one releases are cut from, and the one that cannot be deleted.

boolean
head
required

The commit the branch points at, in the shape a walked commit is listed in.

object
id
required
string format: uuid
parentId

Absent on the initial commit.

string format: uuid
authorId
required
string format: uuid
message

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.

string
requestId

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.

string
createdAt
required
string format: date-time
actionTypes
required

The deduped, sorted type values of the commit’s actions. Empty rather than absent on a commit that records none.

Array<string>
closureRecorded

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.

boolean
headAuthor
required

Who made the head commit, named as the commit log names the author of the same commit in createdBy: a person by the name on their account, a service account by the name it had when it committed, and the platform (SYSTEM) without a name.

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

How many drafts target the branch, whoever owns them. Deleting the branch deletes every one of them, so a client can say how many go before it asks.

integer
unmergedCommitCount
required

How many commits on the branch main does not reach, every parent of a merge followed. Zero for main and for a branch main has merged. Deleting the branch leaves them to garbage collection and is refused without force while there are any, so a client can say how many go before it asks.

integer

Example

[
{
"headAuthor": {
"type": "USER"
}
}
]

The model is not the caller’s to read. 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.

Media typeapplication/problem+json
Any of:

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
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 the plain one the same routes answer for a model the caller may not read.

string format: uri
Allowed values: https://modeldesk.io/problems/agent-platform-not-enabled

Example

{
"type": "https://modeldesk.io/problems/agent-platform-not-enabled"
}

The model does not exist

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"
}
]
}

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"
}
]
}