---
title: "Create a dataset from function outputs"
method: POST
path: "/v3/datasets/from-function-outputs"
tags: ["Function Accuracy"]
---

# Create a dataset from function outputs

`POST /v3/datasets/from-function-outputs`

**Build a dataset from a function's corrected outputs.**

Pulls the reviewed/corrected outputs (transformations) selected by `query` and
turns each into a dataset row: the input file, the corrected JSON, and the
schema it was produced with. Columns are created and role-tagged automatically,
so the dataset is self-describing and downstream model comparisons need no
column names. Only `name` + `query` are required.

Outputs matched by `query` that have no correction are **skipped**, not rejected —
a query over a function's outputs normally spans both corrected and uncorrected
ones. The request fails only when nothing corrected remains.

## Request body

- GoldenDataSetFromFunctionOutputsCreateRequestV3 — Request for POST /v3/datasets/from-function-outputs — the clean external surface for building a dataset from a function's corrected outputs. Only `name` + `query` are required; columns and fieldMapping default to the standard input / corrected / schema shape (tagged with roles, so downstream comparisons need no column names).
  - `name` string, required — Name of the dataset
  - `description` string, nullable — Description of the dataset
  - `columns` GoldenDataSetCreateRequestColumn[], nullable — Optional column overrides; derived from `fieldMapping` when omitted.
    - `name` string, required — Name of the column. Must match ^[A-Za-z0-9_-]+$ and cannot be 'key'
    - `description` string, nullable — Description of the column
    - `type` 'file' | 'string' | 'json', required — Type of the column
    - `role` 'input' | 'corrected' | 'schema' | 'baseline', nullable — What the column is for. Tagging a role makes the dataset self-describing, so consumers (comparisons, eval-score) resolve columns by role rather than by name.
  - `query` GoldenDataSetFromTransformationRequestTransformationQuery, required — Query parameters to filter transformations
    - `environmentNames` string[], nullable — Filter by environment names
    - `transformationIDs` string[], nullable — Filter by transformation IDs
    - `eventIDs` string[], nullable — Filter by event IDs
    - `referenceIDs` string[], nullable — Filter by reference IDs
    - `referenceIDSubstring` string, nullable — Filter by reference ID substring
    - `functionCallIDs` string[], nullable — Filter by function call IDs
    - `callIDs` string[], nullable — Filter by call IDs
    - `pipelineID` string, nullable — Filter by pipeline ID
    - `functionIDs` string[], nullable — Filter by function IDs
    - `functionNames` string[], nullable — Filter by function names (all versions of each named function)
    - `functionVersions` GoldenDataSetTransformationFunctionVersion[], nullable — Filter by specific (function, version) pairs — e.g. `[{invoices, 2}, {receipts, 3}]` selects exactly invoices
      - `functionName` string, required — Function name.
      - `versionNum` integer, nullable — Version number; omit to take all versions of the function.
    - `workflowIDs` string[], nullable — Filter by workflow IDs
    - `workflowNames` string[], nullable — Filter by workflow names
    - `published` boolean, nullable — Filter by published status
    - `publishedBefore` string, nullable — Filter by published before date
    - `publishedAfter` string, nullable — Filter by published after date
    - `isLabelled` boolean, nullable — Filter by labelled status
    - `isRegression` boolean, nullable — Filter by regression status
    - `includeFromPlayground` boolean, nullable — Include transformations from playground
  - `fieldMapping` GoldenDataSetFromTransformationRequestTransformationFieldMapping — Mapping of transformation fields to dataset columns
    - `inputFile` string, nullable — Column name to map the input file to
    - `extractedJSON` string, nullable — Column name to map the extracted JSON to
    - `correctedJSON` string, nullable — Column name to map the corrected JSON to
    - `schema` string, nullable — Column name to capture each transformation's output schema (the schema its corrected answer conforms to). Populates a per-row schema column so downstream comparisons can score against the ground-truth schema as schemas evolve.

## Response `200`

The request has succeeded.

- GoldenDataSetCreateResponse — Response after creating a golden data set
  - `dataset` GoldenDataSetSummary — Summary information about a golden data set
    - `id` string, required — Unique identifier of the dataset
    - `name` string, required — Name of the dataset
    - `description` string, nullable — Description of the dataset
    - `versionNum` integer, required — Current version number of the dataset
    - `columns` object, required — Map of column names to column information
    - `rowCount` integer, required — Number of rows in the dataset
    - `createdAt` string, date-time, required — Timestamp when the dataset was created
    - `updatedAt` string, date-time, required — Timestamp when the dataset was last updated
    - `audit` GoldenDataSetAudit — Audit information about who created and updated a dataset
      - `datasetCreatedBy` UserActionSummary
        - `userActionID` string, required — Unique identifier of the user action.
        - `userID` string — User's ID. Present for user-initiated actions.
        - `userEmail` string — User's email address. Present for user-initiated actions.
        - `apiKeyName` string — API key name. Present for API key-initiated actions.
        - `emailAddress` string — Email address. Present for email-initiated actions.
        - `createdAt` string, date-time, required — The date and time the action was created.
      - `datasetLastUpdatedBy` UserActionSummary
        - `userActionID` string, required — Unique identifier of the user action.
        - `userID` string — User's ID. Present for user-initiated actions.
        - `userEmail` string — User's email address. Present for user-initiated actions.
        - `apiKeyName` string — API key name. Present for API key-initiated actions.
        - `emailAddress` string — Email address. Present for email-initiated actions.
        - `createdAt` string, date-time, required — The date and time the action was created.
      - `versionCreatedBy` UserActionSummary
        - `userActionID` string, required — Unique identifier of the user action.
        - `userID` string — User's ID. Present for user-initiated actions.
        - `userEmail` string — User's email address. Present for user-initiated actions.
        - `apiKeyName` string — API key name. Present for API key-initiated actions.
        - `emailAddress` string — Email address. Present for email-initiated actions.
        - `createdAt` string, date-time, required — The date and time the action was created.
  - `error` string, nullable — Error message if the creation failed

---

[API](https://skmtc.dev/bem-team/apis/bem-api.md) · [All operations](https://skmtc.dev/bem-team/apis/bem-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/bem-team/bem-api/revisions/a6e4624117c6/schema)
