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

# Create Optimization Run

`POST /api/v1/optimization/runs`

Create a non-blocking GEPA optimization run.

Returns immediately with the run_id.  The optimization executes as a
background task.  Poll ``GET /runs/{run_id}`` for progress and results.

## Request body

- GEPAOptimizationRequest — Request body for triggering a GEPA prompt optimization run.
  - `dataset_path` string, nullable — Relative filesystem path to the dataset file.
  - `dataset_id` string, nullable — Registered dataset identifier to optimize against.
  - `program_spec` string — DSPy program specification string to optimize in module:attr form. Required when module_slug is not provided.
  - `module_slug` string, nullable — Registered module slug for server-side dispatch. When provided, program_spec is auto-resolved from the module registry.
  - `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

- OptimizationRunCreatedResponse — Response when an async optimization run is created.
  - `run_id` string, required — Unique identifier for the created run.
  - `status` string — Initial run status.

## 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-18** `1f45411d7556` — 3 breaking
  - request property `dataset_id` list-of-types was narrowed by removing types `integer` from media type `application/json`
  - the `dataset_id/anyOf[subschema #1]/` request property type changed from `integer` to `string`
  - the `run_id` response's property type changed from `integer` to `string` for status `200`
- **2026-04-14** `3044e5c4a9da` — 3 info
  - added the new optional request property `dataset_id`
  - the request property `dataset_path` became optional
  - request property `dataset_path` list-of-types was widened by adding types `null` to media type `application/json`
- **2026-04-14** `08de6302fd74` — 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/runs/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/b8ee197ef03e/schema)
