POST
/
api
/
public
/
v2
/
dataset-versions
/
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

Response

201
application/json

Dataset version creation job queued

The response is of type object.