---
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.

---

[API](https://skmtc.net/qredence/apis/fleet-rlm.md) · [All operations](https://skmtc.net/qredence/apis/fleet-rlm/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/qredence/fleet-rlm/versions/62e8c152aa18/schema)
