Skip to content
Suomi

Create QR labels

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

count labels on no element, or one label linked to each of element_global_ids; at most 500 a call. The organisation’s hourly label limits apply (429). A repeat with the same Idempotency-Key and body returns the labels the first call created, with 200.

projectId
required
string format: uuid
idempotency-key
string
/^[\x21-\x7e]{1,255}$/

A repeat with the same key and body returns the first answer instead of writing again. Keys are per integration and project.

Media typeapplication/json

The body of createLabels: count or element_global_ids.

object
count

Labels on no element, to print and link later

integer format: int64
>= 1 <= 500
element_global_ids

One label linked to each element; an element that has a label or is not in the current model is skipped

Array<string>
>= 1 items <= 500 items

Example generated

{
"count": 1,
"element_global_ids": [
"example"
]
}

The labels an earlier call with the same Idempotency-Key created

Media typeapplication/json

The answer of createLabels.

object
labels
required

The labels, by GIAI.

Array<object>

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
skipped
required

Elements that got no label: they had one, or are not in the current model

integer format: int64

Example

{
"labels": [
{
"status": "unassigned",
"deleted": false
}
]
}

The new labels

Media typeapplication/json

The answer of createLabels.

object
labels
required

The labels, by GIAI.

Array<object>

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
skipped
required

Elements that got no label: they had one, or are not in the current model

integer format: int64

Example

{
"labels": [
{
"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"
}

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"
}

LABEL_GENERATION_INCOMPLETE: nothing was created; try again

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"
}