---
title: "Optimize Metric Prompt With Diff"
method: POST
path: "/v1/optimize/metric-prompt-with-diff"
tags: ["Optimize"]
---

# Optimize Metric Prompt With Diff

`POST /v1/optimize/metric-prompt-with-diff`

Optimize a metric prompt using human vs AI evaluation comparisons.
evaluation_diffs is required and must not be empty.

## Headers

- `X-API-Key` string, required

## Request body

- OptimizeMetricPromptWithDiffRequest — Request body for optimizing a metric prompt using evaluation diffs.
  - `name` string, required — The name of the custom metric to optimize.
  - `prompt` string, required — The current evaluation system prompt to optimize.
  - `additional_instructions` string, nullable — Additional instructions for the optimization.
  - `evaluation_diffs` EvaluationDiffItem[], nullable — List of human vs AI evaluation comparisons. Required and must not be empty.
    - `call_id` string, nullable — Call ID for call conversations.
    - `test_result_id` integer, nullable — Test result ID for test_result conversations.
    - `human_value` string, nullable — Human evaluator's response (e.g. Pass/Fail, score).
    - `ai_value` string, nullable — AI evaluator's response.
    - `human_reasoning` string, nullable — Human evaluator's reasoning.
    - `ai_reasoning` string, nullable — AI evaluator's reasoning.
  - `diff_prompt` string, nullable — System/instruction for how to use evaluation_diffs. If omitted, a default is used.

## Response `200`

Successful Response

- OptimizeMetricPromptResponse — Response containing the optimized prompt.
  - `optimized_prompt` string, required — The optimized version of the custom metric prompt.

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/getbluejay/apis/bluejay-api.md) · [All operations](https://skmtc.net/getbluejay/apis/bluejay-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/getbluejay/bluejay-api/versions/f48cef80963f/schema)
