Skip to content

Labels API

Manage labels for organizing and categorizing tickets.

Endpoints

MethodEndpointDescription
GET/labelsList labels
POST/labelsCreate label
GET/labels/:idGet label
PATCH/labels/:idUpdate label
DELETE/labels/:idDelete label

List Labels

Terminal window
GET /api/v1/labels

Response

{
"data": [
{
"id": "label-uuid-1",
"name": "Billing",
"color": "#EF4444",
"description": "Billing and payment issues",
"ticket_count": 42,
"created_at": "2024-01-01T00:00:00Z"
},
{
"id": "label-uuid-2",
"name": "Technical",
"color": "#3B82F6",
"description": "Technical support issues",
"ticket_count": 156,
"created_at": "2024-01-01T00:00:00Z"
}
]
}

Create Label

Terminal window
POST /api/v1/labels

Request Body

{
"name": "VIP",
"color": "#8B5CF6",
"description": "High-priority VIP customers"
}
FieldTypeRequiredDescription
namestringYesLabel name (unique)
colorstringYesHex color code
descriptionstringNoLabel description

Colors

Use hex color codes:

ColorHex
Red#EF4444
Orange#F97316
Yellow#EAB308
Green#22C55E
Blue#3B82F6
Purple#8B5CF6
Gray#6B7280

Response

{
"data": {
"id": "label-uuid",
"name": "VIP",
"color": "#8B5CF6",
"description": "High-priority VIP customers",
"ticket_count": 0,
"created_at": "2024-01-15T10:00:00Z"
}
}

Get Label

Terminal window
GET /api/v1/labels/:id

Returns label with usage statistics.

Update Label

Terminal window
PATCH /api/v1/labels/:id
{
"name": "VIP Customer",
"color": "#A855F7"
}

Changes apply to all tickets with this label.

Delete Label

Terminal window
DELETE /api/v1/labels/:id

Response

204 No Content

Removes the label from all tickets. Tickets themselves are not affected.

Applying Labels to Tickets

Add Labels

Terminal window
POST /api/v1/tickets/:ticket_id/labels
{
"label_ids": ["label-uuid-1", "label-uuid-2"]
}

Adds labels to the ticket (existing labels are kept).

Remove Labels

Terminal window
DELETE /api/v1/tickets/:ticket_id/labels
{
"label_ids": ["label-uuid-1"]
}

Removes specified labels from the ticket.

Set Labels

When updating a ticket, setting label_ids replaces all labels:

Terminal window
PATCH /api/v1/tickets/:id
{
"label_ids": ["label-uuid-1", "label-uuid-3"]
}

Filtering Tickets by Label

Terminal window
GET /api/v1/tickets?label_ids=label-uuid-1,label-uuid-2

Returns tickets that have any of the specified labels.

Error Codes

CodeDescription
LABEL_NOT_FOUNDLabel doesn’t exist
LABEL_NAME_EXISTSLabel name already used
INVALID_COLORColor must be valid hex code