---
title: "Export session as GEPA dataset"
method: POST
path: "/api/v1/sessions/{session_id}/export"
tags: ["sessions"]
---

# Export session as GEPA dataset

`POST /api/v1/sessions/{session_id}/export`

Convert a session's turn history into a JSONL dataset suitable for GEPA optimization. Requires a target module slug to determine the column mapping.

## Path parameters

- `session_id` string, required — Identifier of the session to export as a dataset.

## Request body

- SessionExportRequest — Request body for exporting a session's turns as a GEPA training dataset.
  - `module_slug` string, required — Target GEPA module slug whose dataset keys determine the export column mapping.

## Response `200`

Successful Response

- DatasetResponse — Metadata for a registered dataset.
  - `id` string, required — Unique dataset identifier.
  - `name` string, required — Human-readable dataset name.
  - `row_count` integer, required — Number of rows/examples in the dataset.
  - `format` string, required — File format (json or jsonl).
  - `module_slug` string, nullable — Associated module slug, when provided.
  - `created_at` string, required — ISO-8601 creation timestamp.

## Other responses

- `400` — Invalid export parameters.
- `401` — Authentication is required or the provided token is invalid.
- `403` — The caller does not have permission to access this resource.
- `404` — Session not found.
- `422` — Validation Error
- `503` — Session services are unavailable because server startup is incomplete.

## Changes

- **2026-05-23** `6178f925cdec` — 1 breaking, 3 info
  - the `detail` response's property type changed from `array` to no type for status `422`
  - added `subschema #1, subschema #2` to the `detail` response property `anyOf` list for the response status `422`
  - added the required property `code` to the response with the `422` status
  - added the required property `message` to the response with the `422` status
- **2026-04-23** `cef6d48edfbe` — 5 info
  - added the non-success response with the status `400`
  - added the non-success response with the status `401`
  - added the non-success response with the status `403`
  - added the non-success response with the status `404`
  - …1 more
- **2026-04-18** `1f45411d7556` — 1 breaking, 1 info
  - the `id` response's property type changed from `integer` to `string` for status `200`
  - for the `path` request parameter `session_id`, the type was generalized from `integer` to `string`
- **2026-04-14** `3044e5c4a9da` — 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/sessions/:session_id/export/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/e25aaded81b9/schema)
