---
title: Update Eval Grader (partial)
description: Rename a grader or replace its definition. Runs already scored keep the definition they ran with.
product: general
lang: en
token_estimate: 2894
---
# Update Eval Grader (partial)

## Update Eval Grader (partial)

**PATCH** `/console/v1/eval_graders/{name}`

Full URL: `https://statsigapi.net/console/v1/eval_graders/{name}`

> For AI agents: a documentation index is available at [/llms.txt](/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Update Eval Grader (partial)

Rename a grader or replace its definition. Runs already scored keep the definition they ran with.

## Authorizations

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| STATSIG-API-KEY | string | Yes | — | apiKey (header) |

## Path parameters

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name (path) | string | Yes | — | name |

## Body (application/json)

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| name | string | No | — | Constraints: min length: 1 |
| prompt | object | No | — | Replaces the whole definition when present. |
| prompt.type | string | Yes | — | label_model is an LLM judge over {{output}} (content is the rubric); string_check compares {{output}} to a dataset column with operation; text_similarity scores {{output}} against a column with evaluation_metric; python runs source. Allowed values: label_model, string_check, text_similarity, python |
| prompt.content | string | No | — | Rubric for label_model. May reference {{output}} and dataset columns. Constraints: nullable |
| prompt.operation | string | No | — | Constraints: nullable Allowed values: eq, ne, like, ilike |
| prompt.evaluation_metric | string | No | — | Similarity measure for text_similarity. Constraints: nullable Allowed values: fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, rouge_l, cosine |
| prompt.column | string | No | — | Dataset column compared against for string_check and text_similarity. Constraints: nullable |
| prompt.source | string | No | — | Python source for a python grader. Constraints: nullable |
| evalModel | string | No | — | Model that judges a `label_model` grader, such as `gpt-6.1-terra` or `claude-sonnet-5.5`. It must be one of the models AI configs offer for `evalProvider`. Other grader types ignore it. An unsupported model returns a 400. Defaults to `gpt-6.1-terra` on create; omit it on update to keep the current model. Constraints: min length: 1 |
| evalProvider | string | No | — | Provider of `evalModel`: `openai`, `anthropic` or `google`. Defaults to `openai` on create; omit it on update to keep the current provider. Constraints: min length: 1 |
| gradingRules | object[] | No | — | Replaces the grader's ordered online grading rules. Enabled rules start online grading of matching live spans without attaching the grader to a prompt or turning on Auto Eval, so changing which rules are enabled needs a project or org admin. Only graders whose definition reads just {{input}}, {{output}} and {{trajectory}} can have rules. AI config and version IDs must exist. |
| gradingRules.id | string | No | — | Omit for a new rule. Keep it to update an existing one. |
| gradingRules.enabled | boolean | Yes | — | — |
| gradingRules.conditions | object[] | Yes | — | Combined with AND. A rule with no conditions matches every span. |
| gradingRules.conditions.field | string | Yes | — | Span field to match: `ai_config` (AI config IDs, matched by the config name), `config_version` (version IDs), `environment` (`statsig.environment`), `span_name`, `agent_name` (`gen_ai.agent.name`), `model` (`gen_ai.request.model`), or `span_attribute` (the attribute named by `key`). Allowed values: ai_config, config_version, environment, span_name, agent_name, model, span_attribute |
| gradingRules.conditions.key | string | No | — | Attribute name of a `span_attribute` condition. |
| gradingRules.conditions.operator | string | Yes | — | `is` matches any of the values exactly and `is_not` matches none of them. A span without the field reads as an empty string. Allowed values: is, is_not |
| gradingRules.conditions.values | string[] | Yes | — | — |
| gradingRules.samplingRate | number | Yes | — | Percentage of matching traces to grade, from 0 to 100. Sampling is by trace ID, so every span of a trace gets the same decision. Constraints: min: 0, max: 100 |
| offlineTargets | object[] | No | — | AI configs (by aiConfigID) the grader scores in offline evals. Replaces the whole list when present. Detaching an AI config where the grader runs online is rejected; turn off online grading on the config first. |
| offlineTargets.type | string | Yes | — | Allowed values: ai_config |
| offlineTargets.aiConfigID | string | Yes | — | — |
| offlineTargets.isCritical | boolean | Yes | — | — |

## Response (application/json)

**200** — Update Eval Grader

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| message | string | Yes | — | A simple string explaining the result of the operation. |
| data | object | Yes | — | — |
| data.id | string | Yes | — | — |
| data.name | string | Yes | — | — |
| data.type | string | Yes | — | Grader type: label_model, string_check, text_similarity, python, completion_tokens, completion_latency, or logged_score. |
| data.isGlobal | boolean | Yes | — | — |
| data.prompt | oneOf | Yes | — | Constraints: object |
| data.prompt.type | string | Yes | — | Allowed values: label_model, string_check, text_similarity, python, programmatic_grader, completion_tokens, completion_latency, logged_score |
| data.prompt.content | string | No | — | — |
| data.prompt.operation | string | No | — | Allowed values: eq, ne, like, ilike |
| data.prompt.column | string | No | — | — |
| data.prompt.evaluation_metric | string | No | — | Allowed values: fuzzy_match, bleu, gleu, meteor, rouge_1, rouge_2, rouge_3, rouge_4, rouge_5, rouge_l, cosine |
| data.prompt.source | string | No | — | — |
| data.evalModel | string | Yes | — | Model that judges a `label_model` grader. Other grader types ignore it. |
| data.evalProvider | string | Yes | — | Provider of `evalModel`: `openai`, `anthropic` or `google`. |
| data.choiceScores | object | Yes | — | Constraints: nullable |
| data.gradingRules | object[] | Yes | — | Ordered online grading rules. For each span, the first enabled rule that matches decides whether the grader scores it. |
| data.gradingRules.id | string | Yes | — | — |
| data.gradingRules.enabled | boolean | Yes | — | — |
| data.gradingRules.conditions | object[] | Yes | — | Combined with AND. A rule with no conditions matches every span. |
| data.gradingRules.conditions.field | string | Yes | — | Span field to match: `ai_config` (AI config IDs, matched by the config name), `config_version` (version IDs), `environment` (`statsig.environment`), `span_name`, `agent_name` (`gen_ai.agent.name`), `model` (`gen_ai.request.model`), or `span_attribute` (the attribute named by `key`). Allowed values: ai_config, config_version, environment, span_name, agent_name, model, span_attribute |
| data.gradingRules.conditions.key | string | No | — | Attribute name of a `span_attribute` condition. |
| data.gradingRules.conditions.operator | string | Yes | — | `is` matches any of the values exactly and `is_not` matches none of them. A span without the field reads as an empty string. Allowed values: is, is_not |
| data.gradingRules.conditions.values | string[] | Yes | — | — |
| data.gradingRules.samplingRate | number | Yes | — | Percentage of matching traces to grade, from 0 to 100. Sampling is by trace ID, so every span of a trace gets the same decision. Constraints: min: 0, max: 100 |
| data.offlineTargets | object[] | Yes | — | AI configs the grader scores in offline evals. A version evaluation of an AI config runs its graders. Graders for an eval run on a dataset are picked per run. |
| data.offlineTargets.type | string | Yes | — | Allowed values: ai_config |
| data.offlineTargets.aiConfigID | string | Yes | — | — |
| data.offlineTargets.isCritical | boolean | Yes | — | — |
| data.createdTime | number | Yes | — | Constraints: format: double |
| data.lastModifiedTime | number | Yes | — | Constraints: format: double |

```json
{
  "message": "string",
  "data": {
    "id": "string",
    "name": "string",
    "type": "string",
    "isGlobal": true,
    "prompt": {
      "type": "label_model",
      "content": "string"
    },
    "evalModel": "string",
    "evalProvider": "string",
    "choiceScores": {},
    "gradingRules": [
      {
        "id": "string",
        "enabled": true,
        "conditions": [
          {
            "field": "ai_config",
            "key": "string",
            "operator": "is",
            "values": [
              "string"
            ]
          }
        ],
        "samplingRate": 0
      }
    ],
    "offlineTargets": [
      {
        "type": "ai_config",
        "aiConfigID": "string",
        "isCritical": true
      }
    ],
    "createdTime": 0,
    "lastModifiedTime": 0
  }
}
```

**404** — Not Found. The requested resource could not be found.

| Name | Type | Required | Default | Description |
| --- | --- | --- | --- | --- |
| status | integer | Yes | — | Allowed values: 404 |
| message | string | Yes | — | — |

```json
{
  "status": 404,
  "message": "Not Found. The requested resource could not be found."
}
```

## Code samples

### cURL

```bash
curl -X PATCH "https://statsigapi.net/console/v1/eval_graders/{name}" \
  -H "Content-Type: application/json" \
  -H "STATSIG-API-KEY: YOUR_API_KEY"
```

### Python

```python
import requests

response = requests.patch(
    "https://statsigapi.net/console/v1/eval_graders/{name}",
    headers={
        "Content-Type": "application/json",
        "STATSIG-API-KEY": "YOUR_API_KEY"
    }
)
data = response.json()
```

### JavaScript

```javascript
const response = await fetch("https://statsigapi.net/console/v1/eval_graders/{name}", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    "STATSIG-API-KEY": "YOUR_API_KEY"
  }
});
const data = await response.json();
```

### PHP

```php
<?php
$ch = curl_init("https://statsigapi.net/console/v1/eval_graders/{name}");
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "PATCH");
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Content-Type: application/json",
    "STATSIG-API-KEY: YOUR_API_KEY"
]);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);
curl_close($ch);
```

### Go

```go
package main

import (
  "bytes"
  "net/http"
)

func main() {
req, _ := http.NewRequest("PATCH", "https://statsigapi.net/console/v1/eval_graders/{name}", nil)
req.Header.Set("Content-Type", "application/json")
req.Header.Set("STATSIG-API-KEY", "YOUR_API_KEY")
  client := &http.Client{}
  resp, _ := client.Do(req)
  defer resp.Body.Close()
}
```

### Java

```java
HttpClient client = HttpClient.newHttpClient();
HttpRequest request = HttpRequest.newBuilder()
      .uri(URI.create("https://statsigapi.net/console/v1/eval_graders/{name}"))
      .method("PATCH", HttpRequest.BodyPublishers.noBody())
.header("Content-Type", "application/json")
      .header("STATSIG-API-KEY", "YOUR_API_KEY")
      .build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
```

### Ruby

```ruby
require "net/http"
require "json"

uri = URI("https://statsigapi.net/console/v1/eval_graders/{name}")
request = Net::HTTP::Patch.new(uri)
request["Content-Type"] = "application/json"
request["STATSIG-API-KEY"] = "YOUR_API_KEY"
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
  http.request(request)
end
```

