---
title: "Run Optimization"
method: POST
path: "/api/v1/optimization/run"
tags: ["optimization"]
---

# Run Optimization

`POST /api/v1/optimization/run`

Trigger a GEPA prompt optimization run.

## Request body

- GEPAOptimizationRequest — Request body for triggering a GEPA prompt optimization run.
  - `dataset_path` string, required — Path to the exported MLflow trace dataset (JSON).
  - `program_spec` string, required — DSPy program specification string to optimize in module:attr form.
  - `output_path` string, nullable — Optional filesystem path to save the optimized program.
  - `auto` 'light' | 'medium' | 'heavy' — GEPA optimization intensity level.
  - `train_ratio` number — Fraction of examples to use for training (remainder used for validation).

## Response `200`

Successful Response

- GEPAOptimizationResponse — Result payload after a GEPA optimization run completes.
  - `ok` boolean — Whether the optimization run completed successfully.
  - `optimizer` string — Optimizer backend that was used.
  - `program_spec` string, required — DSPy program specification that was optimized.
  - `train_examples` integer, required — Number of training examples used.
  - `validation_examples` integer, required — Number of validation examples used.
  - `validation_score` number, nullable — Validation score from the optimized program, when available.
  - `output_path` string, nullable — Filesystem path where the optimized program was saved.
  - `error` string, nullable — Error message when the optimization run failed.

## Other responses

- `400` — Invalid optimization parameters.
- `401` — Authentication is required or the provided token is invalid.
- `422` — Validation Error
- `503` — GEPA optimization is unavailable in this environment.

## Changes

- **2026-04-04** `8a91e4c507cc` — 1 info
  - endpoint added
- **2026-03-19** `78507b29ed8f` — 1 breaking
  - api path removed without deprecation

[Change history](https://skmtc.dev/qredence/apis/fleet-rlm/changes/api/v1/optimization/run/post.md)

---

[API](https://skmtc.dev/qredence/apis/fleet-rlm.md) · [All operations](https://skmtc.dev/qredence/apis/fleet-rlm/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/qredence/fleet-rlm/revisions/a40cafce5402/schema)
