---
title: "Build Dataset Cases"
method: POST
path: "/lens/datasets/build"
tags: ["Lens"]
---

# Build Dataset Cases

`POST /lens/datasets/build`

## Request

- Base URL: `https://api.sea-lion.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.sea-lion.ai/lens/datasets/build`
- Auth: API key in header `x-litellm-api-key`

## Request body

- BuildRequest
  - `sources` union[], required
    - union
      - TraceSource
        - `kind` 'trace'
        - `trace_id` string, required
        - `trace_ref` string
        - `span_id` string
      - FindingSource
        - `kind` 'finding'
        - `lens_id` string, required
        - `finding_ids` string[], required
      - TextSource
        - `kind` 'text'
        - `text` string, required
  - `dataset_id` string

## Response `200`

Successful Response

- BuildResult
  - `cases` DatasetCase[], required
    - `id` string, required
    - `messages` DatasetMessage[], required
      - `role` 'system' | 'user' | 'assistant' | 'tool', required
      - `content` string, required
      - `name` string
      - `tool_calls` DatasetToolCall[]
        - `name` string, required
        - `arguments` string, required
    - `reply` string
    - `tool_calls` DatasetToolCall[]
      - `name` string, required
      - `arguments` string, required
    - `expected` string
    - `included` boolean
    - `source` CaseSource, required
      - `trace_id` string
      - `trace_ref` string
      - `span_id` string
      - `finding_id` string
      - `lens_id` string
    - `agent_version` string
  - `skipped` SkippedCase[], required
    - `source` CaseSource, required
      - `trace_id` string
      - `trace_ref` string
      - `span_id` string
      - `finding_id` string
      - `lens_id` string
    - `reason` 'duplicate' | 'no_content' | 'too_large' | 'over_limit' | 'invalid', required

## Other responses

- `422`: Validation Error

## Changes

- **2026-10-21** `f2fb14eab3f5`: 1 info
  - endpoint added

[Operation history](https://skmtc.dev/sea-lion/apis/litellm-api/changes/lens/datasets/build/post.md)

---

[API](https://skmtc.dev/sea-lion/apis/litellm-api.md) · [All operations](https://skmtc.dev/sea-lion/apis/litellm-api/llms.txt) · [OpenAPI document](https://skmtc.dev/sea-lion/apis/litellm-api/revisions/1ba9123c189a?raw)
