Table of Contents

Labels

Alex Cota Updated by Alex Cota

A label is a collection of features on a single asset and represents an assessment on a data row.

Below are some common operations the GraphQL API supports for labels.

Get label data

Get JSON label by ID

To get the stringified JSON value for data.label by the label ID, use this query.

query getLabelById{ 
label(where: {id: "<LABEL_ID>"}) {
# Info requested
}
}
Get JSON label by project

Use first to return a paginated result. You can also filter labels by review, creator, etc.

Query Variables: {"dataset_id": "<DATASET ID HERE>"}

query getLabelsFromProject($project_id: ID!) {
projects(where: {id_contains: $project_id}) {
id
name
labels(first: 10) {
id
createdBy {
email }
label
}
}
}

Export labels

There are two ways for exporting data, bulk export and individual export.

Bulk export

Bulk export is useful if you need to export many labels quickly.

downloadUrl

URL to the JSON file containing labels for the project.

createdAt

Timestamp indicating when the export was generated.

shouldPoll

If true, the export is in the process of being generated and your script should make the same request on an interval until completion.

30min Frequency The exportLabels mutation will only generate a new downloadUrl at a max frequency of 30min. If you called exportLabels twice within 30 min the second call will return the same downloadUrl and createdAt timestamp.
mutation{ 
exportLabels(data:{
projectId:"<PROJECT_ID>"
}){
downloadUrl
createdAt
shouldPoll
}
}
Individual export

Individual export is useful for real-time use cases or exporting a subset of the data.

  1. [Get the project ID].
  2. Query the labels. Use the first argument to specify how many labels you would like to be returned in the paginated result.
query APIGetPageOfLabels { 
project(where:{id: "<INSERT_PROJECT_ID_HERE>"}) {
labels(first: 5){
id
label
createdBy{
id
email }
type {
id
name }
secondsToLabel
agreement
dataRow {
id
rowData
}
}
}
}

Delete labels

When you delete a label, the asset is automatically re-enqueued, meaning it is re-entered into the labeling queue. Please see our docs on relabeling data to read about re-enqueuing labels.

mutation{ 
deleteLabels(
labelIds:["LABEL_ID>"]
){
id
deleted
}
}

Was this page helpful?

Labeling parameters

Members

Contact