Skip to content
Suomi

Link a label to an element

POST
/v1/projects/{projectId}/labels/{labelId}/assign
Code sample: Shell / cURL
curl --request POST \
--url https://api.whatsbuilt.fi/v1/projects/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/labels/2489E9AD-2EE2-8E00-8EC9-32D5F69181C0/assign \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "element_global_id": "example", "move": true }'

For a label on no element, or one whose element was deleted from the project. A label on another element answers 409 CONFLICT unless move is true, which moves it as the app does. A retired label answers 409 LABEL_RETIRED. An element carries one label: a second answers 409 ASSET_ALREADY_LABELLED. Needs the admin role, or the inspector role where the project lets inspectors link labels (403 LABEL_LINK_NOT_ALLOWED).

projectId
required
string format: uuid
labelId
required
string format: uuid

The label’s id

Media typeapplication/json

The body of assignLabel.

object
element_global_id
required

The element.

string
>= 1 characters <= 64 characters
move

True moves a label that is on another element, as the app does; default false answers 409

boolean

Example generated

{
"element_global_id": "example",
"move": true
}

The label

Media typeapplication/json

A live label.

object
id
required

The label.

string format: uuid
project_id
required

The project.

string format: uuid
giai
required

The GS1 GIAI printed in the QR code

string
code
required

The short code printed under the QR code

string
digital_link
required

The GS1 Digital Link the QR code holds

string
element_global_id
required

The element the label is on; null while unassigned or retired

string | null
status
required

assigned and active are both in use; active once scanned. New statuses may come.

string
Allowed values: unassigned assigned active retired
assigned_at
required

When it was put on its element.

string | null
first_scanned_at
required

Its first scan.

string | null
created_at
required

When it was minted.

string
changed_at
required

The row’s change time.

string
deleted
required
boolean

Example

{
"status": "unassigned",
"deleted": false
}

Invalid body, parameters or Idempotency-Key

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

Missing, malformed, expired or revoked token

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

INSUFFICIENT_SCOPE; INSUFFICIENT_PROJECT_ROLE when the project role the scopes give does not cover the write, or the project is not the integration’s; PUBLIC_API_DISABLED when the project’s owning organisation has turned the API off

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

No such project, label or element

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

ASSET_ALREADY_LABELLED, LABEL_RETIRED, or the label is on another element

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

IDEMPOTENCY_KEY_REUSED: the key was used with another body

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}

RATE_LIMITED; wait for Retry-After seconds

Media typeapplication/json

The error body of every /v1 answer of 400 or more.

object
error
required

A sentence for people; it may change

string
code
required

Part of the contract

string
details

What the code names, where it names something

request_id
required

The X-Request-Id of the call

string

Example generated

{
"error": "example",
"code": "example",
"details": "example",
"request_id": "example"
}