Skip to content

Describe the schema governing a model

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

The schema a model is written against, resolved by the server: the answers a client needs to know what may be created and linked where, computed by the same metamodel queries that judge whether a write is valid, so a client never reimplements them. Without type, the overview: the model root’s slots and a summary of every classifier (element types and traits). With type, that classifier described in full: every binding it carries, own and inherited, with the classifier that introduces it; each attribute’s value schema and multiplicity; each relation’s multiplicity, ownership and resolved targets; where an element of the type can live (homeSlots) and what can be created inside one (childSlots); and, for an abstract classifier heading a discriminated branch, the kind groups that tell its kinds apart. On a metamodel model the answers describe the meta-metamodel. The metamodel is resolved at main, or at the branch or draft ref names: the resolution folds in the metamodels of the model’s dependencies, and a dependency staged in a draft or committed on a branch changes the schema there. Authorized exactly like the resolved-metamodel read: everything here derives from what the caller can already read. A public document, frozen once released: members are added, never renamed or retyped. The response carries an ETag of the ref’s head commit (main’s without ref) and the server’s read format ("<head>.<format>"), so a conditional request with If-None-Match is answered 304 while both are unchanged, after the same read check as the read itself: a caller who may not read the model or the ref gets the refusal, never a 304. A tag is valid only for the exact request URI it came with, query included: the overview and each type carry the same tag over different bodies. Both the 200 and the 304 carry Cache-Control: no-store.

modelId
required
string format: uuid
type
string

The classifier to describe, by its canonical name (sh:NodeShape) or by any spelling that names exactly one classifier (NodeShape, where no other type is spelled so).

ref
string format: uuid

The ref to resolve the metamodel at, a model_branch document id, read as GET /models/{modelId}?ref= reads it: a draft is its owner’s alone. When omitted, the model’s main branch is read.

If-None-Match
string

The ETag of the copy the caller holds, from a read of this exact URI.

OK

Media typeapplication/json

The schema governing a model, as the server resolves it. Without type in the request it carries root and types; with one it carries type. Types are named by their canonical names, the names a model element’s type carries. Lists are ordered for a stable document: names sort, and bindings follow the type’s form order.

object
modelId
required
string format: uuid
metamodel
required

The metamodel a described model is written in.

object
id
required
string format: uuid
name
required
string
version

The version of the standard the metamodel expresses, where it states one.

string
prefix

The prefix qualifying the metamodel’s own declarations, where it declares one.

string
root

The overview’s slots at the model root, one per type the root admits.

Array<object>

A type the model root admits directly.

object
type
required
string
label
required
string
multiplicity
required
object
min
integer
max
integer
severity

How seriously the metamodel takes a count outside the bounds: the level of the finding it produces. Absent reads as violation.

string
Allowed values: violation warning info
instantiableTypes

The instantiable types the binding admits, by name.

Array<string>
types

The overview’s summary of every classifier, element types and traits alike, by name.

Array<object>

One classifier in the overview.

object
name
required
string
label
required
string
abstract
required

Whether no element can have this type, only one of its subtypes.

boolean
package
required
boolean
trait
required

Whether this is a trait, a classifier types apply rather than one an element has.

boolean
internal
required

Whether this is framework plumbing (an @ type) or an auxiliary type no authoring reaches from the model root, such as a mapping rule.

boolean
specializes

The classifiers it directly extends.

Array<string>
traits

The traits it directly applies.

Array<string>
type

One classifier described in full: every binding it carries, own and inherited, what each admits, where an element of it can live and what can be created inside one.

object
name
required
string
label
required
string
definition
string
abstract
required
boolean
package
required
boolean
trait
required
boolean
internal
required
boolean
specializes

The classifiers it directly extends.

Array<string>
supertypes

Every supertype, nearest first. For a trait, every trait it extends, directly or through another.

Array<string>
traits

The traits it directly applies.

Array<string>
keyProperties

The properties a reference to an element of this type resolves through.

Array<string>
instantiableTypes

The types an element standing for this classifier can have: itself unless it is abstract, and its instantiable subtypes; for a trait, the types applying it.

Array<string>
attributes
Array<object>
object
name
required

The property’s canonical name, the key its values are stored under.

string
label
required
string
definedBy

The classifier that introduces the property into the hierarchy.

string
multiplicity
required
object
min
integer
max
integer
severity

How seriously the metamodel takes a count outside the bounds: the level of the finding it produces. Absent reads as violation.

string
Allowed values: violation warning info
schema

The values an attribute holds, in the manner of JSON Schema.

