Data Rows

A Data Row is the internal Labelbox representation of an asset.

Bulk import data rows

Before you import, make sure your JSON file is formatted properly (see our Data model reference for data import formats). Then, use the appendRowsToDataset mutation to create data rows from the JSON file.

FieldTypeDefinition
datasetIdIDDataset ID
jsonFileUrlStringPublic https URL to the JSON file containing the data to be labeled
mutation AppendRowsToDataset { 
    appendRowsToDataset ( 
        data: { 
            datasetId:"<DATASET_ID>", 
            jsonFileUrl:"<PUBLIC_URL_TO_JSON_FILE>" 
        } 
    ){ 
        accepted 
    }
}

Individual import

Use the createDataRow mutation to import data by URL and attach it to an existing project.

FieldTypeDefinition
externalIdStringUser generated filename
rowDataStringAn https URL to the asset to be labeled
dataset.connect.idIDDataset to connect the data row to
mutation CreateDataRow { 
    createDataRow ( 
        data: { 
            externalId: "<EXTERNAL_ID>", 
            rowData: "<ASSET_URL>", 
            dataset: { 
                connect: { 
                    id: "<DATASET_ID>" 
                } 
            },
        } 
    ){ 
        id 
    }
}

Get all data rows in a dataset

Use the datasets query to return all Data Rows from a Dataset. For a complete list of fields for data rows, see the Docs tab in the API explorer.

query GetDataRows {
    datasets (where: {id: "<DATASET_ID>"}) { 
        name 
        id 
        dataRows { 
            id 
            externalId 
        } 
    }
}

Get all data rows in a project

Specify the number of data rows to retrieve within the project query. For a complete list of arguments for dataRows see the Docs tab in the API explorer.

query GetDataRowsByProject { 
    project (where: {id: "<PROJECT_ID>"}) { 
        datasets { 
            dataRows (first: 100) { 
                id 
                rowData 
                externalId 
            }     
        } 
    }
}

Update data rows

Use the updateDataRow mutation to update data row fields.

FieldTypeDefinition
externalIdStringUser-generated file name
rowDataStringhttps URL to the asset to be labeled
mutation UpdateDataRow { 
    updateDataRow ( 
        where: {id: "<DATAROW_ID>"} 
        data: {
            externalId: "<NEW_FILENAME>",
            rowData: "<NEW_ASSET_URL>"
        } 
    ){ 
    id
}

Delete data rows

The deleteDataRows mutation can take a list of up to 10,000 dataRowIds.

❗️

Caution

Cascading delete - if you delete a data row it will also delete the attached labels. Once deleted, there is no API method to undelete a data row.

mutation DeleteDataRows { 
    deleteDataRows (where:{ 
        dataRowIds:["<DATA_ROW_ID>"] 
    }){ 
        id 
        deleted 
    }
}