Skip to main content

Dataset Basics

Create, explore, and modify datasets


Create a Dataset

curl --location --request POST "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets/" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json" \
--data-raw '{
"datasets": [
{
"id": "dataset-1633032323",
"description": "This is the foo dataset",
"metadata": {
"lol": "hey"
}
}
]
}'

List Datasets

curl --location --request GET "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets?page=1&per_page=100" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json"

Get Datasets

curl --location -g --request GET "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets/YOUR_DATASET_ID_HERE" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json"

Update Datasets

curl --location --request PATCH "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets/" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json" \
--data-raw '{
"datasets": [
{
"id": "YOUR_DATASET_ID_HERE",
"description": "This is the new foo dataset",
"metadata": {
"foo": "bar"
}
}
],
"action": "overwrite"
}'

Update Datasets With Default Filter

curl --location --request PATCH "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json" \
--data-raw '{
"datasets": [
{
"id": "YOUR_DATASET_ID_HERE",
"description": "This is the new foo dataset",
"metadata": {
"foo": "bar"
},
"default_filter_id": "YOUR_DATASET_ID_FILTER_HERE"
}
],
"action": "overwrite"
}'

Delete Datasets

curl --location --request DELETE "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json" \
--data-raw '{
"dataset_ids": ["YOUR_DATASET_ID_HERE"]
}'

Add Inputs to Datasets

curl --location --request POST "https://api.clarifai.com/v2/users/YOUR_USER_ID_HERE/apps/YOUR_APP_ID_HERE/datasets/YOUR_DATASET_ID_HERE/inputs" \
--header "Authorization: Key YOUR_PAT_HERE" \
--header "Content-Type: application/json" \
--data-raw '{
"dataset_inputs": [
{
"input": {
"id":"YOUR_INPUT_ID_HERE"
}
}
]
}'