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.

Your GraphQL schema can be fetched and updated using the /admin endpoint of your cluster. As an example, if your GraphQL endpoint is https://frozen-mango.us-west-2.aws.cloud.dgraph.io/graphql, then the admin endpoint for schema is at https://frozen-mango.us-west-2.aws.cloud.dgraph.io/admin.

This endpoint works in a similar way to the /admin endpoint of Dgraph, with the additional constraint of requiring authentication.

Fetching the current schema

It is possible to fetch your current schema using the getGQLSchema query on /admin. Below is a sample GraphQL query which fetches this schema.

{
  getGQLSchema {
    schema
  }
}

Setting a new schema

You can save a new schema using the updateGQLSchema mutation on /admin. Below is an example GraphQL body, with a variable called sch which must be passed in as a variable

mutation ($sch: String!) {
  updateGQLSchema(input: { set: { schema: $sch } }) {
    gqlSchema {
      schema
      generatedSchema
    }
  }
}