Version: unstable
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\": \"query { customer(id: \\\"gid://shopify/Customer/544365967\\\") { id firstName lastName email phone numberOfOrders amountSpent { amount currencyCode } createdAt updatedAt note verifiedEmail validEmailAddress tags lifetimeDuration defaultAddress { formattedArea address1 } addresses { address1 } image { src } canDelete } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n id\n firstName\n lastName\n email\n phone\n numberOfOrders\n amountSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n note\n verifiedEmail\n validEmailAddress\n tags\n lifetimeDuration\n defaultAddress {\n formattedArea\n address1\n }\n addresses {\n address1\n }\n image {\n src\n }\n canDelete\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 query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n id\n firstName\n lastName\n email\n phone\n numberOfOrders\n amountSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n note\n verifiedEmail\n validEmailAddress\n tags\n lifetimeDuration\n defaultAddress {\n formattedArea\n address1\n }\n addresses {\n address1\n }\n image {\n src\n }\n canDelete\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n id\n firstName\n lastName\n email\n phone\n numberOfOrders\n amountSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n note\n verifiedEmail\n validEmailAddress\n tags\n lifetimeDuration\n defaultAddress {\n formattedArea\n address1\n }\n addresses {\n address1\n }\n image {\n src\n }\n canDelete\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n id\n firstName\n lastName\n email\n phone\n numberOfOrders\n amountSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n note\n verifiedEmail\n validEmailAddress\n tags\n lifetimeDuration\n defaultAddress {\n formattedArea\n address1\n }\n addresses {\n address1\n }\n image {\n src\n }\n canDelete\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n id\n firstName\n lastName\n email\n phone\n numberOfOrders\n amountSpent {\n amount\n currencyCode\n }\n createdAt\n updatedAt\n note\n verifiedEmail\n validEmailAddress\n tags\n lifetimeDuration\n defaultAddress {\n formattedArea\n address1\n }\n addresses {\n address1\n }\n image {\n src\n }\n canDelete\n }\n}"
input: null
response: { "data": { "customer": { "id": "gid://shopify/Customer/544365967", "firstName": "Bob", "lastName": "Bobsen", "email": "bob@example.com", "phone": "+13125551212", "numberOfOrders": "25", "amountSpent": { "amount": "8305.6", "currencyCode": "USD" }, "createdAt": "2005-06-15T15:57:11Z", "updatedAt": "2005-06-16T15:57:11Z", "note": null, "verifiedEmail": true, "validEmailAddress": true, "tags": [ "Bob", "Canadian", "Léon", "Noël" ], "lifetimeDuration": "over 19 years", "defaultAddress": { "formattedArea": "Ottawa ON, Canada", "address1": "123 Amoebobacterieae St" }, "addresses": [ { "address1": "123 Amoebobacterieae St" } ], "image": { "src": "https://cdn.shopify.com/proxy/d02a582792c73c48b4b62a95f42bcbf6eff91c5d232efb2057ca4c41005e4728/www.gravatar.com/avatar/4b9bb80620f03eb3719e0a061c14283d.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fadmin%2Fcustomers%2Fpolaris%2Favatar-2-a0ee6e3fb3ae515b66b68388b265e5bd1e90646c4c72d59170518f45351e668b.png" }, "canDelete": false } } }
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\": \"query { customer(id: \\\"gid://shopify/Customer/544365967\\\") { email firstName lastName defaultAddress { address1 city province zip country } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n email\n firstName\n lastName\n defaultAddress {\n address1\n city\n province\n zip\n country\n }\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 query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n email\n firstName\n lastName\n defaultAddress {\n address1\n city\n province\n zip\n country\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n email\n firstName\n lastName\n defaultAddress {\n address1\n city\n province\n zip\n country\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n email\n firstName\n lastName\n defaultAddress {\n address1\n city\n province\n zip\n country\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n email\n firstName\n lastName\n defaultAddress {\n address1\n city\n province\n zip\n country\n }\n }\n}"
input: null
response: { "data": { "customer": { "email": "bob@example.com", "firstName": "Bob", "lastName": "Bobsen", "defaultAddress": { "address1": "123 Amoebobacterieae St", "city": "Ottawa", "province": "Ontario", "zip": "K2P0V6", "country": "Canada" } } } }
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\": \"query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) { customer(id: $ownerId) { nickname: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"nickname\",\n \"ownerId\": \"gid://shopify/Customer/544365967\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n customer(id: $ownerId) {\n nickname: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"nickname\",\n \"ownerId\": \"gid://shopify/Customer/544365967\"\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 query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n customer(id: $ownerId) {\n nickname: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"nickname\",\n \"ownerId\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n customer(id: $ownerId) {\n nickname: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY;\n\n$variables = [\n \"namespace\" => \"my_fields\",\n \"key\" => \"nickname\",\n \"ownerId\" => \"gid://shopify/Customer/544365967\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n customer(id: $ownerId) {\n nickname: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"nickname\",\n \"ownerId\": \"gid://shopify/Customer/544365967\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomerMetafield($namespace: String!, $key: String!, $ownerId: ID!) {\n customer(id: $ownerId) {\n nickname: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}"
input: { "namespace": "my_fields", "key": "nickname", "ownerId": "gid://shopify/Customer/544365967" }
response: { "data": { "customer": { "nickname": { "value": "rob" } } } }
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\": \"query { customer(id: \\\"gid://shopify/Customer/544365967\\\") { addresses(first: 5) { address1 } canDelete createdAt defaultAddress { address1 } displayName email events(first: 5) { edges { node { message } } } firstName id image { id } lastName legacyResourceId lifetimeDuration mergeable { isMergeable reason } metafield(key: \\\"app_key\\\", namespace: \\\"affiliates\\\") { description } metafields(first: 5) { edges { node { id } } } note orders(first: 5) { edges { node { id } } } numberOfOrders phone state tags taxExempt amountSpent { amount } updatedAt validEmailAddress verifiedEmail } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n addresses(first: 5) {\n address1\n }\n canDelete\n createdAt\n defaultAddress {\n address1\n }\n displayName\n email\n events(first: 5) {\n edges {\n node {\n message\n }\n }\n }\n firstName\n id\n image {\n id\n }\n lastName\n legacyResourceId\n lifetimeDuration\n mergeable {\n isMergeable\n reason\n }\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n note\n orders(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n numberOfOrders\n phone\n state\n tags\n taxExempt\n amountSpent {\n amount\n }\n updatedAt\n validEmailAddress\n verifiedEmail\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 query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n addresses(first: 5) {\n address1\n }\n canDelete\n createdAt\n defaultAddress {\n address1\n }\n displayName\n email\n events(first: 5) {\n edges {\n node {\n message\n }\n }\n }\n firstName\n id\n image {\n id\n }\n lastName\n legacyResourceId\n lifetimeDuration\n mergeable {\n isMergeable\n reason\n }\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n note\n orders(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n numberOfOrders\n phone\n state\n tags\n taxExempt\n amountSpent {\n amount\n }\n updatedAt\n validEmailAddress\n verifiedEmail\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n addresses(first: 5) {\n address1\n }\n canDelete\n createdAt\n defaultAddress {\n address1\n }\n displayName\n email\n events(first: 5) {\n edges {\n node {\n message\n }\n }\n }\n firstName\n id\n image {\n id\n }\n lastName\n legacyResourceId\n lifetimeDuration\n mergeable {\n isMergeable\n reason\n }\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n note\n orders(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n numberOfOrders\n phone\n state\n tags\n taxExempt\n amountSpent {\n amount\n }\n updatedAt\n validEmailAddress\n verifiedEmail\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n addresses(first: 5) {\n address1\n }\n canDelete\n createdAt\n defaultAddress {\n address1\n }\n displayName\n email\n events(first: 5) {\n edges {\n node {\n message\n }\n }\n }\n firstName\n id\n image {\n id\n }\n lastName\n legacyResourceId\n lifetimeDuration\n mergeable {\n isMergeable\n reason\n }\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n note\n orders(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n numberOfOrders\n phone\n state\n tags\n taxExempt\n amountSpent {\n amount\n }\n updatedAt\n validEmailAddress\n verifiedEmail\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n customer(id: \"gid://shopify/Customer/544365967\") {\n addresses(first: 5) {\n address1\n }\n canDelete\n createdAt\n defaultAddress {\n address1\n }\n displayName\n email\n events(first: 5) {\n edges {\n node {\n message\n }\n }\n }\n firstName\n id\n image {\n id\n }\n lastName\n legacyResourceId\n lifetimeDuration\n mergeable {\n isMergeable\n reason\n }\n metafield(key: \"app_key\", namespace: \"affiliates\") {\n description\n }\n metafields(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n note\n orders(first: 5) {\n edges {\n node {\n id\n }\n }\n }\n numberOfOrders\n phone\n state\n tags\n taxExempt\n amountSpent {\n amount\n }\n updatedAt\n validEmailAddress\n verifiedEmail\n }\n}"
input: null
response: { "data": { "customer": { "addresses": [ { "address1": "123 Amoebobacterieae St" } ], "canDelete": false, "createdAt": "2005-06-15T15:57:11Z", "defaultAddress": { "address1": "123 Amoebobacterieae St" }, "displayName": "Bob Bobsen", "email": "bob@example.com", "events": { "edges": [] }, "firstName": "Bob", "id": "gid://shopify/Customer/544365967", "image": { "id": null }, "lastName": "Bobsen", "legacyResourceId": "544365967", "lifetimeDuration": "over 19 years", "mergeable": { "isMergeable": false, "reason": "Bob Bobsen is scheduled for redaction or has been redacted and can’t be merged." }, "metafield": null, "metafields": { "edges": [ { "node": { "id": "gid://shopify/Metafield/749520593" } } ] }, "note": null, "orders": { "edges": [ { "node": { "id": "gid://shopify/Order/116757651" } }, { "node": { "id": "gid://shopify/Order/126216516" } }, { "node": { "id": "gid://shopify/Order/148977776" } }, { "node": { "id": "gid://shopify/Order/215577410" } }, { "node": { "id": "gid://shopify/Order/235240302" } } ] }, "numberOfOrders": "25", "phone": "+13125551212", "state": "ENABLED", "tags": [ "Bob", "Canadian", "Léon", "Noël" ], "taxExempt": false, "amountSpent": { "amount": "8305.6" }, "updatedAt": "2005-06-16T15:57:11Z", "validEmailAddress": true, "verifiedEmail": true } } }
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\": \"query CustomerMetafields($ownerId: ID!) { customer(id: $ownerId) { metafields(first: 3) { edges { node { namespace key value } } } } }\",\n \"variables\": {\n \"ownerId\": \"gid://shopify/Customer/544365967\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CustomerMetafields($ownerId: ID!) {\n customer(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"ownerId\": \"gid://shopify/Customer/544365967\"\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 query CustomerMetafields($ownerId: ID!) {\n customer(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"ownerId\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CustomerMetafields($ownerId: ID!) {\n customer(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"ownerId\" => \"gid://shopify/Customer/544365967\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomerMetafields($ownerId: ID!) {\n customer(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"ownerId\": \"gid://shopify/Customer/544365967\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomerMetafields($ownerId: ID!) {\n customer(id: $ownerId) {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}"
input: { "ownerId": "gid://shopify/Customer/544365967" }
response: { "data": { "customer": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "nickname", "value": "rob" } } ] } } } }
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\": \"query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) { customer(id: $ownerId) { metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) { edges { node { name namespace key type { name } } } } } }\",\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Customer/544365967\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n customer(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Customer/544365967\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\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 query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n customer(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Customer/544365967\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n customer(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"pinnedStatus\" => \"PINNED\",\n \"ownerId\" => \"gid://shopify/Customer/544365967\",\n \"first\" => 10,\n \"sortKey\" => \"PINNED_POSITION\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n customer(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"pinnedStatus\": \"PINNED\",\n \"ownerId\": \"gid://shopify/Customer/544365967\",\n \"first\": 10,\n \"sortKey\": \"PINNED_POSITION\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomerMetafieldDefinitions($ownerId: ID!, $first: Int, $pinnedStatus: MetafieldDefinitionPinnedStatus, $sortKey: MetafieldDefinitionSortKeys) {\n customer(id: $ownerId) {\n metafieldDefinitions(first: $first, pinnedStatus: $pinnedStatus, sortKey: $sortKey) {\n edges {\n node {\n name\n namespace\n key\n type {\n name\n }\n }\n }\n }\n }\n}"
input: { "pinnedStatus": "PINNED", "ownerId": "gid://shopify/Customer/544365967", "first": 10, "sortKey": "PINNED_POSITION" }
response: { "data": { "customer": { "metafieldDefinitions": { "edges": [ { "node": { "name": "Pronouns", "namespace": "my_fields", "key": "pronouns", "type": { "name": "single_line_text_field" } } }, { "node": { "name": "Nickname", "namespace": "my_fields", "key": "nickname", "type": { "name": "single_line_text_field" } } } ] } } } }
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\": \"query { Bob: customer(id: \\\"gid://shopify/Customer/544365967\\\") { ...customerProfile } Jane: customer(id: \\\"gid://shopify/Customer/567375318\\\") { ...customerProfile } Jenny: customer(id: \\\"gid://shopify/Customer/56501169\\\") { ...customerProfile } } fragment customerProfile on Customer { firstName lastName email createdAt }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n ...customerProfile\n }\n Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n ...customerProfile\n }\n Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n ...customerProfile\n }\n }\n \n fragment customerProfile on Customer {\n firstName\n lastName\n email\n createdAt\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 query {\n Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n ...customerProfile\n }\n Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n ...customerProfile\n }\n Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n ...customerProfile\n }\n }\n \n fragment customerProfile on Customer {\n firstName\n lastName\n email\n createdAt\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n ...customerProfile\n }\n Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n ...customerProfile\n }\n Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n ...customerProfile\n }\n }\n \n fragment customerProfile on Customer {\n firstName\n lastName\n email\n createdAt\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n ...customerProfile\n }\n Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n ...customerProfile\n }\n Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n ...customerProfile\n }\n }\n \n fragment customerProfile on Customer {\n firstName\n lastName\n email\n createdAt\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n Bob: customer(id: \"gid://shopify/Customer/544365967\") {\n ...customerProfile\n }\n Jane: customer(id: \"gid://shopify/Customer/567375318\") {\n ...customerProfile\n }\n Jenny: customer(id: \"gid://shopify/Customer/56501169\") {\n ...customerProfile\n }\n}\n\nfragment customerProfile on Customer {\n firstName\n lastName\n email\n createdAt\n}"
input: null
response: { "data": { "Bob": { "firstName": "Bob", "lastName": "Bobsen", "email": "bob@example.com", "createdAt": "2005-06-15T15:57:11Z" }, "Jane": { "firstName": "Jane", "lastName": "Smith", "email": "janesmith@b2b.example.com", "createdAt": "2024-11-04T18:56:43Z" }, "Jenny": { "firstName": "Jenny", "lastName": "Test", "email": "jennytest@b2b.example.com", "createdAt": "2024-11-04T18:56:43Z" } } }
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\": \"query { customer(id: \\\"gid://shopify/Customer/624407574\\\") { lastOrder { lineItems(first: 5) { edges { node { name quantity } } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customer(id: \"gid://shopify/Customer/624407574\") {\n lastOrder {\n lineItems(first: 5) {\n edges {\n node {\n name\n quantity\n }\n }\n }\n }\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 query {\n customer(id: \"gid://shopify/Customer/624407574\") {\n lastOrder {\n lineItems(first: 5) {\n edges {\n node {\n name\n quantity\n }\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customer(id: \"gid://shopify/Customer/624407574\") {\n lastOrder {\n lineItems(first: 5) {\n edges {\n node {\n name\n quantity\n }\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customer(id: \"gid://shopify/Customer/624407574\") {\n lastOrder {\n lineItems(first: 5) {\n edges {\n node {\n name\n quantity\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n customer(id: \"gid://shopify/Customer/624407574\") {\n lastOrder {\n lineItems(first: 5) {\n edges {\n node {\n name\n quantity\n }\n }\n }\n }\n }\n}"
input: null
response: { "data": { "customer": { "lastOrder": { "lineItems": { "edges": [ { "node": { "name": "Draft - 151cm", "quantity": 1 } } ] } } } } }
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\": \"query { customer(id: \\\"gid://shopify/Customer/105906728\\\") { mergeable { isMergeable reason errorFields mergeInProgress { jobId status resultingCustomerId customerMergeErrors { errorFields message } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customer(id: \"gid://shopify/Customer/105906728\") {\n mergeable {\n isMergeable\n reason\n errorFields\n mergeInProgress {\n jobId\n status\n resultingCustomerId\n customerMergeErrors {\n errorFields\n message\n }\n }\n }\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 query {\n customer(id: \"gid://shopify/Customer/105906728\") {\n mergeable {\n isMergeable\n reason\n errorFields\n mergeInProgress {\n jobId\n status\n resultingCustomerId\n customerMergeErrors {\n errorFields\n message\n }\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customer(id: \"gid://shopify/Customer/105906728\") {\n mergeable {\n isMergeable\n reason\n errorFields\n mergeInProgress {\n jobId\n status\n resultingCustomerId\n customerMergeErrors {\n errorFields\n message\n }\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customer(id: \"gid://shopify/Customer/105906728\") {\n mergeable {\n isMergeable\n reason\n errorFields\n mergeInProgress {\n jobId\n status\n resultingCustomerId\n customerMergeErrors {\n errorFields\n message\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n customer(id: \"gid://shopify/Customer/105906728\") {\n mergeable {\n isMergeable\n reason\n errorFields\n mergeInProgress {\n jobId\n status\n resultingCustomerId\n customerMergeErrors {\n errorFields\n message\n }\n }\n }\n }\n}"
input: null
response: { "data": { "customer": { "mergeable": { "isMergeable": false, "reason": "John Smith is scheduled for redaction or has been redacted and can’t be merged.", "errorFields": [ "REDACTED_AT" ], "mergeInProgress": null } } } }
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\": \"query { bob: customer(id: \\\"gid://shopify/Customer/544365967\\\") { firstName lastName email } john: customer(id: \\\"gid://shopify/Customer/105906728\\\") { firstName lastName email } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n bob: customer(id: \"gid://shopify/Customer/544365967\") {\n firstName\n lastName\n email\n }\n john: customer(id: \"gid://shopify/Customer/105906728\") {\n firstName\n lastName\n email\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 query {\n bob: customer(id: \"gid://shopify/Customer/544365967\") {\n firstName\n lastName\n email\n }\n john: customer(id: \"gid://shopify/Customer/105906728\") {\n firstName\n lastName\n email\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n bob: customer(id: \"gid://shopify/Customer/544365967\") {\n firstName\n lastName\n email\n }\n john: customer(id: \"gid://shopify/Customer/105906728\") {\n firstName\n lastName\n email\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n bob: customer(id: \"gid://shopify/Customer/544365967\") {\n firstName\n lastName\n email\n }\n john: customer(id: \"gid://shopify/Customer/105906728\") {\n firstName\n lastName\n email\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n bob: customer(id: \"gid://shopify/Customer/544365967\") {\n firstName\n lastName\n email\n }\n john: customer(id: \"gid://shopify/Customer/105906728\") {\n firstName\n lastName\n email\n }\n}"
input: null
response: { "data": { "bob": { "firstName": "Bob", "lastName": "Bobsen", "email": "bob@example.com" }, "john": { "firstName": "John", "lastName": "Smith", "email": "johnsmith@example.com" } } }
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\": \"query CustomerAddressList($id: ID!) { customer(id: $id) { defaultAddress { address1 city } addressesV2(first: 10) { edges { node { address1 city } } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Customer/544365967\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CustomerAddressList($id: ID!) {\n customer(id: $id) {\n defaultAddress {\n address1\n city\n }\n addressesV2(first: 10) {\n edges {\n node {\n address1\n city\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Customer/544365967\"\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 query CustomerAddressList($id: ID!) {\n customer(id: $id) {\n defaultAddress {\n address1\n city\n }\n addressesV2(first: 10) {\n edges {\n node {\n address1\n city\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CustomerAddressList($id: ID!) {\n customer(id: $id) {\n defaultAddress {\n address1\n city\n }\n addressesV2(first: 10) {\n edges {\n node {\n address1\n city\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Customer/544365967\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomerAddressList($id: ID!) {\n customer(id: $id) {\n defaultAddress {\n address1\n city\n }\n addressesV2(first: 10) {\n edges {\n node {\n address1\n city\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Customer/544365967\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomerAddressList($id: ID!) {\n customer(id: $id) {\n defaultAddress {\n address1\n city\n }\n addressesV2(first: 10) {\n edges {\n node {\n address1\n city\n }\n }\n }\n }\n}"
input: { "id": "gid://shopify/Customer/544365967" }
response: { "data": { "customer": { "defaultAddress": { "address1": "123 Amoebobacterieae St", "city": "Ottawa" }, "addressesV2": { "edges": [ { "node": { "address1": "123 Amoebobacterieae St", "city": "Ottawa" } } ] } } } }
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\": \"query CustomerAddressShow($id: ID!) { customer(id: $id) { addressesV2(first: 250) { edges { node { id address1 city } } } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/Customer/544365967\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query CustomerAddressShow($id: ID!) {\n customer(id: $id) {\n addressesV2(first: 250) {\n edges {\n node {\n id\n address1\n city\n }\n }\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/Customer/544365967\"\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 query CustomerAddressShow($id: ID!) {\n customer(id: $id) {\n addressesV2(first: 250) {\n edges {\n node {\n id\n address1\n city\n }\n }\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/Customer/544365967\"\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query CustomerAddressShow($id: ID!) {\n customer(id: $id) {\n addressesV2(first: 250) {\n edges {\n node {\n id\n address1\n city\n }\n }\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/Customer/544365967\",\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query CustomerAddressShow($id: ID!) {\n customer(id: $id) {\n addressesV2(first: 250) {\n edges {\n node {\n id\n address1\n city\n }\n }\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/Customer/544365967\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query CustomerAddressShow($id: ID!) {\n customer(id: $id) {\n addressesV2(first: 250) {\n edges {\n node {\n id\n address1\n city\n }\n }\n }\n }\n}"
input: { "id": "gid://shopify/Customer/544365967" }
response: { "data": { "customer": { "addressesV2": { "edges": [ { "node": { "id": "gid://shopify/MailingAddress/544365967?model_name=CustomerAddress", "address1": "123 Amoebobacterieae St", "city": "Ottawa" } } ] } } } }