# eventsCount - admin-graphql - QUERY
Version: 2024-10
## Description
Count of events. Limited to a maximum of 10000.
### Access Scopes
## Arguments
* [query](/docs/api/admin-graphql/2024-10/scalars/String): String - A filter made up of terms, connectives, modifiers, and comparators.
| name | type | description | acceptable_values | default_value | example_use |
| ---- | ---- | ---- | ---- | ---- | ---- |
| action | string | The action that occured. | | | - `action:create` |
| comments | boolean | Whether or not to include [comment-events](https://shopify.dev/api/admin-graphql/latest/objects/CommentEvent) in your search, passing `false` will exclude comment-events, any other value will include comment-events. | | | - `false`
- `true` |
| created_at | time | Filter by the date and time when the event happened. | | | - `created_at:>2020-10-21`
- `created_at: - `id:>=1234`
- `id:<=1234` |
| subject_type | string | The resource type affected by this event, See [EventSubjectType](https://shopify.dev/api/admin-graphql/latest/enums/EventSubjectType) for possible values. | | | - `COMPANY` |
You can apply one or more filters to a query. Learn more about [Shopify API search syntax](https://shopify.dev/api/usage/search-syntax).
## Returns
* [count](/docs/api/admin-graphql/2024-10/scalars/Int): Int! The count of elements.
* [precision](/docs/api/admin-graphql/2024-10/enums/CountPrecision): CountPrecision! The count's precision, or the exactness of the value.
## Examples
### Retrieve the amount of events after a given time
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 { eventsCount(query: \\\"created_at:>=2024-01-01\\\") { count precision } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n eventsCount(query: \"created_at:>=2024-01-01\") {\n count\n precision\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 eventsCount(query: \"created_at:>=2024-01-01\") {\n count\n precision\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n"
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n eventsCount(query: \"created_at:>=2024-01-01\") {\n count\n precision\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n eventsCount(query: \"created_at:>=2024-01-01\") {\n count\n precision\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"eventsCount": {
"count": 28,
"precision": "EXACT"
}
}
}
### Retrieve the amount of product events, including comment events
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 { eventsCount(query: \\\"comments:1 AND subject_type:'\\''PRODUCT'\\''\\\") { count precision } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n eventsCount(query: \"comments:1 AND subject_type:'PRODUCT'\") {\n count\n precision\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 eventsCount(query: \"comments:1 AND subject_type:'PRODUCT'\") {\n count\n precision\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n"
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query {\n eventsCount(query: \"comments:1 AND subject_type:'PRODUCT'\") {\n count\n precision\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n eventsCount(query: \"comments:1 AND subject_type:'PRODUCT'\") {\n count\n precision\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"eventsCount": {
"count": 7,
"precision": "EXACT"
}
}
}
### Retrieves a count of events
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 EventCount { eventsCount { count } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query EventCount {\n eventsCount {\n count\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 EventCount {\n eventsCount {\n count\n }\n }\nQUERY\n\nresponse = client.query(query: query)\n"
Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n query EventCount {\n eventsCount {\n count\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query EventCount {\n eventsCount {\n count\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"eventsCount": {
"count": 166
}
}
}