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

# Update Billable Metric

Allows you to update a billable metric.

## Request

<Snippet file="metric-create-request.mdx" />

<ParamField body="name" type="string" required>
  The name of the billable metric. This should be clear and concise to represent the usage you are tracking.
</ParamField>

<ParamField body="description" type="string" required>
  A detailed explanation of what the metric measures, such as the number of specific customer transactions.
</ParamField>

<ParamField body="eventName" type="string" required>
  The name of the event that triggers the metric. This event represents a customer action or transaction.
</ParamField>

<ParamField body="filterGroups" type="[]object">
  An array of filter groups used to refine which events contribute to the metric. Filters allow you to narrow down events based on specific properties.

  <Expandable title="Filter Group Properties">
    <ParamField body="operator" type="string" required>
      The logical operator for the group (e.g., "and", "or") that combines the filters.
    </ParamField>

    <ParamField body="filters" type="[]object" required>
      An array of individual filters within the group.

      <Expandable title="Filter Properties">
        <ParamField body="field" type="string" required>
          The event property to filter by.
        </ParamField>

        <ParamField body="operator" type="string" required>
          The condition to apply (e.g., "equal", "contains").
        </ParamField>

        <ParamField body="value" type="string" required>
          The value that the event property must match.
        </ParamField>
      </Expandable>
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="aggregation" type="object" required>
  The aggregation settings for the metric. This defines how event data is calculated to produce the final metric value.

  <Expandable title="Aggregation Properties">
    <ParamField body="method" type="string" required>
      The aggregation method to apply (e.g., "count", "sum", "average", "min", "max").
    </ParamField>

    <ParamField body="field" type="string" required>
      The event property to aggregate. This is used when the aggregation method requires a numeric field.
    </ParamField>
  </Expandable>
</ParamField>

## Response

<ResponseField name="id" type="string">
  The unique identifier for the metric.
</ResponseField>

<ResponseField name="description" type="string">
  A brief description of what the metric measures.
</ResponseField>

<ResponseField name="name" type="string">
  The name of the metric.
</ResponseField>

<ResponseField name="eventName" type="string">
  The event that triggers the metric.
</ResponseField>

<ResponseField name="filters" type="[]object">
  An array of filter groups applied to the metric to narrow down the events counted.

  <Expandable title="Filter Group Properties">
    <ResponseField name="operator" type="string">
      The logical operator (e.g., "and") used to combine the filters within the group.
    </ResponseField>

    <ResponseField name="filters" type="[]object">
      An array of individual filters within the group.

      <Expandable title="Filter Properties">
        <ResponseField name="field" type="string">
          The event property to filter by.
        </ResponseField>

        <ResponseField name="operator" type="string">
          The condition to apply (e.g., "equal").
        </ResponseField>

        <ResponseField name="value" type="string">
          The value that the event property must match.
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="aggregation" type="object">
  The aggregation settings that define how the events are calculated to produce the metric value.

  <Expandable title="Aggregation Properties">
    <ResponseField name="method" type="string">
      The aggregation method to apply (e.g., "sum").
    </ResponseField>

    <ResponseField name="field" type="string">
      The event property that is aggregated.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="createdAt" type="datetime">
  The timestamp when the metric was created.
</ResponseField>

<ResponseField name="updatedAt" type="datetime">
  The timestamp when the metric was last updated.
</ResponseField>

<ResponseField name="organizationID" type="string">
  The unique identifier for the organization associated with the metric.
</ResponseField>

<Snippet file="metric-create-response.mdx" />
