POST
/
api
/
public
/
v2
/
dataset-versions
/
from-filter-params
curl --request POST \
  --url https://api.promptlayer.com/api/public/v2/dataset-versions/from-filter-params \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <x-api-key>' \
  --data '{
  "dataset_group_id": 2,
  "variables_to_parse": [
    "<string>"
  ],
  "prompt_id": 123,
  "prompt_version_id": 123,
  "prompt_label_id": 123,
  "workspace_id": 123,
  "start_time": "2023-11-07T05:31:56Z",
  "end_time": "2023-11-07T05:31:56Z",
  "tags": [
    "<string>"
  ],
  "metadata": {},
  "scores": {}
}'
{
  "success": true,
  "message": "<string>",
  "dataset_id": 123,
  "dataset_group_id": 123,
  "version_number": 123
}

Create a new dataset version by filtering existing request logs. The dataset is populated asynchronously based on the provided filter parameters.

Authentication

This endpoint requires API key authentication only.

Asynchronous Processing

This endpoint initiates an asynchronous job to process the request logs based on the filter parameters. The actual dataset version creation happens in the background. A draft dataset (version_number = -1) is created immediately.

Webhooks

The following webhook is triggered when the process completes:

  • dataset_version_created_from_filter_params - Sent when the dataset version is successfully created, includes:
    • dataset_id: ID of the created dataset
    • rows_added: Number of rows added to the dataset
    • dataset_version_number: Final version number assigned

Notes

  • If an existing draft dataset exists for the dataset group, it will be updated with new filter params
  • If no matching request logs are found, an empty dataset version is created
  • Failed drafts are automatically cleaned up

Headers

X-API-KEY
string
required

API key for authentication. This endpoint supports API key authentication only.

Body

application/json

Response

201
application/json

Dataset version creation job queued

The response is of type object.