bulkImportRequest represents the bulk import job for a set of predictions.

For an overview of this workflow, see our docs on Model-assisted labeling.

Create a bulk import request

After you create your import file (see our Data model reference for annotation import formats), create a public URL for your file. Then, use the createBulkImportRequest mutation to create an import job.

Field

Type

Description

projectId

ID

Project to import the annotations

name

String

Name of the import job

fileUrl

String

Valid URL to an NDJSON file containing the annotations

mutation CreateBulkImportRequest {
    createBulkImportRequest (data: {
        projectId: "<PROJECT_ID>",
        name: "import_job_1",
        fileUrl: "https://foobar.com/test2file"
    }) {
    id
  }
}

❗️

Caution

Wait until the import job is complete before opening the Editor to make sure all annotations are imported properly.

Check import request status

Use the bulkImportRequest query to check the status of the import job.

This query returns the following fields.

Field

Type

Definition

state

BulkImportRequestState

Refers to the whole import job and the values are: RUNNING, FAILED, FINISHED.

statusFileUrl

String

Points to an NDJSON that expires after 24 hours and contains a SUCCESS or FAILED status per annotation when state is FINISHED. When state is FAILED, statusFileUrl will be null.

errorFileUrl

String

Points to an NDJSON that contains error messages for each annotation that did not import successfully when state is FINISHEDWhen state is FAILED, this NDJSON contains the error message.

query CheckImportRequestStatus {
    bulkImportRequest (where: {
        projectId: "<PROJECT_ID>",
        name: "import_job_1"
    }) {
        state
        statusFileUrl
        errorFileUrl
    }
}

List all import requests

Use this bulkImportRequests query to return a list of each import request that is accessible to you (Note: bulkImportRequests is plural). Use the following arguments to filter your query.

Argument

Type

Description

skip

Int

Indicates the number of items to skip over.

first

PageSize

Indicates the max number of items to return.

query ListAllImportRequests {
    bulkImportRequests (
        where: { projectId: "<PROJECT_ID>" } 
        skip: 0 
        first: 100
    ) {
        id
        name
    }
}

Delete imported annotations

Use this mutation to delete all imported annotations associated with a bulkImportRequest (note: this mutation does not delete the import request itself).

Labelbox handles each deleteBulkImportRequest atomically, meaning either all or none of the annotations will be deleted depending on whether or not the deletion is successful.

If you open the asset with the imported annotations in the Editor before using the deleteBulkImportRequest mutation, you may need to refresh the screen to see the annotations removed from the labeling interface.

mutation DeleteBulkImportRequest {
    deleteBulkImportRequest (where: {id: "<IMPORT_REQUEST_ID>"}) {
        id
        name
    }
}