# Event

Events are generated by some Shopify resources when certain actions are completed, such as the creation of an article, the fulfillment of an order, or the addition of a product. By requesting events, your app can know when certain actions have occurred in the shop.

Note

The events returned by the Event resource should not be considered to be realtime. Events might not be created until a few seconds after the action occurs. In rare cases it can take up to a few minutes for some events to appear.

{{ '/api/reference/event.png' | image }}

Resources that can create events

Events are generated by the following resources:

Article events

Verb Message Description
create New article created: article_url The article was created.
destroy article_url was destroyed. The article was deleted.
published article_url was published. The article was published.
unpublished article_url was unpublished. The article was unpublished.
update article_url was updated (but its published state was not changed). The article was updated.

Blog events

Verb Message Description
create New blog created: new_blog_url The blog was created.
destroy blog_name was destroyed. The blog was deleted.
update blog_name was updated. The blog was updated.

Collection events

Verb Message Description
create New collection created: collection_url The collection was created.
destroy collection_url was destroyed. The collection was deleted.
published collection_url was published. The collection was published.
unpublished collection_url was hidden. The collection was hidden.
update collection_url was updated. The collection was updated.

Comment events

Verb Message Description
create New comment for article_url: comment_excerpt The comment was created.

Order events

Order events can be divided into the following categories:

Verb Message Description
authorization_failure The customer, unsuccessfully, tried to authorize: money_amount Authorization failed. The funds cannot be captured.
authorization_pending Authorization for money_amount is pending. Authorization failed. The funds cannot be captured.
authorization_success The customer successfully authorized us to capture: money_amount Authorization was successful and the funds are available for capture.
cancelled Order was cancelled by shop_staff_name. The order was cancelled.
capture_failure We failed to capture: money_amount The capture failed. The funds cannot be transferred to the shop.
capture_pending Capture for money_amount is pending. The capture is in process. The funds are not yet available to the shop.
capture_success We successfully captured: money_amount The capture was successful and the funds are now available to the shop.
closed Order was closed. The order was closed.
confirmed Received a new order: order_number by customer_name. The order was confirmed.
fulfillment_cancelled We cancelled number_of_line_items from being fulfilled by the third party fulfillment service. Fulfillment for one or more of the line_items failed.
fulfillment_pending We submitted number_of_line_items to the third party service. One or more of the line_items has been assigned to a third party service for fulfillment.
fulfillment_success We successfully fulfilled line_items. Fulfillment was successful for one or more line_items.
mail_sent message_type email was sent to the customer. An email was sent to the customer.
placed Order was placed. An order was placed by the customer.
re_opened Order was re-opened. The order was re-opened.
refund_failure We failed to refund money_amount. The refund failed. The funds are still with the shop.
refund_pending Refund of money_amount is still pending. THe refund is in process. The funds are still with shop.
refund_success We successfully refunded money_amount. The refund was successful. The funds have been transferred to the customer.
restock_line_items We restocked number_of_line_items. One or more of the order's line items have been restocked.
sale_failure The customer failed to pay money_amount. The sale failed. The funds are not available to the shop.
sale_pending The money_amount is pending. The sale is in process. The funds are not yet available to the shop.
sale_success We successfully captured money_amount. The sale was successful. The funds are now with the shop.
update order_number was updated. The order was updated.
void_failure We failed to void the authorization. Voiding the authorization failed. The authorization is still valid.
void_pending Authorization void is pending. Voiding the authorization is in process. The authorization is still valid.
void_success We successfully voided the authorization. Voiding the authorization was successful. The authorization is no longer valid.

Page events

Verb Message Description
create New page created: page_url The page was created.
destroy page_url was destroyed. The page was deleted.
published page_url was published. The page was published.
unpublished page_url was hidden. The page was hidden.
update page_url was updated. The page was updated.

Price rule events

Verb Message Description
create New price rule created: price_rule The price rule was created.
destroy price_rule was destroyed. The price rule was deleted.
update price_rule was updated. The price rule was updated.

Product events

