Compare two branches
const url = 'https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/diff';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://api.modeldesk.io/models/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/branches/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/diff \ --header 'Authorization: Bearer <token>'What this branch changed since it diverged from base: the net element-level difference between their merge base and this branch’s head, in the shape a draft’s diff takes. commitId is this branch’s head and parentCommitId the merge base. This is what merging this branch into base would bring, before conflicts are taken into account. Comparing a branch with itself answers a diff with no elements. Open to every reader of the model.
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”The branch whose changes are listed.
Query Parameters
Section titled “Query Parameters”The branch to compare against. When omitted, the model’s main branch.
Responses
Section titled “Responses”OK
object
Null for initial commits.
object
Element name resolved at commit time.
Changed attributes only.
object
object
Attribute values before the change. Null for ADDED elements.
Attribute values after the change. Null for REMOVED elements.
Changed relations only.
object
One relation that differs between the two states. before and after carry the relation whole, so a reader can show the targets it kept beside the ones it gained or lost, and a relation whose targets were only reordered differs in them alone. An empty list is omitted: an ADDED element’s relation carries no before, a REMOVED element’s no after.
object
Element IDs of the relation’s targets before the change, in order.
Element IDs of the relation’s targets after the change, in order.
Element IDs of newly added relation targets.
Element IDs of removed relation targets.
Display label by element ID for every element the diff names: each entry, every target a changed relation holds before or after the change, and the elements its diagram actions name. An element neither state nor the current model holds is left out.
object
Example
{ "elements": [ { "diffType": "ADDED" } ]}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.
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.
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-platform-not-enabled"}The model does not exist, answered with the plain problem, or branchId or base names no branch of it, answered as RefNotFoundProblem. A draft is not a branch, so naming one reads as naming nothing.
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"}The two heads have several closest common ancestors, after a criss-cross merge, so there is no base to count the branch’s changes against. The problem names them; a merge of the two branches is refused the same way.
A Problem answered when the two heads have several closest common ancestors, as they do after a criss-cross merge: each branch was merged into the other from a head that did not yet hold the other merge. There is then no single base to compare or merge over, and a merge over any one of them can undo, without a conflict, a deletion the other side made since. Nothing was written. A merge of the same two branches, in either direction, answers the same; one history has to be made to contain the other first, by creating one branch again from the other’s head.
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 merge and compare routes answer with.
The common ancestors no other common ancestor descends from, in id order: the two pre-merge heads of a criss-cross.
Example
{ "type": "https://modeldesk.io/problems/ambiguous-merge-base"}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" } ]}