Definition

Deleting data in GraphQL is performed using mutations that remove existing records from the server.


Core Concept

A delete mutation typically requires an identifier (e.g., id) to locate the record and remove it.


Schema Example

type Mutation {
  deleteUser(id: ID!): Boolean
}

Basic Mutation

mutation {
  deleteUser(id: "1")
}

Response

{
  "data": {
    "deleteUser": true
  }
}

Alternative Return Type

Sometimes the deleted object is returned instead of a boolean: