customersquery
Returns a list of customers.
CustomerConnection argumentsCustomerConnection!
The elements that come after the specified cursor.
Anchor to beforebeforeThe elements that come before the specified cursor.
Anchor to firstfirstThe first
n
elements from the paginated list.The last
n
elements from the paginated list.A filter made up of terms, connectives, modifiers, and comparators. You can apply one or more filters to a query. Learn more about Shopify API search syntax.
Reverse the order of the underlying list.
Sort the underlying list using a key. If your query is slow or returns an error, then try specifying a sort key that matches the field used in the search.
CustomerConnection possible returns
The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
A list of nodes that are contained in CustomerEdge. You can fetch data about an individual node, or you can follow the edges to fetch data about a collection of related nodes. At each node, you specify the fields that you want to retrieve.
An object that’s used to retrieve cursor information about the current page.
Code examples for QUERY: customers
Query Reference for QUERY: customers
"{\n customers {\n # CustomerConnection fields\n }\n}"
Input Reference for QUERY: customers
Schema Reference for QUERY: customers
Display Examples for QUERY: customers
[ { "example": { "type_name": "customers", "title": "Get all customers in Canada", "description": "The following query retrieves the first five customers that reside in Canada.\n", "query_string": "query {\n customers(first: 5, query: \"country:canada\") {\n edges {\n node {\n id\n }\n }\n }\n}", "query_arguments": { "first": 5, "query": "country:canada" }, "response": { "data": { "customers": { "edges": [ { "node": { "id": "gid://shopify/Customer/105906728" } }, { "node": { "id": "gid://shopify/Customer/408913340" } }, { "node": { "id": "gid://shopify/Customer/544365967" } }, { "node": { "id": "gid://shopify/Customer/554456816" } }, { "node": { "id": "gid://shopify/Customer/624407574" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/customers/test/unit/graph_api/admin/customer_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customers(first: 5, query: \\\"country:canada\\\") { edges { node { id } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customers(first: 5, query: \"country:canada\") {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 customers(first: 5, query: \"country:canada\") {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customers(first: 5, query: \"country:canada\") {\n edges {\n node {\n id\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customers(first: 5, query: \"country:canada\") {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "first", "description": "The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).", "type": { "kind": "SCALAR", "name": "Int", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "Int", "isDeprecated": false, "deprecationReason": null }, "key": "first", "argValue": " 5", "typeKind": "QUERY" }, { "arg": { "name": "query", "description": "A filter made up of terms, connectives, modifiers, and comparators.\n| name | type | description | acceptable_values | default_value | example_use |\n| ---- | ---- | ---- | ---- | ---- | ---- |\n| default | string | Filter by a case-insensitive search of all the fields in a document. |\n| email | string | The customer's email address, used to communicate information about orders and for the purposes of email marketing campaigns. You can use a wildcard value to filter the query by customers who have an email address specified. | | | - `email:bo.wang@example.com`<br/> - `email:*` |\n| id | id | Filter by `id` range. | | | - `id:1234`<br/> - `id:>=1234`<br/> - `id:<=1234` |\n| phone | string | The phone number of the customer, used to communicate information about orders and for the purposes of SMS marketing campaigns. You can use a wildcard value to filter the query by customers who have a phone number specified. | | | - `phone:+18005550100`<br/> - `phone:*` |\n| updated_at | time | The date and time, matching a whole day, when the customer's information was last updated. | | | - `updated_at:2024-01-01T00:00:00Z`<br/> - `updated_at:<now`<br/> - `updated_at:<=2024` |\nYou can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).\n", "type": { "kind": "SCALAR", "name": "String", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "String", "isDeprecated": false, "deprecationReason": null }, "key": "query", "argValue": " \"country:canada\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "customers", "title": "Get the first ten customers", "description": "The following query retrieves the first ten customers for a shop and returns the associated ID.\n", "query_string": "query {\n customers(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n}", "query_arguments": { "first": 10 }, "response": { "data": { "customers": { "edges": [ { "node": { "id": "gid://shopify/Customer/56501169" } }, { "node": { "id": "gid://shopify/Customer/105906728" } }, { "node": { "id": "gid://shopify/Customer/305367469" } }, { "node": { "id": "gid://shopify/Customer/317070273" } }, { "node": { "id": "gid://shopify/Customer/324586928" } }, { "node": { "id": "gid://shopify/Customer/352184960" } }, { "node": { "id": "gid://shopify/Customer/408913340" } }, { "node": { "id": "gid://shopify/Customer/544365967" } }, { "node": { "id": "gid://shopify/Customer/554122808" } }, { "node": { "id": "gid://shopify/Customer/554456816" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/customers/test/unit/graph_api/admin/customer_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customers(first: 10) { edges { node { id } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customers(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 customers(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customers(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customers(first: 10) {\n edges {\n node {\n id\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "first", "description": "The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).", "type": { "kind": "SCALAR", "name": "Int", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "Int", "isDeprecated": false, "deprecationReason": null }, "key": "first", "argValue": " 10", "typeKind": "QUERY" } ] }, { "example": { "type_name": "customers", "title": "Get the first ten customers updated after December 1, 2019", "description": "The following query retrieves the first ten customers for a shop that have been updated after December 1, 2019 and returns the associated ID and the date of update.\n", "query_string": "query {\n customers(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n}", "query_arguments": { "first": 10, "query": "updated_at:>2019-12-01" }, "response": { "data": { "customers": { "edges": [ { "node": { "id": "gid://shopify/Customer/56501169", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/105906728", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/305367469", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/317070273", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/324586928", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/352184960", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/408913340", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/554456816", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/567375318", "updatedAt": "2024-09-12T01:05:24Z" } }, { "node": { "id": "gid://shopify/Customer/624407574", "updatedAt": "2024-09-12T01:05:24Z" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/customers/test/unit/graph_api/admin/customer_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customers(first: 10, query: \\\"updated_at:>2019-12-01\\\") { edges { node { id updatedAt } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customers(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 customers(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customers(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customers(first: 10, query: \"updated_at:>2019-12-01\") {\n edges {\n node {\n id\n updatedAt\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "first", "description": "The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).", "type": { "kind": "SCALAR", "name": "Int", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "Int", "isDeprecated": false, "deprecationReason": null }, "key": "first", "argValue": " 10", "typeKind": "QUERY" }, { "arg": { "name": "query", "description": "A filter made up of terms, connectives, modifiers, and comparators.\n| name | type | description | acceptable_values | default_value | example_use |\n| ---- | ---- | ---- | ---- | ---- | ---- |\n| default | string | Filter by a case-insensitive search of all the fields in a document. |\n| email | string | The customer's email address, used to communicate information about orders and for the purposes of email marketing campaigns. You can use a wildcard value to filter the query by customers who have an email address specified. | | | - `email:bo.wang@example.com`<br/> - `email:*` |\n| id | id | Filter by `id` range. | | | - `id:1234`<br/> - `id:>=1234`<br/> - `id:<=1234` |\n| phone | string | The phone number of the customer, used to communicate information about orders and for the purposes of SMS marketing campaigns. You can use a wildcard value to filter the query by customers who have a phone number specified. | | | - `phone:+18005550100`<br/> - `phone:*` |\n| updated_at | time | The date and time, matching a whole day, when the customer's information was last updated. | | | - `updated_at:2024-01-01T00:00:00Z`<br/> - `updated_at:<now`<br/> - `updated_at:<=2024` |\nYou can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).\n", "type": { "kind": "SCALAR", "name": "String", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "String", "isDeprecated": false, "deprecationReason": null }, "key": "query", "argValue": " \"updated_at:>2019-12-01\"", "typeKind": "QUERY" } ] }, { "example": { "type_name": "customers", "title": "Get the first ten customers with an enabled customer account", "description": "The following query retrieves the first ten customers for a shop that have activated their shop account.\n", "query_string": "query {\n customers(first: 10, query: \"state:'ENABLED'\") {\n edges {\n node {\n id\n state\n }\n }\n }\n}", "query_arguments": { "first": 10, "query": "state:'ENABLED'" }, "response": { "data": { "customers": { "edges": [ { "node": { "id": "gid://shopify/Customer/324586928", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/544365967", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/554122808", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/624407574", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/649400230", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/649509010", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/839649557", "state": "ENABLED" } }, { "node": { "id": "gid://shopify/Customer/1018520244", "state": "ENABLED" } } ] } } }, "api_name": "admin", "minimum_api_version": "2023-10", "maximum_api_version": "unstable", "location": "/components/customers/test/unit/graph_api/admin/customer_test.rb", "curl_example": "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2024-10/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"query { customers(first: 10, query: \\\"state:'\\''ENABLED'\\''\\\") { edges { node { id state } } } }\"\n}'\n", "remix_example": "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n customers(first: 10, query: \"state:'ENABLED'\") {\n edges {\n node {\n id\n state\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\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 customers(first: 10, query: \"state:'ENABLED'\") {\n edges {\n node {\n id\n state\n }\n }\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n", "node_example": "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n customers(first: 10, query: \"state:'ENABLED'\") {\n edges {\n node {\n id\n state\n }\n }\n }\n }`,\n});\n", "php_example": "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n query {\n customers(first: 10, query: \"state:'ENABLED'\") {\n edges {\n node {\n id\n state\n }\n }\n }\n }\nQUERY;\n\n$response = $client->query([\"query\" => $query]);\n" }, "titleStringKey": "arguments", "inputVariableEntries": [ { "arg": { "name": "first", "description": "The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).", "type": { "kind": "SCALAR", "name": "Int", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "Int", "isDeprecated": false, "deprecationReason": null }, "key": "first", "argValue": " 10", "typeKind": "QUERY" }, { "arg": { "name": "query", "description": "A filter made up of terms, connectives, modifiers, and comparators.\n| name | type | description | acceptable_values | default_value | example_use |\n| ---- | ---- | ---- | ---- | ---- | ---- |\n| default | string | Filter by a case-insensitive search of all the fields in a document. |\n| email | string | The customer's email address, used to communicate information about orders and for the purposes of email marketing campaigns. You can use a wildcard value to filter the query by customers who have an email address specified. | | | - `email:bo.wang@example.com`<br/> - `email:*` |\n| id | id | Filter by `id` range. | | | - `id:1234`<br/> - `id:>=1234`<br/> - `id:<=1234` |\n| phone | string | The phone number of the customer, used to communicate information about orders and for the purposes of SMS marketing campaigns. You can use a wildcard value to filter the query by customers who have a phone number specified. | | | - `phone:+18005550100`<br/> - `phone:*` |\n| updated_at | time | The date and time, matching a whole day, when the customer's information was last updated. | | | - `updated_at:2024-01-01T00:00:00Z`<br/> - `updated_at:<now`<br/> - `updated_at:<=2024` |\nYou can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).\n", "type": { "kind": "SCALAR", "name": "String", "list": false, "non_null": false }, "defaultValue": null, "typeSignature": "String", "isDeprecated": false, "deprecationReason": null }, "key": "query", "argValue": " \"state:'ENABLED'\"", "typeKind": "QUERY" } ] } ]