Layers are alternative views of an image that you can attach to a Data Row to provide labelers with additional view options for the asset being labeled.

Add layers

To add layers to a Data Row, use the createDataRowAttachment mutation (previously createAssetMetadata).

To attach more than one layer, you will need to run the createAssetAttachment mutation multiple times which will append the layer to the existing layers on that Data Row.

Field

Type

Description

data.dataRowId

ID

ID of the Data Row to add the layers to

data.value

String

Accepts an https URL to an external file

data.type

AttachmentType

Value must be: IMAGE_OVERLAY

data.name

String

Accepts a string of text

mutation AddAttachment {
    createDataRowAttachment (
        data:{
            dataRowId:"<DATAROW_ID>",
            value:"https://firebasestorage.googleapis.com/v0/b/labelbox-193903.appspot.com/o/cjhk4p9dyf5va0702liitudpz%2Fd3ffab29-d6be-4d69-b006-89a828679d29%2Fleft_small-pen-test-site_1_1537524039648.jpg?alt=media&token=66e84e55-97e8-46a6-9ab8-685f1e950581",
            type: IMAGE,
            name:"Fish"
        }
    ) {
        id
    }
}

Get layers

Use this query to get the list of layers (previously called asset metadata).

Field

Type

Description

attachments.id

ID

ID of the layer on the Data Row

attachments.type

AttachmentType

Should be IMAGE_OVERLAY

attachments.value

String

An https URL to an external file

attachments.name

String

A string of text

query GetAttachmentByDataRowId {
    dataRow (where: {id: "<DATAROW_ID>"}) {
        attachments {
            id
            type
            value
            name
        }
    }
}
# metadata in this context will soon be deprecated
query GetAttachmentByDataRowId {
    dataRow (where: {id: "<DATAROW_ID>"}) {
        metadata {
            id
            metaValue
            metaType
            name
        }
    }
}

Edit layers

First, use this query to get the ID for the layers (previously referred to as metadata).

Then, use updateDataRowAttachment (previously updateAssetMetadata) to update an layer on a Data Row.

Field

Type

Description

data.value

String

Accepts an https URL to an external file

data.type

AttachmentType

Value must be: IMAGE_OVERLAY

data.name

String

Accepts a string of text

query GetAttachmentId {
    dataRow (where: {id: "<DATAROW_ID>"}) {
        id
        attachments {
            id
        }
    }
}
mutation UpdateAttachment {
    updateDataRowAttachment (
        where: {
            id:"<ATTACHMENT_ID>"
        },
        data:{
            value:"https://firebasestorage.googleapis.com/v0/b/labelbox-193903.appspot.com/o/cjhk4p9dyf5va0702liitudpz%2Fd3ffab29-d6be-4d69-b006-89a828679d29%2Fleft_small-pen-test-site_1_1537524039648.jpg?alt=media&token=66e84e55-97e8-46a6-9ab8-685f1e950581",
            type: IMAGE_OVERLAY,
            name:"Fish"
        }
    ){
        id
    }
}

Remove layers

Then, use the deleteDataRowAttachment (previously deleteAssetMetadata) mutation to remove the layers.

mutation RemoveAttachment {
  deleteDataRowAttachment (
    where: {
      id:"<ATTACHMENT_ID>"
    }
  ){
    id
    type
  }
}