post
https://app.fracttal.com/api/work_orders_labels/
This endpoint creates a new label in the catalog of the authenticated dispatcher's company. The operation is idempotent: if a label with the same description already exists (case-insensitive comparison), the service returns the existing label without creating a duplicate and without raising an error.
Input parameters
Sent within the body:
Required
| Parameter | Type | Required | Description |
|---|---|---|---|
account_code | Text | Yes | Code of the staff member with an active dispatcher account. Obtained from the code field in the personnel endpoint. It cannot be null or empty. |
description | Text | Yes | Label description. Maximum 200 characters; trim is applied. If a label with the same text already exists (case-insensitive), the existing one is returned without creating a duplicate. |
Optional
| Parameter | Type | Required | Description |
|---|---|---|---|
color | Text | Optional | Color in hexadecimal format (maximum 10 characters). Default FFFFFF. |
Output parameters
Successful response HTTP 200:
| Parameter | Type | Description |
|---|---|---|
success | Boolean | true if the operation was successful. |
message | Text | HTTP response code. |
total | Integer | 1 when the label was created or already existed. |
data | JSON | Label object. |
Structure of the data object:
| Field | Type | Description |
|---|---|---|
id | Integer | Unique label identifier. |
id_company | Integer | Identifier of the company that owns the label. |
description | Text | Name or description of the label. |
color | Text | Label color in hexadecimal format (without #). |
enabled | Boolean | true if the label is enabled. |
Validations and errors
400—account_codeordescriptionmissing, null, empty or only whitespace; ordescriptionexceeds 200 characters.401— Not authenticated or account not authorized as dispatcher.404—account_codedoes not exist in personnel or has no active account.500— Internal system error.
Difference from PUT /api/work_orders_labels/
PUT /api/work_orders_labels/| Aspect | PUT /api/work_orders_labels/ | POST /api/work_orders_labels/ (this endpoint) |
|---|---|---|
| Function | Assigns an existing label to a work order. | Creates a label in the company catalog. |
| Required parameters | work order folio + label id + account_code. | description + account_code. |
| Optional parameter | — | color (default FFFFFF). |
| Result | Label assigned to the work order. | Label created, or existing label if already present. |
Example:
Request: (POST) https://app.fracttal.com/api/work_orders_labels/
Body (new label):
{
"account_code": "USR001",
"description": "Correctivo urgente",
"color": "FF5733"
}Response (new label created):
{
"success": true,
"message": "200",
"total": 1,
"data": {"id": 1004, "id_company": 5, "description": "Correctivo urgente", "color": "FF5733", "enabled": true}
}Response (label already existed — same result):
{
"success": true,
"message": "200",
"total": 1,
"data": {"id": 1001, "id_company": 5, "description": "Correctivo urgente", "color": "FF5733", "enabled": true}
}Response (error — description > 200 characters):
{
"success": false,
"message": "400",
"total": 0,
"data": [{"ERROR": "description exceeds maximum length of 200 characters"}]
} 200