Verb Message Description
create New product created: product_title The product was created.
destroy product_name was destroyed. The product was deleted.
published product_title was published. The product was published.
unpublished product_title was hidden. The product was hidden.
## Resource Properties ### Event * arguments: Refers to a certain event and its resources. * Type: x-string * Example: ["IPod Nano - 8GB"] * body: A text field containing information about the event. * Type: x-string * Example: nil * created_at: The date and time (ISO 8601 format) when the event was created. * Type: x-string * Example: "2015-04-20T08:33:57-11:00" * id: The ID of the event. * Type: x-string * Example: 164748010 * description: A human readable description of the event. * Type: x-string * Example: "Received a new order" * path: A relative URL to the resource the event is for, if applicable. * Type: x-string * Example: "/admin/orders/406514653/transactions/#1145" * message: A human readable description of the event. Can contain some HTML formatting. * Type: x-string * Example: "Received new order" * subject_id: The ID of the resource that generated the event. * Type: x-string * Example: 406514653 * subject_type:

The type of the resource that generated the event. Valid values:

* Type: x-string * Example: "Order" * verb: The type of event that occurred. Different resources generate different types of event. See the Resources section for a list of possible verbs. * Type: x-string * Example: "confirmed" ## Retrieves a list of events Retrieves a list of events. Note: This endpoint implements pagination by using links that are provided in the response header. To learn more, refer to Make paginated requests to the REST Admin API. ### Endpoint /admin/api/#{api_version}/events.json (GET) ### Parameters * api_version (required): * created_at_max: Show events created at or before this date and time. (format: 2014-04-25T16:15:47-04:00) * created_at_min: Show events created at or after this date and time. (format: 2014-04-25T16:15:47-04:00) * fields: Show only certain fields, specified by a comma-separated list of field names. * filter: Show events of certain resources, specified by a comma-separated list of resource names. * limit: The number of results to show. * since_id: Show only results after the specified ID. * verb: Show events of a certain type. ### Responses #### 200 Retrieves a list of events Examples: ##### Retrieve a list of all events for a shop Request: ``` GET /admin/api/unstable/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":164748010,"subject_id":450789469,"created_at":"2008-01-10T06:00:00-05:00","subject_type":"Order","verb":"confirmed","arguments":["#1001","Bob Norman"],"body":null,"message":"Received new order #1001 by Bob Norman.","author":"Shopify","description":"Received new order #1001 by Bob Norman.","path":"/admin/orders/450789469"},{"id":365755215,"subject_id":632910392,"created_at":"2008-01-10T07:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Nano - 8GB"],"body":null,"message":"Product was created: IPod Nano - 8GB.","author":"Shopify","description":"Product was created: IPod Nano - 8GB.","path":"/admin/products/632910392"},{"id":677313116,"subject_id":921728736,"created_at":"2008-01-10T08:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Touch 8GB"],"body":null,"message":"Product was created: IPod Touch 8GB.","author":"Shopify","description":"Product was created: IPod Touch 8GB.","path":"/admin/products/921728736"}]} ``` ##### Retrieve a list of all events from a specific order Request: ``` GET /admin/api/unstable/orders/450789469/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":103105390,"subject_id":450789469,"created_at":"2008-01-10T05:00:00-05:00","subject_type":"Order","verb":"authorization_success","arguments":["389404469","210.94","USD"],"body":null,"message":"A transaction was authorized.","author":"Shopify","description":"A transaction was authorized.","path":"/admin/orders/450789469"},{"id":164748010,"subject_id":450789469,"created_at":"2008-01-10T06:00:00-05:00","subject_type":"Order","verb":"confirmed","arguments":["#1001","Bob Norman"],"body":null,"message":"Received new order #1001 by Bob Norman.","author":"Shopify","description":"Received new order #1001 by Bob Norman.","path":"/admin/orders/450789469"},{"id":852065041,"subject_id":450789469,"created_at":"2008-01-10T09:00:00-05:00","subject_type":"Order","verb":"placed","arguments":[],"body":null,"message":"This order was created for Bob Norman from draft order #D1.","author":"Shopify","description":"This order was created for Bob Norman from draft order #D1.","path":"/admin/orders/450789469"}]} ``` ##### Retrieve a list of all events related to products and orders Request: ``` GET /admin/api/unstable/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":164748010,"subject_id":450789469,"created_at":"2008-01-10T06:00:00-05:00","subject_type":"Order","verb":"confirmed","arguments":["#1001","Bob Norman"],"body":null,"message":"Received new order #1001 by Bob Norman.","author":"Shopify","description":"Received new order #1001 by Bob Norman.","path":"/admin/orders/450789469"},{"id":365755215,"subject_id":632910392,"created_at":"2008-01-10T07:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Nano - 8GB"],"body":null,"message":"Product was created: IPod Nano - 8GB.","author":"Shopify","description":"Product was created: IPod Nano - 8GB.","path":"/admin/products/632910392"},{"id":677313116,"subject_id":921728736,"created_at":"2008-01-10T08:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Touch 8GB"],"body":null,"message":"Product was created: IPod Touch 8GB.","author":"Shopify","description":"Product was created: IPod Touch 8GB.","path":"/admin/products/921728736"}]} ``` ##### Retrieve a list of events related to products that were deleted Request: ``` GET /admin/api/unstable/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[]} ``` ##### Retrieve a list of events that occured at the specified time Request: ``` GET /admin/api/unstable/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":677313116,"subject_id":921728736,"created_at":"2008-01-10T08:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Touch 8GB"],"body":null,"message":"Product was created: IPod Touch 8GB.","author":"Shopify","description":"Product was created: IPod Touch 8GB.","path":"/admin/products/921728736"}]} ``` ##### Retrieve all events after the specified ID Request: ``` GET /admin/api/unstable/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":365755215,"subject_id":632910392,"created_at":"2008-01-10T07:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Nano - 8GB"],"body":null,"message":"Product was created: IPod Nano - 8GB.","author":"Shopify","description":"Product was created: IPod Nano - 8GB.","path":"/admin/products/632910392"},{"id":677313116,"subject_id":921728736,"created_at":"2008-01-10T08:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Touch 8GB"],"body":null,"message":"Product was created: IPod Touch 8GB.","author":"Shopify","description":"Product was created: IPod Touch 8GB.","path":"/admin/products/921728736"}]} ``` ##### Retrieve all events from a specific product Request: ``` GET /admin/api/unstable/products/921728736/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":677313116,"subject_id":921728736,"created_at":"2008-01-10T08:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Touch 8GB"],"body":null,"message":"Product was created: IPod Touch 8GB.","author":"Shopify","description":"Product was created: IPod Touch 8GB.","path":"/admin/products/921728736"}]} ``` ##### Retrieve an event after a specific ID using since_id Request: ``` GET /admin/api/unstable/orders/450789469/events.json ``` Response: ``` HTTP/1.1 200 OK {"events":[{"id":852065041,"subject_id":450789469,"created_at":"2008-01-10T09:00:00-05:00","subject_type":"Order","verb":"placed","arguments":[],"body":null,"message":"This order was created for Bob Norman from draft order #D1.","author":"Shopify","description":"This order was created for Bob Norman from draft order #D1.","path":"/admin/orders/450789469"}]} ``` ## Retrieves a single event Retrieves a single event by its ID ### Endpoint /admin/api/#{api_version}/events/{event_id}.json (GET) ### Parameters * api_version (required): * event_id (required): * fields: Show only certain fields, specified by a comma-separated list of field names. ### Responses #### 200 Retrieves a single event Examples: ##### Retrieves a single event by its ID Request: ``` GET /admin/api/unstable/events/677313116.json ``` Response: ``` HTTP/1.1 200 OK {"event":{"id":677313116,"subject_id":921728736,"created_at":"2008-01-10T08:00:00-05:00","subject_type":"Product","verb":"create","arguments":["IPod Touch 8GB"],"body":null,"message":"Product was created: IPod Touch 8GB.","author":"Shopify","description":"Product was created: IPod Touch 8GB.","path":"/admin/products/921728736"}} ``` ## Retrieves a count of events Retrieves a count of events ### Endpoint /admin/api/#{api_version}/events/count.json (GET) ### Parameters * api_version (required): * created_at_max: Count only events created at or before this date and time. (format: 2014-04-25T16:15:47-04:00) * created_at_min: Count only events created at or after this date and time. (format: 2014-04-25T16:15:47-04:00) ### Responses #### 200 Retrieves a count of events Examples: ##### Count all events Request: ``` GET /admin/api/unstable/events/count.json ``` Response: ``` HTTP/1.1 200 OK {"count":3} ``` ##### Count of the number of events since a particular time Request: ``` GET /admin/api/unstable/events/count.json ``` Response: ``` HTTP/1.1 200 OK {"count":1} ```