One of: discriminator: type
any

Admits any value.

object
type
required
string
Allowed value: any
derived
required

Whether the value is computed on read, so it is never written.

boolean
relations
Array<object>

A relation binding. One of four things is said about its targets: allowedTargetTypes lists them; parentBound says they are relative to the holder’s owner; unrestricted says nothing is declared, so any element type is admitted; or, with no allowedTargetTypes and both flags false, the relation declares targets none of which has an instantiable type, so nothing can be pointed at.

object
name
required

The property’s canonical name, the key its targets are stored under.

string
label
required
string
definedBy

The classifier that introduces the property into the hierarchy.

string
multiplicity
required
object
min
integer
max
integer
severity

How seriously the metamodel takes a count outside the bounds: the level of the finding it produces. Absent reads as violation.

string
Allowed values: violation warning info
ownership
required
string
Allowed values: OWNED UNOWNED MIXED MULTI_OWNED
allowedTargetTypes

The types a target may have: the instantiable types of this metamodel the declared classifiers expand to (an abstract classifier through its instantiable subtypes, a trait through the types applying it), or another metamodel’s types as declared, flagged foreign.

Array<object>
object
name
required

The type’s canonical name, or the name as declared for a foreign type.

string
label
required
string
foreign
required

Whether the type belongs to another metamodel: it is never created here, and resolves only against a model of that metamodel.

boolean
metamodelId

The metamodel a foreign type belongs to.

string
parentBound
required

Whether the target type is the type of the holder’s owner ($parent), which names no type until there is an element to ask.

boolean
unrestricted
required

Whether nothing is declared, so any element type is admitted.

boolean
derived
required

Whether the relation is computed on read, so it is never written.

boolean
abstract
required

Whether the relation is a facade over concrete sub-relations, which are the ones written.

boolean
homeSlots

Every place an element of this type can live. The model root is spelled @Root / @element. Always empty on an abstract type or a trait: no element has either as its own type, so their homes are listed on the instantiable types under them.

Array<object>
object
ownerType
required
string
relation
required
string
childSlots

Every place an element of this type holds children: its OWNED and MULTI_OWNED relations, each with the types an element created there may have. The inverse of homeSlots for every relation without a foreign target. A const-valued, abstract, foreign or $parent-bound relation creates nothing and is not listed; a MIXED relation holds references each owned or not, and is not a child slot either. Always absent on a trait: no element has a trait as its type, so the slots a trait contributes are listed on the types applying it, while relations lists what it contributes.

Array<object>
object
relation
required
string
targetTypes
required
Array<string>
kindGroups

Present on an abstract classifier heading a discriminated branch, one whose instantiable kinds are told apart by what is filled in rather than by name (OWL’s class expressions, for example): the divisions of the branch, and which bindings tell each group’s kinds apart.

Array<object>

One division of a discriminated branch: the kinds sharing a classifier, and which bindings tell them apart. Each kind is described in full by a type read of its own.

object
classifier
required

The classifier naming the group.

string
kinds
required
Array<string>
shared

The bindings every kind in the group carries.

Array<string>
distinguishing

The bindings only some kinds carry, each with the kinds carrying it.

Array<object>
object
binding
required
string
kinds
required
Array<string>

Example

{
"root": [
{
"multiplicity": {
"severity": "violation"
}
}
],
"type": {
"attributes": [
{
"multiplicity": {
"severity": "violation"
},
"schema": {
"type": "any"
}
}
],
"relations": [
{
"multiplicity": {
"severity": "violation"
},
"ownership": "OWNED"
}
]
}
}
ETag
string

"<head>.<format>": the head commit of the ref the description was resolved at (main’s without ref) and the server’s read format.

Cache-Control
string

no-store: no cache may keep the body.

If-None-Match names the current tag and the caller may read the model at the ref. Carries the same ETag and Cache-Control: no-store.

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. Any other refusal is answered with the plain problem.

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 or the caller may not read it (a plain problem), ref is not a ref of the model the caller may read (a ref-not-found problem), or the metamodel declares no classifier named type (a type-not-found problem naming it, with the canonical names to choose between where the spelling names more than one).

Media typeapplication/problem+json
Any of:

A Problem answered when a schema read names a type the model’s metamodel does not declare, or a spelling more than one of its classifiers shares.

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/type-not-found
typeName
required

The name as asked.

string
candidates

For a spelling more than one classifier shares, their canonical names, to retry with one of them.

Array<string>

Example

{
"type": "https://modeldesk.io/problems/type-not-found"
}

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