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
| Property | Type | Required | Updatable | Default | Description |
|---|---|---|---|---|---|
position | object | No | Yes | { x: 0, y: 0 } | Position with x and y fields. |
size | object | No | Yes | Auto-sized | Size with width and height fields. See auto-size rules below. |
scale | number | No | Yes | 1 | Scale factor. Must be > 0. |
angle | number | No | Yes | 0 | Rotation angle (0–360). |
text | string | Yes | Yes | — | The label text content. Can be plain text or valid HTML. |
fontSize | number | No | Yes | Theme default | Font size in points. Must be ≥ 1. |
fontFamily | string | No | Yes | Theme default | Font family name. |
textColor | string | No | Yes | "#FFFFFF" | Text color as a CSS color string (e.g., "#FF0000", "rgb(255,0,0)"). |
backgroundColor | string | No | Yes | Theme default | Background color as a CSS color string. |
isAutoSizeWidth | boolean | No | Yes | true | Whether the width is automatically sized to fit text. |
isAutoSizeHeight | boolean | No | Yes | true | Whether the height is automatically sized to fit text. |
horizontalTextAlignment | string | No | Yes | "Left" | Horizontal text alignment: "Left", "Center", "Right". |
verticalTextAlignment | string | No | Yes | "Top" | Vertical text alignment: "Top", "Center", "Bottom". |
Auto-Size Rules
- When
isAutoSizeWidthistrue(default),size.widthmust be0or omitted. - When
isAutoSizeHeightistrue(default),size.heightmust be0or 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"
}