API to get all data row ids from a Labelbox dataset

What’s the best way to get all data row id’s from a Labelbox dataset?

I’m looking for an API similar to the:labelbox.schema.slice.CatalogSlice.get_data_row_ids

Hi @Kush ,

You can retrieve all data_row_ids from a dataset using the following python code:

import labelbox as lb

# Insert your API key
LB_API_KEY = "<API KEY>"
client = lb.Client(api_key=LB_API_KEY)

# Get the dataset by ID
dataset = client.get_dataset("<dataset_id>")

# Collect all data row IDs
data_row_ids = [data_row.uid for data_row in dataset.data_rows()]

print(data_row_ids)

Best,
Janny

2 Likes