Delete DataRow

Cascading DeleteNote if you delete a DataRow it will also delete the attached labels. Once deleted there isn’t an API method to undelete a DataRow.

Here is the GraphQL query to delete a DataRow

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

Here is a python example

# Two things to run this script
# 1. run "pip install graphqlclient"
# 2. Fill in <API-KEY-HERE> (https://app.labelbox.com/settings/apikey)

import json
from graphqlclient import GraphQLClient
client = GraphQLClient('https://api.labelbox.com/graphql')
client.inject_token('Bearer <API-KEY-HERE>')

def delete_datarows(ids):
res_str = client.execute("""
mutation DeleteDataRowsFromAPI($datarowIds: [ID!]!) {
deleteDataRows(where:{
dataRowIds: $datarowIds
}){
id
deleted
}
}
""", {
'datarowIds': ids
})

res = json.loads(res_str)
return res['data']['deleteDataRows']

if __name__ == "__main__":
print(delete_datarows(['<DATAROW_ID>']))


How did we do?