# events - admin-graphql - QUERY
Version: 2024-10
## Description
The paginated list of events associated with the store.
### Access Scopes
## Arguments
* [after](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come after the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).
* [before](/docs/api/admin-graphql/2024-10/scalars/String): String - The elements that come before the specified [cursor](https://shopify.dev/api/usage/pagination-graphql).
* [first](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The first `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).
* [last](/docs/api/admin-graphql/2024-10/scalars/Int): Int - The last `n` elements from the [paginated list](https://shopify.dev/api/usage/pagination-graphql).
* [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).
* [reverse](/docs/api/admin-graphql/2024-10/scalars/Boolean): Boolean - Reverse the order of the underlying list.
* [sortKey](/docs/api/admin-graphql/2024-10/enums/EventSortKeys): EventSortKeys - 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](https://shopify.dev/api/usage/pagination-graphql#search-performance-considerations).
## Returns
* [edges](/docs/api/admin-graphql/2024-10/objects/EventEdge): EventEdge! The connection between the node and its parent. Each edge contains a minimum of the edge's cursor and the node.
* [nodes](/docs/api/admin-graphql/2024-10/interfaces/Event): Event! A list of nodes that are contained in EventEdge. 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.
* [pageInfo](/docs/api/admin-graphql/2024-10/objects/PageInfo): PageInfo! An object that’s used to retrieve [cursor information](https://shopify.dev/api/usage/pagination-graphql) about the current page.
## Examples
### Retrieve the first 10 destroy events for products
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 { events(query: \\\"action:'\\''destroy'\\'' AND subject_type:'\\''PRODUCT'\\''\\\", first: 10) { edges { node { id message ... on BasicEvent { action subjectType subject { __typename } } } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n events(query: \"action:'destroy' AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\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 events(query: \"action:'destroy' AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }\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 events(query: \"action:'destroy' AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n events(query: \"action:'destroy' AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"events": {
"edges": [
{
"node": {
"id": "gid://shopify/BasicEvent/625930779",
"message": "Product was deleted: Dandy Googles (Blue).",
"action": "destroy",
"subjectType": "PRODUCT",
"subject": {
"__typename": "Product"
}
}
}
]
}
}
}
### Retrieve the first 10 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 { events(query: \\\"created_at:>=2024-01-01\\\", first: 10) { edges { node { id message createdAt } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n events(query: \"created_at:>=2024-01-01\", first: 10) {\n edges {\n node {\n id\n message\n createdAt\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 events(query: \"created_at:>=2024-01-01\", first: 10) {\n edges {\n node {\n id\n message\n createdAt\n }\n }\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 events(query: \"created_at:>=2024-01-01\", first: 10) {\n edges {\n node {\n id\n message\n createdAt\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n events(query: \"created_at:>=2024-01-01\", first: 10) {\n edges {\n node {\n id\n message\n createdAt\n }\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"events": {
"edges": [
{
"node": {
"id": "gid://shopify/BasicEvent/20851159",
"message": "Tax amount was updated from $22.36 USD to $19.85 USD.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/31716108",
"message": "bob bobsen approved an order cancellation processed by limitedaccessbob bobsen on Point of Sale.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/132778104",
"message": "Unknown event Order#access_order_fulfillment_approval...",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/155674255",
"message": "This customer's orders were added to Montreal.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/197669626",
"message": "Order #1002 was created from this draft order.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/NotificationSentEvent/233139490",
"message": "An invoice was sent to Bob Bobsen (bobsburgers@example.net).",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/254468230",
"message": "Order #1001 was created from this draft order.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/272432974",
"message": "Payment reminder email was sent to bob@example.com.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/381046666",
"message": "This customer's orders were removed from Montreal.",
"createdAt": "2024-11-07T15:11:35Z"
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/458992081",
"message": "Order covered by the Shop Promise guarantee.",
"createdAt": "2024-11-07T15:11:35Z"
}
}
]
}
}
}
### Retrieve the first 10 events for products 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 { events(query: \\\"comments:1 AND subject_type:'\\''PRODUCT'\\''\\\", first: 10) { edges { node { id message ... on CommentEvent { rawMessage } ... on BasicEvent { action subjectType subject { __typename } } } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query {\n events(query: \"comments:1 AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on CommentEvent {\n rawMessage\n }\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\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 events(query: \"comments:1 AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on CommentEvent {\n rawMessage\n }\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }\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 events(query: \"comments:1 AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on CommentEvent {\n rawMessage\n }\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query {\n events(query: \"comments:1 AND subject_type:'PRODUCT'\", first: 10) {\n edges {\n node {\n id\n message\n ... on CommentEvent {\n rawMessage\n }\n ... on BasicEvent {\n action\n subjectType\n subject {\n __typename\n }\n }\n }\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"events": {
"edges": [
{
"node": {
"id": "gid://shopify/BasicEvent/267851118",
"message": "",
"action": "unpublished",
"subjectType": "PRODUCT",
"subject": null
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/422690323",
"message": "bob bobsen included a product on Online Store: IPod Nano - 8GB.",
"action": "published",
"subjectType": "PRODUCT",
"subject": {
"__typename": "Product"
}
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/625930779",
"message": "Product was deleted: Dandy Googles (Blue).",
"action": "destroy",
"subjectType": "PRODUCT",
"subject": {
"__typename": "Product"
}
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/686413589",
"message": "",
"action": "create",
"subjectType": "PRODUCT",
"subject": null
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/806005652",
"message": "bob bobsen included a product on POS Test Account: SEO Boots.",
"action": "published",
"subjectType": "PRODUCT",
"subject": {
"__typename": "Product"
}
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/836798121",
"message": "",
"action": "create",
"subjectType": "PRODUCT",
"subject": null
}
},
{
"node": {
"id": "gid://shopify/BasicEvent/842889634",
"message": "",
"action": "unpublished",
"subjectType": "PRODUCT",
"subject": null
}
}
]
}
}
}
### Retrieves a list 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 EventList { events(first: 5) { nodes { id action createdAt message ... on BasicEvent { arguments subjectId subjectType additionalContent } } } }\"\n}'\n"
Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: `query EventList {\n events(first: 5) {\n nodes {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\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 EventList {\n events(first: 5) {\n nodes {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\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 EventList {\n events(first: 5) {\n nodes {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n }\n }`,\n);\n\nconst data = await response.json();\n"
Graphql query: "query EventList {\n events(first: 5) {\n nodes {\n id\n action\n createdAt\n message\n ... on BasicEvent {\n arguments\n subjectId\n subjectType\n additionalContent\n }\n }\n }\n}"
#### Graphql Input
null
#### Graphql Response
{
"data": {
"events": {
"nodes": [
{
"id": "gid://shopify/BasicEvent/9889833",
"action": "restock_line_items",
"createdAt": "2014-03-19T13:31:30Z",
"message": "bob bobsen restocked 2 line items.",
"arguments": [
2
],
"subjectId": "gid://shopify/Order/271719359",
"subjectType": "ORDER",
"additionalContent": "null"
},
{
"id": "gid://shopify/BasicEvent/12536286",
"action": "fulfillment_success",
"createdAt": "2008-06-06T12:00:00Z",
"message": "Shopify fulfilled 1 item via Mr. Drop Shipper.",
"arguments": [
"267732048",
1
],
"subjectId": "gid://shopify/Order/535108883",
"subjectType": "ORDER",
"additionalContent": "{\"root_component\":{\"type\":\"root_component\",\"content\":[{\"type\":\"list\",\"content\":[{\"type\":\"list_item\",\"content\":[{\"type\":\"text\",\"content\":\"1 × Draft - 151cm\",\"options\":{}},{\"type\":\"text\",\"content\":\" draft-151\",\"options\":{\"subdued\":true}}],\"options\":{\"large_margin\":true}}],\"options\":{\"title\":\"Items\",\"border_bottom\":true}},{\"type\":\"key_value_list\",\"content\":[{\"type\":\"key_value_pair\",\"key\":[{\"type\":\"text\",\"content\":\"Service\",\"options\":{}}],\"value\":[{\"type\":\"text\",\"content\":\"Mr. Drop Shipper\",\"options\":{}}],\"options\":{}}],\"options\":{\"title\":null}}]}}"
},
{
"id": "gid://shopify/BasicEvent/14596041",
"action": "confirmation_number_generated",
"createdAt": "2014-03-18T13:31:30Z",
"message": "Confirmation #QWE1234TF was generated for this order.",
"arguments": [
"QWE1234TF"
],
"subjectId": "gid://shopify/Order/148977776",
"subjectType": "ORDER",
"additionalContent": "null"
},
{
"id": "gid://shopify/BasicEvent/20851159",
"action": "taxes_updated",
"createdAt": "2024-11-07T15:11:35Z",
"message": "Tax amount was updated from $22.36 USD to $19.85 USD.",
"arguments": [
22.36,
19.85
],
"subjectId": "gid://shopify/Order/148977776",
"subjectType": "ORDER",
"additionalContent": "null"
},
{
"id": "gid://shopify/BasicEvent/22713642",
"action": "exchange_created",
"createdAt": "2008-06-06T12:00:00Z",
"message": "bob bobsen completed an exchange on order #1060.",
"arguments": [],
"subjectId": "gid://shopify/Order/989922345",
"subjectType": "ORDER",
"additionalContent": "null"
}
]
}
}
}