---
title: "Update metric"
method: PUT
path: "/metrics/{metric_id}"
tags: ["Metric"]
---

# Update metric

`PUT /metrics/{metric_id}`

This endpoint allows you to update the `metadata` property on a metric. If you pass `null` for the metadata value,
it will clear any existing metadata for that invoice.

## Path parameters

- `metric_id` string, required

## Request body

- UpdateMetricRequestParams
  - `metadata` object, nullable — User-specified key/value pairs for the resource. Individual keys can be removed by setting the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to `null`.

## Response `200`

OK

- BillableMetric — The Metric resource represents a calculation of a quantity based on events. Metrics are defined by the query that transforms raw usage events into meaningful values for your customers.
  - `metadata` object, required — User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to `null`.
  - `id` string, required
  - `name` string, required
  - `description` string, nullable, required
  - `status` 'active' | 'draft' | 'archived', required
  - `item` Item, required — The Item resource represents a sellable product or good. Items are associated with all line items, billable metrics, and prices and are used for defining external sync behavior for invoices and tax calculation purposes.
    - `metadata` object, required — User specified key-value pairs for the resource. If not present, this defaults to an empty dictionary. Individual keys can be removed by setting the value to `null`, and the entire metadata mapping can be cleared by setting `metadata` to `null`.
    - `id` string, required — The Orb-assigned unique identifier for the item.
    - `name` string, required — The name of the item.
    - `created_at` string, date-time, required — The time at which the item was created.
    - `external_connections` ItemExternalConnection[], required — A list of external connections for this item, used to sync with external invoicing and tax systems.
      - `external_connection_name` union, required — The name of the external system this item is connected to.
        - 'stripe' | 'quickbooks' | 'bill.com' | 'netsuite'
        - 'taxjar' | 'avalara' | 'anrok' | 'numeral' | 'stripe_tax'
      - `external_entity_id` string, required — The identifier of this item in the external system.
    - `archived_at` string, date-time, nullable — The time at which the item was archived. If null, the item is not archived.
  - `parameter_definitions` object[], nullable
  - `sql` string, required — The SQL definition of the metric. For metrics defined via configuration rather than SQL, this is a derived SQL representation.

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `404` — Not Found
- `409` — Conflict
- `413` — Content Too Large
- `429` — Too Many Requests
- `500` — Internal Server Error

---

[API](https://skmtc.dev/withorb/apis/api-reference.md) · [All operations](https://skmtc.dev/withorb/apis/api-reference/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/withorb/api-reference/revisions/816dfe734e2e/schema)
