Table of Contents


Alex Cota Updated by Alex Cota

Below are some frequently used methods for Labels. For a complete list of methods see the API reference.

A Label is a collection of annotations on a Data Row.

Before you start

Make sure the client is initialized.

from labelbox import Client
client = Client()

Get labels

Use this sample code to get labels from a project. Then, iterate through the PaginatedCollection object to list each label.

project = client.get_project("<project_id>")
labels = project.labels()
for x in labels:
user = x.created_by()
dataRow = x.data_row()

Export labels

The sample below uses the export_labels method to print a URL to a JSON file containing the labels of a project.

project = client.get_project("<project_id>")
url = project.export_labels()

The response will be a URL of the label data file.


Bulk delete labels

Use the bulk_delete method for deleting multiple labels at a time. Users usually seek to do this when they realize there was an error in the way that the labels were initially created. This method allows you to remove the existing annotations.

Specify a project and delete use the bulk_delete method to delete all labels from that project.

project = client.get_project("<project_id>")

Was this page helpful?

Import annotations

General concepts