Skip to main content

Create dataset

Endpoint: POST /datasets

Description Creates a custom dataset from a CSV file. The server parses the file, stores records, and attaches selected metrics (metric id → threshold 0–100). You can optionally link the dataset to a data collection you own via data_collection_id.

Parameters

  • Bodymultipart/form-data:
{
"file": "binary (.csv file)",
"selected_metrics": "string (JSON: metric id → threshold 0–100)",
"column_mappings": "string | null (JSON: Aegis field → CSV column name)",
"name": "string | null",
"data_collection_id": "integer | null"
}

Error responses

  • 401 — Authentication failed.
  • 422 — Missing required form parts or invalid multipart fields.
  • 400 — Invalid CSV, empty file, bad encoding, invalid selected_metrics / column_mappings, unknown or inactive metrics, duplicate dataset name for your account, invalid data_collection_id, etc.
  • 404 — Dataset type or data collection not found (when referenced).
  • 500 — Server error.

Responses

  • 201 — dataset object with the same JSON shape as Get dataset by id. On create, runs and evaluations are usually empty arrays until you start a dataset run.

Example response (201)

{
"id": 42,
"user": { "id": 7, "email": "analyst@acme.com" },
"dataset_type_id": 1,
"name": "My evaluation set",
"selected_metrics": { "1": 70, "2": 80 },
"structure": ["prompt", "output", "golden_answer"],
"column_mappings": null,
"data_collection_id": null,
"org_id": null,
"created_at": "2026-04-02T12:00:00Z",
"updated_at": null,
"dataset_type": {
"id": 1,
"name": "CUSTOM",
"label": "Custom",
"description": null
},
"records": [
{
"id": 1001,
"user_id": 7,
"dataset_id": 42,
"prompt": "What is the refund policy?",
"input": null,
"context": null,
"output": "Refunds are available within 30 days.",
"golden_answer": "30-day refund window.",
"created_at": "2026-04-02T12:00:00Z",
"updated_at": null
}
],
"runs": [],
"evaluations": []
}

curl

curl -X POST "https://api.aegisevals.ai/api/v1/datasets" \
-H "Authorization: Bearer sk_00000000000000000000000000000000" \
-F "file=@/path/to/data.csv" \
-F 'selected_metrics={"1":70,"2":80}' \
-F 'name=My evaluation set'