Skip to main content

Label

A label is a text element placed on the project map. Labels support customizable font, color, alignment, and auto-sizing behavior.

Item type: label

Properties

PropertyTypeRequiredUpdatableDefaultDescription
positionobjectNoYes{ x: 0, y: 0 }Position with x and y fields.
sizeobjectNoYesAuto-sizedSize with width and height fields. See auto-size rules below.
scalenumberNoYes1Scale factor. Must be > 0.
anglenumberNoYes0Rotation angle (0360).
textstringYesYesThe label text content. Can be plain text or valid HTML.
fontSizenumberNoYesTheme defaultFont size in points. Must be ≥ 1.
fontFamilystringNoYesTheme defaultFont family name.
textColorstringNoYes"#FFFFFF"Text color as a CSS color string (e.g., "#FF0000", "rgb(255,0,0)").
backgroundColorstringNoYesTheme defaultBackground color as a CSS color string.
isAutoSizeWidthbooleanNoYestrueWhether the width is automatically sized to fit text.
isAutoSizeHeightbooleanNoYestrueWhether the height is automatically sized to fit text.
horizontalTextAlignmentstringNoYes"Left"Horizontal text alignment: "Left", "Center", "Right".
verticalTextAlignmentstringNoYes"Top"Vertical text alignment: "Top", "Center", "Bottom".

Auto-Size Rules

  • When isAutoSizeWidth is true (default), size.width must be 0 or omitted.
  • When isAutoSizeHeight is true (default), size.height must be 0 or omitted.
  • When auto-size is disabled for a dimension, the corresponding size value must be ≥ 5.

Create

Creates a new label item in the project.

POST /api/v2/projects/{projectId}/item/{parent}/label

curl

curl -X POST "https://api.deon.cloud/api/v2/projects/{projectId}/item/inbox/label" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello World",
"position": { "x": 100, "y": 200 },
"fontSize": 16,
"textColor": "#FFFFFF",
"backgroundColor": "#0078D4",
"horizontalTextAlignment": "Center",
"verticalTextAlignment": "Center"
}'

JavaScript

const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/inbox/label`,
{
method: "POST",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Hello World",
position: { x: 100, y: 200 },
fontSize: 16,
textColor: "#FFFFFF",
backgroundColor: "#0078D4",
horizontalTextAlignment: "Center",
verticalTextAlignment: "Center",
}),
}
);

const data = await response.json();
console.log(data.itemId);

Response

{
"itemId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}

Update

Updates an existing label item. Only include the properties you want to change.

PATCH /api/v2/projects/{projectId}/item/label/{itemId}

curl

curl -X PATCH "https://api.deon.cloud/api/v2/projects/{projectId}/item/label/{itemId}" \
-H "Authorization: Bearer <token>" \
-H "Content-Type: application/json" \
-d '{
"text": "Updated Text",
"fontSize": 20,
"backgroundColor": "#FF5722"
}'

JavaScript

const response = await fetch(
`https://api.deon.cloud/api/v2/projects/${projectId}/item/label/${itemId}`,
{
method: "PATCH",
headers: {
Authorization: `Bearer ${token}`,
"Content-Type": "application/json",
},
body: JSON.stringify({
text: "Updated Text",
fontSize: 20,
backgroundColor: "#FF5722",
}),
}
);

const data = await response.json();
console.log(data.itemId);

Response

{
"itemId": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}