Update dataset
Endpoint: PUT /datasets/{dataset_id}
Description
Updates a custom dataset you own, or that is shared with your organization and you are a member of that organization. All body fields are optional; only provided fields are applied. Content you may edit is the name, description, default_selected_metrics, and column_mappings. Sharing (org_id), project assignment (project_id), and collection membership (data_collection_id) are separate placement actions (see below). On a user-owned row, another org member cannot change org_id or data_collection_id (share, unshare, attach, or detach) — only the owner may (org-only datasets follow the rules below). A member may still update other fields (for example name or default_selected_metrics) and may send the current data_collection_id unchanged in the same request.
Sharing & unsharing rules
Changing org_id:
- Setting
org_idto your organization's id shares the dataset. When you newly share (org_idgoes fromnullto your organization), includeproject_idin the same request (required — see Introduction — Project). - If the dataset is not in a data collection, it receives the
org_idandproject_idyou send. - If the dataset is in a private data collection that you own, sharing cascades to the whole collection: the collection, every dataset in it, and your runs tied to the collection or its datasets adopt the same
org_id.project_idis applied to the collection and cascades to those org-shared members (sibling datasets and runs), not assigned to this dataset alone. - If the dataset is already in an org-shared data collection, its
org_idand project follow the collection — you cannot independently share, unshare, or re-project it here. Detach it (data_collection_id: null) or change the collection instead. - Setting
org_idtonullunshares the dataset and removes project assignment for this dataset and its runs when this key may share it. A private key can unshare a dataset it owns. A project-scoped key cannot: once the dataset is org-shared,can_shareisfalseand the request returns403. If the dataset is still inside an org-shared data collection, unshare is rejected — also passdata_collection_id: nullin the same call (or unshare the collection first). - Org-only datasets (no individual owner) cannot be unshared and cannot be moved to a different organization —
org_idmust equal the current value, and you must belong to that organization. - Proprietary datasets cannot be shared with an organization.
- Only the dataset owner can change
org_idon a user-owned dataset, and only whencan_shareis true for this key. Re-sending the currentorg_idon an org-only dataset is allowed for a project-scoped key in that organization.
Changing data_collection_id:
- Linking the dataset to an org-shared collection forces the dataset's
org_idto match the collection'sorg_id(auto-share) and inherits the collection's project when one is set. - Linking to a private collection leaves the dataset's
org_idunchanged (but see the cascade described above if you later share it). - Setting
data_collection_idtonulldetaches the dataset; the dataset'sorg_idis unchanged unlessorg_idis also provided in the same request. - Proprietary datasets cannot be attached to a data collection.
- Only the dataset owner (or, for org-only datasets, a member of that organization) can change
data_collection_id— attach, detach, or move to another collection. Sending the dataset's currentdata_collection_idwithout changing it is allowed for any member who may update the dataset.
Changing project_id:
- On a private dataset with no
data_collection_id, sendingproject_idalone (withoutorg_id) auto-shares the dataset with your organization and assigns it to that project when your key has organization authorization (a project-scoped key). A private API key cannot org-share this way. - On an org-shared dataset not in a data collection, an API key cannot change
project_idto a different project, including when the key's owner is an organization admin. That request returns403. Sending the currentproject_idagain succeeds. - You cannot set
project_idtonullwhile the dataset remains org-shared. - A dataset inside a data collection cannot be assigned to a project directly — assign the collection instead (or remove the dataset from the collection first). The API returns
400if you try.
Run synchronization
Whenever org_id or data_collection_id change as a result of this request, your own runs on this dataset are updated to match both fields, so they keep the same visibility as the dataset.
Parameters
- Path:
dataset_id— integer. - Body —
application/json:
{
"name": "string | null",
"description": "string | null",
"default_selected_metrics": {
"ans_corr": { "threshold": 70, "metric_args": null },
"faith": { "threshold": 80, "metric_args": { "ignore_extra_keys": true } }
},
"column_mappings": { "external_id": "row_id", "prompt": "col_a", "output": "col_b" },
"data_collection_id": 14,
"org_id": "integer | null",
"project_id": "integer | null"
}
data_collection_id, org_id, and project_id must be JSON integers. A digit string ("74"), a whole-number float (1.0), or a boolean (true / false) returns 422 before lookup. JSON null and omitting a field stay valid.
default_selected_metrics is a map keyed by metric shortname, with { threshold?: 0–100 | null, metric_args?: object | null } per entry. See Create dataset for the full shape and validation rules (including optional per-metric threshold with catalog fallback). Sending a non-empty default_selected_metrics replaces the whole map. Omit the field, or send null, to leave stored defaults unchanged. Send {} to clear stored defaults (default_selected_metrics is null in the response).
description is optional. Max 255 characters. Surrounding whitespace is trimmed; null or a blank string clears the stored description. Omit the field to leave it unchanged.
column_mappings replaces the stored map. Each CSV column can be mapped to only one field (case-insensitive). A shared column returns 400 (Each CSV column can be mapped to only one field. 'question' is mapped to input, output.).
Error responses
401— Authentication failed.403— Not allowed to update this dataset, another member attempting to changeorg_idordata_collection_idon a user-owned dataset, an API key changingproject_idon an already-shared dataset (including an organization admin's key), or API key scoping violation (project_idin the body conflicts with a project-scoped key, claim/attach conflict when the target collection is assigned to a different project).422— Invalid body.data_collection_id,org_id, andproject_idmust be JSON integers. A digit string ("74"), a whole-number float (1.0), or a boolean (true/false) is rejected before lookup ("Input should be a valid integer"). JSONnulland omitting a field are still accepted.404— Dataset not found or not accessible to your API key (including not assigned to the key's project); data collection not found or not claimable.400— Invalid metrics (including metric id used as a map key —Invalid metric key '<id>'. Use a metric shortname, not a metric id.; unknown or inactive shortnames (The following metrics do not exist: …,The following metrics are not active: …); invalid thresholds ormetric_args; agentic metrics that score a trace or span —These metrics score a trace or a span and cannot be used on a dataset or custom run: <shortnames>.); invalidcolumn_mappings(including two fields mapped to the same CSV column —Each CSV column can be mapped to only one field. '<column>' is mapped to <fields>.); duplicate name for your account or organization,org_iddoesn't match your organization, attempt to unshare an org-only dataset, attempt to unshare while still inside an org-shared data collection, org share withoutproject_id,project_id: nullwhile org-shared, directproject_idon a dataset inside a collection, invalid or inaccessibleproject_id. This endpoint updates custom datasets only. A proprietary dataset id is404.500— Server error.
Responses
200— Updated dataset object with the same JSON shape as one element ofitemsfrom Get all datasets (paginated). The example is a project-scoped key that just shared a dataset it owns:can_shareis false once the dataset is org-shared. Flag meanings: Introduction — Permissions.
Example response (200)
{
"id": 3,
"user": { "id": 7, "email": "analyst@acme.com" },
"dataset_type_id": 2,
"name": "Renamed dataset",
"description": "Updated context for this dataset",
"default_selected_metrics": {
"ans_corr": { "threshold": 75, "metric_args": null },
"faith": { "threshold": 85, "metric_args": null }
},
"structure": ["external_id", "prompt", "output", "golden_answer"],
"column_mappings": {
"external_id": "row_id",
"prompt": "question",
"output": "model_answer",
"golden_answer": "expected_answer"
},
"data_collection_id": null,
"org_id": 3,
"project_id": 5,
"permissions": {
"can_edit": true,
"can_delete": true,
"can_share": false,
"can_assign_project": false,
"can_move_collection": true
},
"author_email": "analyst@acme.com",
"extra_columns": [],
"created_at": "2026-04-01T10:00:00Z",
"updated_at": "2026-04-02T15:00:00Z"
}
curl
curl -X PUT "https://api.aegisevals.ai/api/v1/datasets/3" \
-H "Authorization: Bearer sk_00000000000000000000000000000000" \
-H "Content-Type: application/json" \
-d '{"name":"Renamed dataset","description":"Updated context for this dataset","org_id":3,"project_id":5,"default_selected_metrics":{"ans_corr":{"threshold":75,"metric_args":null},"faith":{"threshold":85,"metric_args":null}}}'