# customerDelete - admin-graphql - MUTATION Version: 2024-07 ## Description Delete a customer. As of API version 2022-10, apps using protected customer data must meet the protected customer data [requirements](https://shopify.dev/apps/store/data-protection/protected-customer-data). ### Access Scopes `write_customers` access scope. ## Arguments * [input](/docs/api/admin-graphql/2024-07/input-objects/CustomerDeleteInput): CustomerDeleteInput! - Specifies the customer to delete. ## Returns * [deletedCustomerId](/docs/api/admin-graphql/2024-07/scalars/ID): ID The ID of the deleted customer. * [shop](/docs/api/admin-graphql/2024-07/objects/Shop): Shop! The shop of the deleted customer. * [userErrors](/docs/api/admin-graphql/2024-07/objects/UserError): UserError! The list of errors that occurred from executing the mutation. ## Examples ### Deletes a customer Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-07/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation customerDelete($id: ID!) { customerDelete(input: {id: $id}) { shop { id } userErrors { field message } deletedCustomerId } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Customer/105906728\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation customerDelete($id: ID!) {\n customerDelete(input: {id: $id}) {\n shop {\n id\n }\n userErrors {\n field\n message\n }\n deletedCustomerId\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Customer/105906728\"\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation customerDelete($id: ID!) {\n customerDelete(input: {id: $id}) {\n shop {\n id\n }\n userErrors {\n field\n message\n }\n deletedCustomerId\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Customer/105906728\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation customerDelete($id: ID!) {\n customerDelete(input: {id: $id}) {\n shop {\n id\n }\n userErrors {\n field\n message\n }\n deletedCustomerId\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Customer/105906728\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation customerDelete($id: ID!) {\n customerDelete(input: {id: $id}) {\n shop {\n id\n }\n userErrors {\n field\n message\n }\n deletedCustomerId\n }\n}" #### Graphql Input { "id": "gid://shopify/Customer/105906728" } #### Graphql Response { "data": { "customerDelete": { "shop": { "id": "gid://shopify/Shop/26371970" }, "userErrors": [], "deletedCustomerId": "gid://shopify/Customer/105906728" } } }