Version: 2024-04
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ShopMetafield($namespace: String!, $key: String!) { shop { copyrightYear: metafield(namespace: $namespace, key: $key) { value } } }\",\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"copyright_year\"\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `query ShopMetafield($namespace: String!, $key: String!) {\n shop {\n copyrightYear: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n \"variables\": {\n \"namespace\": \"my_fields\",\n \"key\": \"copyright_year\"\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 ShopMetafield($namespace: String!, $key: String!) {\n shop {\n copyrightYear: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }\nQUERY\n\nvariables = {\n \"namespace\": \"my_fields\",\n \"key\": \"copyright_year\"\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 = <<\"my_fields\",\n \"key\" => \"copyright_year\",\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 ShopMetafield($namespace: String!, $key: String!) {\n shop {\n copyrightYear: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n }`,\n {\n variables: {\n \"namespace\": \"my_fields\",\n \"key\": \"copyright_year\"\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "query ShopMetafield($namespace: String!, $key: String!) {\n shop {\n copyrightYear: metafield(namespace: $namespace, key: $key) {\n value\n }\n }\n}"
input: { "namespace": "my_fields", "key": "copyright_year" }
response: { "data": { "shop": { "copyrightYear": { "value": "2022" } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query ShopMetafields { shop { metafields(first: 3) { edges { node { namespace key value } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query ShopMetafields {\n shop {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\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 ShopMetafields {\n shop {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query ShopMetafields {\n shop {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query ShopMetafields {\n shop {\n metafields(first: 3) {\n edges {\n node {\n namespace\n key\n value\n }\n }\n }\n }\n}"
input: {}
response: { "data": { "shop": { "metafields": { "edges": [ { "node": { "namespace": "my_fields", "key": "copyright_year", "value": "2022" } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { shop { name currencyCode checkoutApiSupported taxesIncluded resourceLimits { maxProductVariants } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n shop {\n name\n currencyCode\n checkoutApiSupported\n taxesIncluded\n resourceLimits {\n maxProductVariants\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 shop {\n name\n currencyCode\n checkoutApiSupported\n taxesIncluded\n resourceLimits {\n maxProductVariants\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n shop {\n name\n currencyCode\n checkoutApiSupported\n taxesIncluded\n resourceLimits {\n maxProductVariants\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n shop {\n name\n currencyCode\n checkoutApiSupported\n taxesIncluded\n resourceLimits {\n maxProductVariants\n }\n }\n}"
input: null
response: { "data": { "shop": { "name": "Snowdevil", "currencyCode": "USD", "checkoutApiSupported": true, "taxesIncluded": false, "resourceLimits": { "maxProductVariants": 100 } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { shop { staffMembers(first: 10) { edges { node { active avatar { url } email exists firstName id initials isShopOwner lastName locale name phone } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n shop {\n staffMembers(first: 10) {\n edges {\n node {\n active\n avatar {\n url\n }\n email\n exists\n firstName\n id\n initials\n isShopOwner\n lastName\n locale\n name\n phone\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 shop {\n staffMembers(first: 10) {\n edges {\n node {\n active\n avatar {\n url\n }\n email\n exists\n firstName\n id\n initials\n isShopOwner\n lastName\n locale\n name\n phone\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n shop {\n staffMembers(first: 10) {\n edges {\n node {\n active\n avatar {\n url\n }\n email\n exists\n firstName\n id\n initials\n isShopOwner\n lastName\n locale\n name\n phone\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n shop {\n staffMembers(first: 10) {\n edges {\n node {\n active\n avatar {\n url\n }\n email\n exists\n firstName\n id\n initials\n isShopOwner\n lastName\n locale\n name\n phone\n }\n }\n }\n }\n}"
input: null
response: { "data": { "shop": { "staffMembers": { "edges": [ { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/106ea358a244c6081c66489854c884cbfa858aec3c1730397e34bd4f4992f21e/www.gravatar.com/avatar/a902d35d9cd3096a7285782c69dd4622.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "sales@example.com", "exists": true, "firstName": "angie", "id": "gid://shopify/StaffMember/1039577421", "initials": [ "a", "l" ], "isShopOwner": false, "lastName": "lucuos", "locale": "en", "name": "angie lucuos", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/29f98977e6ce2b24120b4d26ce7fde694b7bafc46a6be575ce88cf26a789c4e6/www.gravatar.com/avatar/4df4299bb7b53d4a9e8989238f81c15d.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "arnie@champion.example.com", "exists": true, "firstName": "Arnold", "id": "gid://shopify/StaffMember/863601736", "initials": [ "S", "n" ], "isShopOwner": false, "lastName": "Schwarzenegger", "locale": "en", "name": "Snow Devil Inc.", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/s/files/1/2637/1970/users/foo.jpg?v=1731443626" }, "email": "bob@example.com", "exists": true, "firstName": "bob", "id": "gid://shopify/StaffMember/902541635", "initials": [ "b", "b" ], "isShopOwner": true, "lastName": "bobsen", "locale": "en", "name": "bob bobsen", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/a2fa3a40bc8b418a7e6a69413fb84a57164b6f4ce6757d4163ffda4302e02682/www.gravatar.com/avatar/59aa4f8e9b82c046003452b23e3b881e.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "pos@shopify.com", "exists": true, "firstName": "bob", "id": "gid://shopify/StaffMember/1004723144", "initials": [ "b", "b" ], "isShopOwner": false, "lastName": "bobsen", "locale": "en", "name": "bob bobsen", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/739472b8350cf18a7f2058ef2d37019d4026bcb276844fa3d192eed26b594e27/www.gravatar.com/avatar/6fe88e20596eb227b53b543c2cece91e.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "collaborator_bob@example.com", "exists": true, "firstName": "collaborator", "id": "gid://shopify/StaffMember/688782760", "initials": [ "S", "n" ], "isShopOwner": false, "lastName": "bob", "locale": "en", "name": "Snow Devil Inc.", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/8149b06b8974a1092082b18147941ef437a669fa6db5aba0ccd80bee9b33b788/www.gravatar.com/avatar/866ad7602839b586d7d18cb11b131881.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "customereventsbob@example.com", "exists": true, "firstName": "customereventsbob", "id": "gid://shopify/StaffMember/216359514", "initials": [ "c", "b" ], "isShopOwner": false, "lastName": "bobsen", "locale": "en", "name": "customereventsbob bobsen", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/9a11b2a61faef02c90cae564d6cd8f61c9c5932abdc470375ea4af38d2234678/www.gravatar.com/avatar/a30775a5f88642adceaa3a6ff418ff4d.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "customereventsbobnoapps@example.com", "exists": true, "firstName": "customereventsbobnoapps", "id": "gid://shopify/StaffMember/257608065", "initials": [ "c", "b" ], "isShopOwner": false, "lastName": "bobsen", "locale": "en", "name": "customereventsbobnoapps bobsen", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/d0f4af069a9948a91f75815dcf3c24b7bd775bb8fa66571da1b257f2fd2eacf5/www.gravatar.com/avatar/3111a27ed0d92a4209a15190114490d4.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "customereventsbobwithoneapp@example.com", "exists": true, "firstName": "customereventsbobwithoneapp", "id": "gid://shopify/StaffMember/584611871", "initials": [ "c", "b" ], "isShopOwner": false, "lastName": "bobsen", "locale": "en", "name": "customereventsbobwithoneapp bobsen", "phone": null } }, { "node": { "active": false, "avatar": { "url": "https://cdn.shopify.com/proxy/0feaeef95fe37c482d1472c776d9f5c35f3f4b0a051fef68bf702422c284f5fd/www.gravatar.com/avatar/cc9f2fc36ad3c135e4984fc6f63c4c16.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "deactivateduser@example.com", "exists": true, "firstName": "deactivated", "id": "gid://shopify/StaffMember/667736507", "initials": [ "d", "u" ], "isShopOwner": false, "lastName": "user", "locale": "en", "name": "deactivated user", "phone": null } }, { "node": { "active": true, "avatar": { "url": "https://cdn.shopify.com/proxy/bb267d2b2b59370b919f9c8f42719ece9e33c84ee51230220405746dd8c5c504/www.gravatar.com/avatar/68bd9ae0240cb5cfd89463b1fe778375.jpg?s=2048&d=https%3A%2F%2Fcdn.shopify.com%2Fshopifycloud%2Fshopify%2Fassets%2Fno-gravatar-new-04e7c2331218ac202e79e31be502fd5631bc96cb0206580dbcb0720ebbbd7c73.png" }, "email": "existingbob@example.com", "exists": true, "firstName": "existingbob", "id": "gid://shopify/StaffMember/2108187", "initials": [ "e", "b" ], "isShopOwner": false, "lastName": "bobsen", "locale": "en", "name": "existingbob bobsen", "phone": "3213213211" } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { shop { currencySettings(first: 1) { edges { node { currencyCode rateUpdatedAt } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n shop {\n currencySettings(first: 1) {\n edges {\n node {\n currencyCode\n rateUpdatedAt\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 shop {\n currencySettings(first: 1) {\n edges {\n node {\n currencyCode\n rateUpdatedAt\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n shop {\n currencySettings(first: 1) {\n edges {\n node {\n currencyCode\n rateUpdatedAt\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query {\n shop {\n currencySettings(first: 1) {\n edges {\n node {\n currencyCode\n rateUpdatedAt\n }\n }\n }\n }\n}"
input: null
response: { "data": { "shop": { "currencySettings": { "edges": [ { "node": { "currencyCode": "CAD", "rateUpdatedAt": "2018-01-24T00:01:01Z" } } ] } } } }
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-04/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query storefrontAccessToken { shop { storefrontAccessTokens(first: 10) { edges { node { id accessToken accessScopes { handle } createdAt title } } } } }\"\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query storefrontAccessToken {\n shop {\n storefrontAccessTokens(first: 10) {\n edges {\n node {\n id\n accessToken\n accessScopes {\n handle\n }\n createdAt\n title\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 storefrontAccessToken {\n shop {\n storefrontAccessTokens(first: 10) {\n edges {\n node {\n id\n accessToken\n accessScopes {\n handle\n }\n createdAt\n title\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([\"query\" => $query]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query storefrontAccessToken {\n shop {\n storefrontAccessTokens(first: 10) {\n edges {\n node {\n id\n accessToken\n accessScopes {\n handle\n }\n createdAt\n title\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n" Graphql query: "query storefrontAccessToken {\n shop {\n storefrontAccessTokens(first: 10) {\n edges {\n node {\n id\n accessToken\n accessScopes {\n handle\n }\n createdAt\n title\n }\n }\n }\n }\n}"
input: null
response: { "data": { "shop": { "storefrontAccessTokens": { "edges": [ { "node": { "id": "gid://shopify/StorefrontAccessToken/55270800", "accessToken": "678d97641255a4ab5feff997ee233f4c", "accessScopes": [ { "handle": "unauthenticated_read_product_listings" }, { "handle": "unauthenticated_write_checkouts" }, { "handle": "unauthenticated_read_checkouts" }, { "handle": "unauthenticated_read_selling_plans" } ], "createdAt": "2024-11-12T20:33:46Z", "title": "Buy Button Extension" } } ] } } } }