Skip to main content
Create, list, retrieve, and manage slices for your datasets.
Slices are curated subsets of one or more datasets. Each slice is composed of sub-slices that can reference entire datasets, specific items within a dataset, or a filter expression. Slices do not duplicate the underlying data — they reference items in their source datasets.

List Slices

GET /api/v1/slices/{owner}/list/
Returns all slices owned by the specified organization or user.

Parameters

NameTypeRequiredDescription
ownerstringYesOrganization slug or username (path parameter)
orderingstringNoField to order results by (query parameter)
pageintegerNoPage number for pagination (query parameter)
limitintegerNoNumber of results per page (query parameter)

Request

curl "https://api.avala.ai/api/v1/slices/acme-ai/list/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

{
  "count": 12,
  "next": "https://api.avala.ai/api/v1/slices/acme-ai/list/?page=2",
  "previous": null,
  "results": [
    {
      "name": "Night Driving Scenes",
      "slug": "night-driving-scenes",
      "uid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
      "owner_name": "acme-ai",
      "organization": null,
      "visibility": "private",
      "sub_slices": [
        {
          "type": "dataset",
          "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "source_data": [
        {
          "type": "dataset",
          "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
        }
      ],
      "status": "created",
      "featured_slice_item_urls": [
        "https://cdn.avala.ai/items/abc123.jpg",
        "https://cdn.avala.ai/items/def456.jpg"
      ],
      "item_count": 340
    }
  ]
}

Fields

FieldTypeDescription
namestringDisplay name of the slice
slugstringURL-friendly identifier
uidstring (UUID)Unique identifier for the slice
owner_namestringUsername of the slice owner
organizationobject | nullOrganization the slice belongs to, if any
visibilitystring"public" or "private"
sub_slicesarraySub-slice definitions (see Sub-slice types)
source_dataarray | nullStored sub-slice data used to generate the slice
statusstring"pending", "created", or "failed"
featured_slice_item_urlsarrayURLs of up to 4 preview items
item_countintegerNumber of items in the slice
You can also list slices filtered by dataset:
GET /api/v1/slices/dataset/{dataset_uid}/

Create Slice

POST /api/v1/slices/
Creates a new slice from one or more sub-slice definitions.

Parameters

NameTypeRequiredDescription
namestringYesDisplay name for the slice (1-100 characters)
visibilitystringYes"public" or "private"
sub_slicesarrayYesArray of sub-slice objects (see Sub-slice types)
organizationobjectNoOrganization to assign the slice to
random_selection_countintegerNoRandomly select this many items from the sub-slice sources

Request

curl -X POST "https://api.avala.ai/api/v1/slices/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Night Driving Scenes",
    "visibility": "private",
    "sub_slices": [
      {
        "type": "dataset",
        "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
      }
    ]
  }'

Response

{
  "name": "Night Driving Scenes",
  "slug": "night-driving-scenes",
  "uid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "owner_name": "acme-ai",
  "organization": null,
  "visibility": "private",
  "sub_slices": [
    {
      "type": "dataset",
      "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "source_data": [
    {
      "type": "dataset",
      "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "status": "pending",
  "featured_slice_item_urls": [],
  "item_count": 0
}
Newly created slices have status: "pending" and item_count: 0. Items are populated asynchronously — poll the Get Slice endpoint to check when status changes to "created".

Get Slice

GET /api/v1/slices/{owner}/{slug}/
Returns the details of a specific slice.

Parameters

NameTypeRequiredDescription
ownerstringYesOrganization slug or username (path parameter)
slugstringYesSlice slug (path parameter)

Request

curl "https://api.avala.ai/api/v1/slices/acme-ai/night-driving-scenes/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

{
  "name": "Night Driving Scenes",
  "slug": "night-driving-scenes",
  "uid": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
  "owner_name": "acme-ai",
  "organization": null,
  "visibility": "private",
  "sub_slices": [
    {
      "type": "dataset",
      "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "source_data": [
    {
      "type": "dataset",
      "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
    }
  ],
  "status": "created",
  "featured_slice_item_urls": [
    "https://cdn.avala.ai/items/abc123.jpg",
    "https://cdn.avala.ai/items/def456.jpg",
    "https://cdn.avala.ai/items/ghi789.jpg",
    "https://cdn.avala.ai/items/jkl012.jpg"
  ],
  "item_count": 340
}

Fields

Same as List Slices fields.

List Slice Items

GET /api/v1/slices/{owner}/{slug}/items/list/
Returns the items belonging to a specific slice.

Parameters

NameTypeRequiredDescription
ownerstringYesOrganization slug or username (path parameter)
slugstringYesSlice slug (path parameter)
cursorstringNoCursor for pagination (query parameter)
limitintegerNoNumber of results per page (query parameter)

Request

curl "https://api.avala.ai/api/v1/slices/acme-ai/night-driving-scenes/items/list/" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY"

Response

The response returns dataset items in the same format as List Items. Each item includes uid, key, url, thumbnails, metadata, created_at, and related fields.

Sub-slice Types

Each entry in the sub_slices array has a type field and type-specific properties:

dataset — All items from a dataset

Include every item from a dataset.
{
  "type": "dataset",
  "dataset_uid": "550e8400-e29b-41d4-a716-446655440000"
}
FieldTypeRequiredDescription
typestringYesMust be "dataset"
dataset_uidstring (UUID)YesUID of the source dataset

dataset_items — Specific items from a dataset

Include only the specified items.
{
  "type": "dataset_items",
  "dataset_uid": "550e8400-e29b-41d4-a716-446655440000",
  "dataset_item_uids": [
    "11111111-1111-1111-1111-111111111111",
    "22222222-2222-2222-2222-222222222222"
  ]
}
FieldTypeRequiredDescription
typestringYesMust be "dataset_items"
dataset_uidstring (UUID)YesUID of the source dataset
dataset_item_uidsarray of UUIDsYesUIDs of items to include

filters — Filter expression

Include items matching a filter expression.
{
  "type": "filters",
  "dataset_uid": "550e8400-e29b-41d4-a716-446655440000",
  "filters": {
    "tag": ["night", "rain"]
  }
}
FieldTypeRequiredDescription
typestringYesMust be "filters"
dataset_uidstring (UUID)YesUID of the source dataset
filtersobjectYesFilter expression object

Validate Slice Name

POST /api/v1/slice/validate/name
Validates a proposed slice name before creation.

Request

curl -X POST "https://api.avala.ai/api/v1/slice/validate/name" \
  -H "X-Avala-Api-Key: $AVALA_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "Night Driving Scenes"}'

Response

{
  "name": "Night Driving Scenes",
  "isValid": true,
  "message": "Slice slug for name Night Driving Scenes is VALID for user: acme-ai"
}
FieldTypeDescription
namestringThe name that was validated
isValidbooleanWhether the name is available
messagestringHuman-readable validation result

Error Responses

Validation Error (400)

{
  "name": ["This field is required."],
  "visibility": ["This field is required."],
  "sub_slices": ["This field is required."]
}
Returned when the request body is missing required fields or contains invalid values.

Unauthorized (401)

{
  "detail": "Invalid API key."
}
Returned when the X-Avala-Api-Key header is missing or contains an invalid key.

Permission Denied (403)

{
  "detail": "You do not have permission to perform this action."
}
Returned when the authenticated user does not have access to the requested dataset or slice.

Not Found (404)

{
  "detail": "Not found."
}
Returned when the specified slice or referenced dataset UUID does not exist.