Update data collection
Endpoint: PUT /data-collections/{data_collection_id}
Description
Updates name, dataset_ids, custom_run_ids, org_id, and/or project_id. All body fields are optional.
Sharing & unsharing rules
Changing org_id:
- Setting
org_idto your organization's id shares the collection. When you newly share (org_idgoes fromnullto your organization), includeproject_idin the same request (required — see Introduction — Project). - The collection receives the
org_idandproject_idyou send. Every dataset and custom run currently in the collection adopts the sameorg_idand inherits that project (cascaded from the collection). - Setting
org_idtonullunshares the collection and removes project assignments for the collection and its org-shared children:- Datasets and runs that don't belong to the collection's owner are detached (
data_collection_idcleared) and lose org visibility. - Datasets owned by the collection owner stay in the collection but become private (
org_id = null). - The collection owner's runs on those remaining datasets / on the collection lose their
org_idand project assignment.
- Datasets and runs that don't belong to the collection's owner are detached (
- Only the collection owner (or, for org-only collections, a member of that organization) can change
org_id. - Org-only collections (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.
Changing dataset_ids (the field replaces the full set of attached datasets):
- Datasets removed from the set get
data_collection_id = null, and the owner's runs that referenced those datasets are detached from the collection. - Datasets newly added must be your non-proprietary datasets and must not already belong to another collection. With a project-scoped API key, each newly attached dataset must be unassigned or already belong to the key's project; a conflicting assignment returns
403. - If the collection is currently shared, every dataset in the new set is forced to the collection's
org_id, and the owner's runs on those datasets are kept in sync. New members inherit the collection's project — they cannot be assigned a different project directly while they remain in the collection. - If the collection is currently private and you belong to an organization, adding any dataset already shared with your organization promotes the collection to that
org_id. As part of the promotion, your own private datasets in the new set are auto-shared with your organization (and your runs on them follow). If any non-owner private dataset can't be promoted, the request fails with400. This auto-promotion requiresproject_idin the same request (the collection and promoted members receive that project) unless you passorg_id: nullto opt out.
Changing custom_run_ids (the field replaces the full set of attached custom runs):
- Runs removed from the set are detached from the collection (
data_collection_id = null); theirorg_idand project assignment are unchanged unless you also changeorg_idon the collection. - Runs newly added must be custom runs (no dataset) you can access and must not already belong to another collection. With a project-scoped API key, each newly attached run must be unassigned or already belong to the key's project; a conflicting assignment returns
403. - When the collection is org-shared, attached custom runs inherit the collection's
org_idand project — not an independent project assignment.
Changing project_id:
- On a private collection, sending
project_idalone (withoutorg_id) auto-shares the collection with your organization and assigns it (and current cascaded org-shared members) 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 collection, changes move the collection and all cascaded org-shared datasets and runs to another project in your organization.
- You cannot set
project_idtonullwhile the collection remains org-shared.
Parameters
- Path:
data_collection_id— integer. - Body —
application/json:
{
"name": "string | null",
"dataset_ids": "integer[] | null",
"custom_run_ids": "integer[] | null",
"org_id": "integer | null",
"project_id": "integer | null"
}
Error responses
401— Authentication failed.403— Not the owner of a user-owned collection trying to changeorg_id, or API key scoping violation (project_idin the body conflicts with a project-scoped key, attached resource already assigned to a different project).422— Invalid body.404— Collection not found or not accessible to your API key (including not assigned to the key's project).400— Emptyname; duplicate name; invaliddataset_idsorcustom_run_ids(same rules as create);org_iddoesn't match your organization; attempt to unshare or move an org-only collection; mixed dataset selection where non-owner private datasets cannot be auto-promoted; org share or auto-promotion withoutproject_id;project_id: nullwhile org-shared; invalid or inaccessibleproject_id.500— Server error.
Responses
200— updated collection object with the same JSON shape as one element ofitemsfrom Get data collections (paginated list).
Example response (200)
{
"id": 14,
"user": { "id": 7, "email": "analyst@acme.com" },
"name": "Renamed bundle",
"org_id": null,
"project_id": null,
"author_email": "analyst@acme.com",
"datasets": [
{
"id": 1,
"name": "Support QA - March",
"description": "March support QA prompts",
"user": { "id": 7, "email": "analyst@acme.com" },
"org_id": null,
"project_id": null,
"author_email": "analyst@acme.com",
"created_at": "2026-03-30T10:00:00Z",
"updated_at": null
},
{
"id": 2,
"name": "Support QA - April",
"description": "April support QA prompts",
"user": { "id": 7, "email": "analyst@acme.com" },
"org_id": null,
"project_id": null,
"author_email": "analyst@acme.com",
"created_at": "2026-03-31T10:00:00Z",
"updated_at": null
},
{
"id": 3,
"name": "Support QA - May",
"description": "May support QA prompts",
"user": { "id": 7, "email": "analyst@acme.com" },
"org_id": null,
"project_id": null,
"author_email": "analyst@acme.com",
"created_at": "2026-04-01T10:00:00Z",
"updated_at": null
}
],
"runs": [],
"created_at": "2026-04-01T09:20:00Z",
"updated_at": "2026-04-01T09:30:00Z"
}
curl
curl -X PUT "https://api.aegisevals.ai/api/v1/data-collections/1" \
-H "Authorization: Bearer sk_00000000000000000000000000000000" \
-H "Content-Type: application/json" \
-d '{"name":"Renamed bundle","dataset_ids":[1,2,3]}'
Share with your organization:
curl -X PUT "https://api.aegisevals.ai/api/v1/data-collections/1" \
-H "Authorization: Bearer sk_00000000000000000000000000000000" \
-H "Content-Type: application/json" \
-d '{"org_id":3,"project_id":5}'