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.

FieldTypeDescription
data.dataRowIdIDID of the Data Row to add the layers to
data.valueStringAccepts an https URL to an external file
data.typeAttachmentTypeValue must be: IMAGE_OVERLAY
data.nameStringAccepts 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).

FieldTypeDescription
attachments.idIDID of the layer on the Data Row
attachments.typeAttachmentTypeShould be IMAGE_OVERLAY
attachments.valueStringAn https URL to an external file
attachments.nameStringA 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.

FieldTypeDescription
data.valueStringAccepts an https URL to an external file
data.typeAttachmentTypeValue must be: IMAGE_OVERLAY
data.nameStringAccepts 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
  }
}