You are looking at the docs for the unreleased master branch of Dgraph. The latest version is v20.07.
Report Issue Edit Page

Dropping Data from your Backend

It is possible to drop all data from your Slash GraphQL backend, and start afresh while retaining the same endpoint. Be careful, as this operation is not reversible, and all data will be lost. It is highly recommended that you export your data before you drop your data.

In order to drop all data while retaining the schema, please click the Drop Data button under the Settings tab in the sidebar.

Dropping Data Programatically

In order to do this, call the dropData mutation on /admin/slash. As an example, if your graphql endpoint is https://frozen-mango-42.us-west-2.aws.cloud.dgraph.io/graphql, then the admin endpoint for schema will be at https://frozen-mango.us-west-2.aws.cloud.dgraph.io/admin/slash.

Please note that this endpoint requires Authentication.

Please see the following curl as an example.

curl 'https://<your-backend>/admin/slash' \
  -H 'X-Auth-Token: <your-token>' \
  -H 'Content-Type: application/graphql' \
  --data-binary 'mutation { dropData(allData: true) { response { code message } } }'

If you would like to drop the schema along with the data, then you can set the allDataAndSchema flag.

curl 'https://<your-backend>/admin/slash' \
  -H 'X-Auth-Token: <your-token>' \
  -H 'Content-Type: application/graphql' \
  --data-binary 'mutation { dropData(allDataAndSchema: true) { response { code message } } }'