# pageDelete - admin - MUTATION Version: unstable ## Description Deletes a page. ### Access Scopes Any of `write_content`, `write_online_store_pages` access scopes. ## Arguments * [id](/docs/api/admin/unstable/scalars/ID): ID! - The ID of the page to be deleted. ## Returns * [deletedPageId](/docs/api/admin/unstable/scalars/ID): ID The ID of the deleted page. * [userErrors](/docs/api/admin/unstable/objects/PageDeleteUserError): PageDeleteUserError! The list of errors that occurred from executing the mutation. ## Examples ### Deletes a page Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DeletePage($id: ID!) { pageDelete(id: $id) { deletedPageId userErrors { code field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Page/602767277\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n code\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Page/602767277\"\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 DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n code\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Page/602767277\"\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 DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n code\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Page/602767277\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n code\n field\n message\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Page/602767277" } #### Graphql Response { "data": { "pageDelete": { "deletedPageId": "gid://shopify/Page/602767277", "userErrors": [] } } } ### Failing to delete a page when the input ID is invalid Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DeletePage($id: ID!) { pageDelete(id: $id) { deletedPageId userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Page/1337\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Page/1337\"\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 DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Page/1337\"\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 DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Page/1337\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Page/1337" } #### Graphql Response { "data": { "pageDelete": { "deletedPageId": null, "userErrors": [ { "field": [ "id" ], "message": "Page does not exist" } ] } } } ### Successfully deleting a page Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/unstable/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation DeletePage($id: ID!) { pageDelete(id: $id) { deletedPageId userErrors { field message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Page/602767277\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Page/602767277\"\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 DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Page/602767277\"\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 DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Page/602767277\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation DeletePage($id: ID!) {\n pageDelete(id: $id) {\n deletedPageId\n userErrors {\n field\n message\n }\n }\n}" #### Graphql Input { "id": "gid://shopify/Page/602767277" } #### Graphql Response { "data": { "pageDelete": { "deletedPageId": "gid://shopify/Page/602767277", "userErrors": [] } } }