POST
/
api
/
public
/
v2
/
dataset-versions
/
from-file
Create Dataset Version from File
curl --request POST \
  --url https://api.promptlayer.com/api/public/v2/dataset-versions/from-file \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: <x-api-key>' \
  --data '{
  "dataset_group_id": 2,
  "file_name": "<string>",
  "file_content_base64": "<string>"
}'
{
  "success": true,
  "message": "<string>",
  "dataset_id": 123
}
Create a new dataset version by uploading a CSV or JSON file. The file is processed asynchronously and webhooks are sent when complete. Files are uploaded to AWS S3 for processing.

Authentication

This endpoint requires API key authentication only.

Asynchronous Processing

This endpoint initiates an asynchronous job to process the uploaded file. The actual dataset version creation happens in the background. A draft dataset (version_number = -1) is created immediately, and upon successful processing, it’s assigned a proper version number.

Webhooks

The following webhooks are triggered during the process:
  • dataset_version_created_by_file - Sent when the dataset version is successfully created
  • dataset_version_created_by_file_failed - Sent if the dataset creation fails

Notes

  • Maximum file size: 100MB
  • 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
dataset_group_id
integer
required

ID of the dataset group where the new version will be created

Required range: x >= 1
file_name
string
required

Name of the file being uploaded (must end with .csv or .json)

Required string length: 1 - 255
file_content_base64
string
required

Base64 encoded content of the file. Maximum file size: 100MB. Supported formats: CSV, JSON

Minimum length: 1

Response

Dataset version creation job queued

success
boolean
required
message
string
required
dataset_id
integer
required

ID of the created draft dataset