Skip to main content
Global keys are user-specified unique ID for your data rows that you can assign upon creation or afterward.

Requirements

Global key values are required, non-blank string values; they:
  • Can be up to 200 characters in length
  • Support
    • Lowercase English alphabets: a, b, c, …, z
    • Uppercase English alphabets: A, B, C, …, Z
    • Numerals: 0, 1, 2, …, 9
    • Special characters:
      • Exclamation mark: !
      • Underscore: _
      • Dot: .
      • Asterisk: *
      • Single quotation mark: '
      • Open parentheses: (
      • Close parentheses: )
      • Ampersand: &
      • Dollar sign: $
      • At symbol: @
      • Equals sign: =
      • Semicolon: ;
      • Forward slash: /
      • Colon: :
      • Plus sign: +
      • Space: “
      • Comma: ,
      • Question mark: ?
      • Hyphen: -
  • Are case-insensitive
  • Can include spaces within the value, but not at the beginning (leading) or the end (trailing)

Create data rows with global keys

Note: If you are using delegated access, using the data row URLs or object keys as the unique global keys to map your cloud-hosted assets with Labelbox data rows is common practice.
The following code will fail to upload data rows due to duplicate global keys.

Assign global keys to existing data rows

Similarly, the assignment of global keys will fail if there are duplicate global keys in the system. Suppose you have already run the above code cell. In the following code, if you will another data row with the same global key as above, it will fail to assign. It is possible to have “PARTIAL SUCCESS” results. In the case that some data rows are assigned with unique global keys and some are assigned with existing global keys, the SDK will have partial success and return a payload where the results field contains the successful ones, and the errors contains the failed ones with error messages.

Query data rows by global key

If you query for a non-existent global key, that particular query will fail while the valid queries execute.
Now, you can add data row IDs to a batch for a project or a model run for other downstream tasks.

Global keys are cleared after deleting data rows

Global keys will be automatically deleted after the deletion of data rows. For example,
Since global keys are deleted upon data row deletion, you can check whether a global key is attached to a deleted data row, and it will show up in the “errors” field.