We’re overhauling Dgraph’s docs to make them clearer and more approachable. If you notice any issues during this transition or have suggestions, please let us know.

You can retrieve the Dgraph schema containing the list of predicates types and node types by:

When using a query, the request body is

schema {}

Unlike regular queries, the schema query isn’t surrounded by curly braces. Also, schema queries and regular queries can’t be combined.

You can query for particular schema fields in the query body.

schema {
  type
  index
  reverse
  tokenizer
  list
  count
  upsert
  lang
}

You can also query for particular predicates:

schema(pred: [name, friend]) {
  type
  index
  reverse
  tokenizer
  list
  count
  upsert
  lang
}

If Access Control Lists (ACL) is enabled, then the schema query returns only the predicates for which the logged-in ACL user has read access.

Types can also be queried. Below are some example queries.

schema(type: Movie) {}
schema(type: [Person, Animal]) {}

Note that type queries don’t contain anything between the curly braces. The output is the entire definition of the requested types.