API
Admin Resources

Events

This resource allows a caller to inspect recent events in the store.

6 additions in V2, marked New

Everything marked New also works when you send X-Recharge-Version: 2021-11.

Endpoints

#The event object

Plus plan
An Event record represents an action that took place at a point in time.

Attributes

  • idinteger
    Unique numeric identifier for the Event.
  • object_idinteger
    The unique numeric identifier of the object associated with the Event.
  • The unique numeric identifier of the customer associated with the Event.
    This value can be null for events not directly associated with a customer.
  • created_atdatetime
    The date and time when the Event was created. Returned in YYYY-MM-DDTHH:MM:SS format by default; stores that have been moved to timezone-aware event timestamps receive an ISO 8601 value with a UTC offset.
  • The resource type of the object associated with the Event, e.g. 'customer' or 'subscription'
  • verbstring
    The action describing the Event, e.g. 'created' or 'updated'
  • The short description that summarizes the Event.
  • updated_attributesarray of objects
    A list of objects describing attributes that were changed during the Event.
    Show child attributesHide child attributes3
    • attributestring
      The key of an attribute updated on the object during this Event.
    • The previous value of the updated attribute.
    • valuestring
      The new value of the updated attribute.
  • sourceobject
    An object containing details about the origin of the Event.
    Show child attributesHide child attributes6
    • account_idinteger
      If the event resulted from action by a Store Admin, the account id of the store admin.
    • If the event resulted from action by an external API call, the primary key of the API token used to take the action.
    • If the event resulted from action by an external API call, the name of the API token used to take the action, as it is saved in Recharge Merchant Admin portal.
    • If the event resulted from action by a Store Admin, the email associated with the store admin account.
    • originstring
      The origin of the event, e.g. 'api', 'customer_portal', 'merchant_portal', 'recharge_process'
      Possible values
      apicustomer_portalexternal_platformmerchant_portalrecharge_process
    • user_typestring
      The type of user who initiated the event, e.g. 'customer', 'store_admin', 'recharge_admin', 'recharge_process'
      Possible values
      customercustomer_smsrecharge_adminrecharge_admin_smsrecharge_order_mergerecharge_processstore_adminstore_admin_smssupport_session
  • custom_attributesarray of objects
    A list of objects passed explicitly to a Recharge API call that created the Event.
    This field will only be populated on events created using the Recharge API.
    Show child attributesHide child attributes2
    • keystring
      A user-defined key for the custom attribute associated with this Event.
    • valuestring
      A user-defined value for the custom attribute associated with this Event.
The event object
{
  "event": {
    "id": 7160141294,
    "object_id": 362310818,
    "customer_id": 36885098,
    "created_at": "2023-05-31T14:16:07",
    "object_type": "subscription",
    "verb": "updated",
    "description": "Updated subscription #362310818",
    "updated_attributes": [
      {
        "attribute": "price",
        "previous_value": "12.00",
        "value": "15.00"
      },
      {
        "attribute": "quantity",
        "previous_value": "3",
        "value": "5"
      }
    ],
    "source": {
      "account_id": null,
      "api_token_id": 987654321,
      "api_token_name": "Subscription API token",
      "account_email": null,
      "origin": "api",
      "user_type": null
    },
    "custom_attributes": [
      {
        "key": "ab_testing_flag",
        "value": "a"
      }
    ]
  }
}

#List events

GET/events
Plus plan
Returns all events associated with the store. The Events API is limited to events that occurred in the last 7 days
Scoperead_events
Granting the read_events scope to a token will expose some details about other Recharge API resources via the Events API.

If created_at_min is not passed (and no cursor is used) it defaults to 7 days ago. A created_at_min older than the store's lookback window (7 days by default) returns 422. The response includes next_cursor and previous_cursor.

Query parameters

  • Show events that occurred after a certain date
  • Show events that occurred before a certain date
  • Filter events by specific object_type, such as address, customer, or subscription.

    For a full list of available object types, refer to the list below.
    Possible values
    addressaddress/payment_methodaddress_payment_methodappasync_batchbundle_productbundle_selectioncancellation_flowchargecheckoutcollectioncollection_productcredit_accountcredit_adjustmentcustomerdelivery_profilediscountemailfraud_investigationmembershipmembership_programmembership_program_conditionmonthly_sku_swap_workflow_adapteronetimeorderpayment_methodplanproductpurchase_itemsequence_workflow_adaptershipping_window_workflow_adaptershopstoresubscriptionthemewebhookwidget_settings
  • object_idinteger
    Show events with a specific object_id. This filter should be used with the object_type filter.
  • verbsstring
    Show events with a specific verb or comma-separated list of verbs
  • Show events related to a specific customer using the customer's primary identifier
  • originstring
    Filter events by specific source origin.
    Available origins: api, customer_portal, merchant_portal, recharge_process, external_platform.
    Possible values
    apicustomer_portalexternal_platformmerchant_portalrecharge_process
  • verbstringNew
    Show events with a specific verb.
    Possible values
    activatedapply_discountcancelledcapturedchange_next_charge_datecompletedcreate_contractcreateddeactivateddelayeddeletedexpiredfailedloginmax_retries_reachednotification_activatednotification_deactivatedpaidpausedpayment_capturedpayment_method_updatedprocessedredeemedrefundrefundedremove_discountselling_plans_syncingset_next_charge_dateskippedstartedsuccessswappeduninstalledunskippedupdatedworkflow_updated
  • sort_bystringNew
    Sort order of the results. Defaults to id-desc when filtering by customer_id and to created_at-desc otherwise.
    Possible values
    id-ascid-desccreated_at-asccreated_at-desc
  • When true, customer events with the verb updated that have no updated_attributes are left out of the results.
  • limitintegerNew
    Number of results to return. Defaults to 50; the maximum is 250.
  • pageintegerNew
    Page to show. Cannot be greater than 300. Page-based pagination can be disabled for a token, in which case cursors must be used.
  • cursorstringNew
    Return either the next or previous page of events using the next_cursor or previous_cursor value from a previous response. When cursor is passed, only limit may be passed with it.
GET/events
curl 'https://api.rechargeapps.com/events?limit=3' \
  -H 'X-Recharge-Version: v2' \
  -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "events": [
    {
      "id": 7160141294,
      "object_id": 362310818,
      "customer_id": 36885098,
      "created_at": "2023-05-31T14:16:07",
      "object_type": "subscription",
      "verb": "updated",
      "description": "Updated subscription #362310818",
      "updated_attributes": [
        {
          "attribute": "price",
          "previous_value": "12.00",
          "value": "15.00"
        },
        {
          "attribute": "quantity",
          "previous_value": "3",
          "value": "5"
        }
      ],
      "source": {
        "account_id": null,
        "api_token_id": 987654321,
        "api_token_name": "Subscription API token",
        "account_email": null,
        "origin": "api",
        "user_type": null
      },
      "custom_attributes": [
        {
          "key": "ab_testing_flag",
          "value": "a"
        }
      ]
    }
  ]
}