---
title: "Update Rule"
method: PATCH
path: "/api/v1/runs/rules/{rule_id}"
tags: ["run"]
---

# Update Rule

`PATCH /api/v1/runs/rules/{rule_id}`

Update a run rule.

## Path parameters

- `rule_id` string, uuid, required

## Request body

- RunRulesUpdateSchema
  - `display_name` string, required
  - `session_id` string, uuid, nullable
  - `is_enabled` boolean
  - `dataset_id` string, uuid, nullable
  - `sampling_rate` number, required
  - `filter` string, nullable
  - `trace_filter` string, nullable
  - `tree_filter` string, nullable
  - `backfill_from` string, date-time, nullable
  - `use_corrections_dataset` boolean
  - `num_few_shot_examples` integer, nullable
  - `extend_only` boolean
  - `transient` boolean
  - `add_to_annotation_queue_id` string, uuid, nullable
  - `add_to_dataset_id` string, uuid, nullable
  - `add_to_dataset_prefer_correction` boolean
  - `evaluators` EvaluatorTopLevel[], nullable
    - `structured` EvaluatorStructuredOutput, required — Evaluator structured output schema.
      - `hub_ref` string, nullable
      - `prompt` array[], nullable
        - unknown[]
          - unknown
      - `template_format` string, nullable
      - `schema` object, nullable
      - `variable_mapping` object, nullable
      - `model` object, nullable
  - `code_evaluators` CodeEvaluatorTopLevel[], nullable
    - `code` string, required
    - `language` 'python' | 'javascript'
  - `evaluator_id` string, uuid, nullable
  - `alerts` RunRulesPagerdutyAlertSchema[], nullable
    - `type` 'pagerduty' — Enum for alert types.
    - `routing_key` string, required
    - `summary` string, nullable
    - `severity` 'critical' | 'warning' | 'error' | 'info' — Enum for severity.
  - `webhooks` RunRulesWebhookSchema[], nullable
    - `url` string, required
    - `headers` object, nullable
  - `evaluator_version` integer, nullable
  - `create_alignment_queue` boolean
  - `include_extended_stats` boolean
  - `group_by` 'thread_id', nullable
  - `spend_limit` RunRuleSpendLimitSchemaInput
    - `limit_usd` union, required
      - number
      - string
    - `window` 'weekly', required

## Response `200`

Successful Response

- RunRulesSchema — Run rules schema.
  - `id` string, uuid, required
  - `tenant_id` string, uuid, required
  - `is_enabled` boolean
  - `session_id` string, uuid, nullable
  - `session_name` string, nullable
  - `dataset_id` string, uuid, nullable
  - `dataset_name` string, nullable
  - `display_name` string, required
  - `sampling_rate` number, required
  - `filter` string, nullable
  - `trace_filter` string, nullable
  - `tree_filter` string, nullable
  - `add_to_annotation_queue_id` string, uuid, nullable
  - `add_to_annotation_queue_name` string, nullable
  - `add_to_dataset_id` string, uuid, nullable
  - `add_to_dataset_name` string, nullable
  - `add_to_dataset_prefer_correction` boolean
  - `corrections_dataset_id` string, uuid, nullable
  - `use_corrections_dataset` boolean
  - `num_few_shot_examples` integer, nullable
  - `evaluators` EvaluatorTopLevel[], nullable
    - `structured` EvaluatorStructuredOutput, required — Evaluator structured output schema.
      - `hub_ref` string, nullable
      - `prompt` array[], nullable
        - unknown[]
          - unknown
      - `template_format` string, nullable
      - `schema` object, nullable
      - `variable_mapping` object, nullable
      - `model` object, nullable
  - `code_evaluators` CodeEvaluatorTopLevel[], nullable
    - `code` string, required
    - `language` 'python' | 'javascript'
  - `alerts` RunRulesPagerdutyAlertSchema[], nullable
    - `type` 'pagerduty' — Enum for alert types.
    - `routing_key` string, required
    - `summary` string, nullable
    - `severity` 'critical' | 'warning' | 'error' | 'info' — Enum for severity.
  - `webhooks` RunRulesWebhookSchema[], nullable, required
    - `url` string, required
    - `headers` object, nullable
  - `extend_only` boolean
  - `include_extended_stats` boolean
  - `created_at` string, date-time, required
  - `updated_at` string, date-time, required
  - `backfill_from` string, date-time, nullable
  - `backfill_id` string, uuid, nullable
  - `backfill_status` string, nullable
  - `backfill_progress` number, nullable
  - `backfill_error` string, nullable
  - `backfill_completed_at` string, date-time, nullable
  - `transient` boolean
  - `evaluator_version` integer, required
  - `evaluator_id` string, uuid, nullable
  - `alignment_annotation_queue_id` string, uuid, nullable
  - `group_by` 'thread_id', nullable
  - `spend_limit` RunRuleSpendLimitSchemaOutput
    - `limit_usd` string, required
    - `window` 'weekly', required

## Other responses

- `422` — Validation Error

## Changes

- **2026-05-27** `a0acb3a6a101` — 1 breaking, 3 info
  - removed `#/components/schemas/RunRuleSpendLimitSchema` from the `spend_limit` request property `anyOf` list
  - added the new optional request property `group_by`
  - added `#/components/schemas/RunRuleSpendLimitSchema-Input` to the `spend_limit` request property `anyOf` list
  - added the optional property `spend_limit` to the response with the `200` status
- **2026-05-01** `0480571f80d7` — 1 info
  - added the new optional request property `spend_limit`
- **2026-04-13** `e86be67718ee` — 1 info
  - added the optional property `backfill_id` to the response with the `200` status
- **2026-03-19** `7bbcecd856b2` — 4 warning
  - removed the optional property `backfill_completed_at` from the response with the `200` status
  - removed the optional property `backfill_error` from the response with the `200` status
  - removed the optional property `backfill_progress` from the response with the `200` status
  - removed the optional property `backfill_status` from the response with the `200` status
- **2026-03-10** `9ca78cc32184` — 4 info
  - added the optional property `backfill_completed_at` to the response with the `200` status
  - added the optional property `backfill_error` to the response with the `200` status
  - added the optional property `backfill_progress` to the response with the `200` status
  - added the optional property `backfill_status` to the response with the `200` status

[Change history](https://skmtc.dev/langchain-ai/apis/langsmith/changes/api/v1/runs/rules/:rule_id/patch.md)

---

[API](https://skmtc.dev/langchain-ai/apis/langsmith.md) · [All operations](https://skmtc.dev/langchain-ai/apis/langsmith/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/langchain-ai/langsmith/revisions/a0acb3a6a101/schema)
