Events

Events are a log of changes in API object state. Use them to handle asynchronous updates from Bias in your application code.

The Event object

Name
object
Type
"event",
Description
Literal representing the object’s type.
Name
id
Type
string,
Description
Unique identifier for the object.
Name
live
Type
boolean,
Description
Has the value true if the object exists in a production environment or the value false if the object exists in a sandbox environment.
Name
created_at
Type
integer,
Description
Time at which the object was created. Measured in milliseconds since the Unix epoch.
Name
previous_state
Type
CheckoutSession, Customer, Dispute, File, Payment, PaymentMethod, or Refund or null,
Description
The full object state before the event occurred.
Name
request
Type
string or empty object or null,
Description
Expandable. The request, if any, that triggered the event.
Name
state
Type
CheckoutSession, Customer, Dispute, File, Payment, PaymentMethod, or Refund or null,
Description
The full object state after the event occurred.
Name
type
Type
enum,
Description
The type of event that occurred. Follows the format of object.action.
Array item properties

The Event object

{
  "object": "event",
  "live": false,
  "id": "event_I4WDb42QLgdAVoESZlGJY3",
  "created_at": 1750000000000,
  "state": {
    "object": "customer",
    "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "live": false,
    "created_at": 1750000000000,
    "name": "John Doe",
    "email": "john@bias.dev",
    "phone": null,
    "metadata": {}
  },
  "previous_state": null,
  "request": "req_N6uUqAC2SFJmLKvAQbcEn3",
  "type": "customer.created"
}

Get a event

Retrieve a event by its ID.

Optional parameters

Name
expand
Type
empty object,
Description
Optional object that allows you to expand certain ID fields to include related resources.
Child properties

Returns

Returns the event object.

Retrieve a event

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

Response example

{
  "object": "event",
  "live": false,
  "id": "event_I4WDb42QLgdAVoESZlGJY3",
  "created_at": 1750000000000,
  "state": {
    "object": "customer",
    "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
    "live": false,
    "created_at": 1750000000000,
    "name": "John Doe",
    "email": "john@bias.dev",
    "phone": null,
    "metadata": {}
  },
  "previous_state": null,
  "request": "req_N6uUqAC2SFJmLKvAQbcEn3",
  "type": "customer.created"
}

List all events

Retrieve a paginated list of events.

Optional parameters

Name
expand
Type
empty object,
Child properties
Name
ending_before
Type
string,
Name
starting_after
Type
string,
Name
limit
Type
number, at least 1, at most 1000, default is 50
Description
Maximum number of objects to return.
Name
await
Type
boolean,
Name
filters
Type
,
Description
Filters to apply to the list. Combine multiple conditions with and and or.
Child 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": "event_I4WDb42QLgdAVoESZlGJY3",
      "created_at": 1750000000000,
      "state": {
        "object": "customer",
        "id": "cus_aB4DEXqbFGOlpEOxwp0Fx1",
        "live": false,
        "created_at": 1750000000000,
        "name": "John Doe",
        "email": "john@bias.dev",
        "phone": null,
        "metadata": {}
      },
      "previous_state": null,
      "request": "req_N6uUqAC2SFJmLKvAQbcEn3",
      "type": "customer.created"
    }
  ],
  "has_more": false
}