Events

Bias records an event when something happens to an object in your account, such as a bank debit succeeding or a subscription being canceled. The event holds the object before and after the change, in previous_state and state. Bias doesn’t send webhooks. Applications stream events to react as they happen.

The Event object

Name
object
Type
"event",
Description
The object's type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
true if the object is live, or false if it's in a sandbox.
Name
created_at
Type
integer,
Description
When the object was created, in milliseconds since the Unix epoch.
Name
context
Type
or null,
Description
Details about the event, such as the email address an invoice was sent to.
Properties
Name
previous_state
Type
CheckoutSession, CreditNote, Customer, CustomerBalanceTransaction, Discount, AppliedDiscount, Dispute, File, Invoice, Payment, PaymentMethod, Price, Product, Refund, ShippingRate, Subscription, or Mandate or null,
Description
The object before the event, for events that change an existing object.
Properties
Name
request
Type
string or object or null,
Description
Expandable. The request that caused the event.
Properties
Name
state
Type
CheckoutSession, CreditNote, Customer, CustomerBalanceTransaction, Discount, AppliedDiscount, Dispute, File, Invoice, Payment, PaymentMethod, Price, Product, Refund, ShippingRate, Subscription, or Mandate or null,
Description
The object after the event.
Properties
Name
type
Type
EventType,
Description
The event's type, in the form object.action.
Properties

The Event object

{
  "object": "event",
  "live": false,
  "id": "evt_I4WDb42QLgdAVoESZlGJY3",
  "created_at": 1750000600000,
  "state": {
    "object": "customer",
    "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "live": false,
    "created_at": 1750000000000,
    "updated_at": 1750000600000,
    "deleted": false,
    "name": "John Doe",
    "email": "john@bias.dev",
    "phone": "+14155550123",
    "shipping_details": null,
    "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
    "balance": 0,
    "external_sync": null,
    "metadata": {}
  },
  "previous_state": {
    "object": "customer",
    "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "live": false,
    "created_at": 1750000000000,
    "updated_at": 1750000000000,
    "deleted": false,
    "name": "John Doe",
    "email": "john@bias.dev",
    "phone": null,
    "shipping_details": null,
    "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
    "balance": 0,
    "external_sync": null,
    "metadata": {}
  },
  "request": "req_N6uUqAC2SFJmLKvAQbcEn3",
  "type": "customer.updated",
  "context": null
}

Get an event

Retrieve an event by its ID.

Required parameters

Name
id
Type
string,
Description
The ID of the event to retrieve.

Optional parameters

Name
expand
Type
object,
Description
Related objects to expand in the response.
Properties

Returns

Returns the event object.

Retrieve an event

const event = await bias.events.get("id");

Response example

{
  "object": "event",
  "live": false,
  "id": "evt_I4WDb42QLgdAVoESZlGJY3",
  "created_at": 1750000600000,
  "state": {
    "object": "customer",
    "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "live": false,
    "created_at": 1750000000000,
    "updated_at": 1750000600000,
    "deleted": false,
    "name": "John Doe",
    "email": "john@bias.dev",
    "phone": "+14155550123",
    "shipping_details": null,
    "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
    "balance": 0,
    "external_sync": null,
    "metadata": {}
  },
  "previous_state": {
    "object": "customer",
    "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "live": false,
    "created_at": 1750000000000,
    "updated_at": 1750000000000,
    "deleted": false,
    "name": "John Doe",
    "email": "john@bias.dev",
    "phone": null,
    "shipping_details": null,
    "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
    "balance": 0,
    "external_sync": null,
    "metadata": {}
  },
  "request": "req_N6uUqAC2SFJmLKvAQbcEn3",
  "type": "customer.updated",
  "context": null
}

List all events

Retrieve a paginated list of events, most recently created first. With stream: true, the response stays open and streams each matching event as it’s created.

Event types lists every type.

Optional parameters

Name
expand
Type
object,
Description
Related objects to expand in the response.
Properties
Name
ending_before
Type
string,
Description
The ID of the object to list before, for pagination.
Name
starting_after
Type
string,
Description
The ID of the object to list after, for pagination.
Name
limit
Type
integer, at least 1, at most 1000, default is 50
Description
The maximum number of objects to return, from 1 to 1000. Defaults to 50.
Name
stream
Type
boolean,
Description
Streams matching events as they're created, as newline-separated event objects.
Name
filters
Type
object, object, or object,
Description
Filters for the list, combined with and and or.
Properties

Returns

Returns a list of event objects.

List all events

const event = await bias.events.list();

Response example

{
  "object": "list",
  "items": [
    {
      "object": "event",
      "live": false,
      "id": "evt_I4WDb42QLgdAVoESZlGJY3",
      "created_at": 1750000600000,
      "state": {
        "object": "customer",
        "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
        "live": false,
        "created_at": 1750000000000,
        "updated_at": 1750000600000,
        "deleted": false,
        "name": "John Doe",
        "email": "john@bias.dev",
        "phone": "+14155550123",
        "shipping_details": null,
        "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
        "balance": 0,
        "external_sync": null,
        "metadata": {}
      },
      "previous_state": {
        "object": "customer",
        "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
        "live": false,
        "created_at": 1750000000000,
        "updated_at": 1750000000000,
        "deleted": false,
        "name": "John Doe",
        "email": "john@bias.dev",
        "phone": null,
        "shipping_details": null,
        "default_payment_method": "pm_VQ9SaYquIZTG2l0uRsmUr4",
        "balance": 0,
        "external_sync": null,
        "metadata": {}
      },
      "request": "req_N6uUqAC2SFJmLKvAQbcEn3",
      "type": "customer.updated",
      "context": null
    }
  ],
  "has_more": true
}