> ## Documentation Index
> Fetch the complete documentation index at: https://docs.methodfi.com/llms.txt
> Use this file to discover all available pages before exploring further.

# The event endpoint

export const ParamList = ({items = [], is_child = false}) => {
  return items.map(item => {
    const field_props = {
      id: Math.random().toString(),
      body: item.name,
      name: item.name,
      type: item.type,
      required: item.required
    };
    const enums = item.enums || [];
    const items = item.items || [];
    const has_items = items?.length > 0;
    const has_enums = enums?.length > 0;
    const should_default_open = item.defaultOpen || false;
    const render_child_item = () => {
      const child_props = {
        title: has_enums ? "Possible enum values" : "properties"
      };
      if (should_default_open) child_props.defaultOpen = true;
      const has_inline_enums = has_enums && enums.every(enum_item => typeof enum_item === 'string') && enums.map((enum_item, idx) => {
        const is_last = idx === enums.length - 1;
        const is_2nd_to_last = idx === enums.length - 2;
        return <>
            <code>{enum_item}</code>
            {is_last && ''}
            {is_2nd_to_last && ' or '}
            {!is_last && !is_2nd_to_last && ', '}
          </>;
      });
      const enum_list = has_enums && !has_inline_enums && <Accordion {...child_props}>
          {enums.map((enum_item, index) => <div key={`enum-${index}`}>
              <code>{enum_item.name}</code>
              <br />
              <p>{enum_item.description}</p>
            </div>)}
        </Accordion>;
      const item_list = has_items && <Expandable {...child_props}>
          <ParamList items={items || []} is_child />
        </Expandable>;
      return <>
          <p>
            {item.description}
            {has_inline_enums && [has_inline_enums.length > 1 ? ' One of ' : ' Must be ', ...has_inline_enums]}
          </p>

          {enum_list}
          {item_list}
        </>;
    };
    return is_child ? <ResponseField {...field_props}>{render_child_item()}</ResponseField> : <ParamField {...field_props}>{render_child_item()}</ParamField>;
  });
};

The Events API allows you to track both literal and computed changes to various Method resources, such as Attributes, Accounts, Credit Scores, and more. Events provide detailed insights into how data changes over time, helping teams monitor resource updates and interpret complex changes.

Literal events track specific updates to a resource. For example, if an account's status transitions from `active` to `closed`, an `account.closed` event will be triggered, showing the exact change.

Computed events are triggered when a meaningful interpretation is derived by comparing changes across multiple resources or combining several field changes. For example, the `credit_score.increased` event is triggered when a new credit score record shows an increase compared to the previous record.

## Event Objects

<ParamList
  items={[
{
name: 'id',
type: 'string',
description: 'Unique identifier for the Event.',
},
{
name: 'type',
type: 'enum',
description: 'Type of event.',
items: [
  {
    name: 'account.opened',
    description: 'An Account has been opened.',
  },
  {
    name: 'account.closed',
    description: 'An Account has been closed.',
  },
  {
    name: 'credit_score.increased',
    description: 'A user\'s credit score has increased.',
  },
  {
    name: 'credit_score.decreased',
    description: 'A user\'s credit score has decreased.',
  },
  {
    name: 'entity_attribute.credit_health_credit_card_usage.increased',
    description: 'Credit card usage has increased.',
  },
  {
    name: 'entity_attribute.credit_health_credit_card_usage.decreased',
    description: 'Credit card usage has decreased.',
  },
  {
    name: 'entity_attribute.credit_health_derogatory_marks.increased',
    description: 'Number of derogatory marks increased.',
  },
  {
    name: 'entity_attribute.credit_health_derogatory_marks.decreased',
    description: 'Number of derogatory marks decreased.',
  },
  {
    name: 'entity_attribute.credit_health_hard_inquiries.increased',
    description: 'Number of hard inquiries increased.',
  },
  {
    name: 'entity_attribute.credit_health_hard_inquiries.decreased',
    description: 'Number of hard inquiries decreased.',
  },
  {
    name: 'entity_attribute.credit_health_total_accounts.increased',
    description: 'Total number of accounts increased.',
  },
  {
    name: 'entity_attribute.credit_health_total_accounts.decreased',
    description: 'Total number of accounts decreased.',
  },
  {
    name: 'entity_attribute.credit_health_credit_age.increased',
    description: 'Credit age has increased.',
  },
  {
    name: 'entity_attribute.credit_health_credit_age.decreased',
    description: 'Credit age has decreased.',
  },
  {
    name: 'entity_attribute.credit_health_payment_history.increased',
    description: 'Payment history score has improved.',
  },
  {
    name: 'entity_attribute.credit_health_payment_history.decreased',
    description: 'Payment history score has decreased.',
  },
  {
    name: 'entity_attribute.credit_health_soft_inquiries.increased',
    description: 'Number of soft inquiries increased.',
  }
]
},
{
name: 'resource_id',
type: 'string',
description: 'ID of the resource associated with the event.',
},
{
name: 'resource_type',
type: 'enum',
description: 'Type of resource',
enums: ['account', 'attribute', 'connect', 'credit_score'],
},
{
name: 'data',
type: 'object',
description: 'A snapshot of the associated resource.',
},
{
name: 'diff',
type: 'object',
description: 'An object representing the differences/changes that occurred.',
items: [
  {
    name: 'diff.before',
    type: 'object|null',
    description: 'The state before the change occurred.',
  },
  {
    name: 'diff.after',
    type: 'object|null',
    description: 'The state after the change occurred.',
  }
]
},
{
name: 'created_at',
type: 'string',
description: 'Timestamp when the event was created.',
},
{
name: 'updated_at',
type: 'string',
description: 'Timestamp when the event was last updated.',
}
]}
/>

<RequestExample>
  ```json THE EVENT OBJECT theme={null}
  {
    "id": "evt_7pPmytbXgWk7C",
    "type": "credit_score.increased",
    "resource_id": "crs_wXVk4MM7QWNnh",
    "resource_type": "credit_score",
    "data": "CreditScore",
    "diff": {
      "before": {
        "id": "crs_pn4ca33GXFaCE",
        "entity_id": "ent_au22b1fbFJbp8",
        "status": "completed",
        "scores": [
          {
            "score": 724,
            "source": "equifax",
            "model": "vantage_4",
            "factors": []
          }
        ]
      },
      "after": {
        "id": "crs_wXVk4MM7QWNnh",
        "entity_id": "ent_au22b1fbFJbp8",
        "status": "completed", 
        "scores": [
          {
            "score": 741,
            "source": "equifax",
            "model": "vantage_4",
            "factors": []
          }
        ]
      }
    },
    "updated_at": "2024-08-01T16:08:25.462Z",
    "created_at": "2024-08-01T16:08:25.462Z"
  }
  ```
</RequestExample>
