Skip to main content

Emotions

Emotions and emotion categories are used to tag dialog blocks, enabling the emotional arc analysis feature. The hierarchy is: Category → Emotions.

Endpoints overview

MethodEndpointPermissionDescription
GET/api/emotions/emotionsauthenticatedList emotions
GET/api/emotions/emotions/:idauthenticatedGet emotion by ID
POST/api/emotions/emotionsemotion:createCreate an emotion
PUT / PATCH/api/emotions/emotions/:idemotion:editUpdate an emotion
DELETE/api/emotions/emotions/:idemotion:deleteDelete an emotion
GET/api/emotions/categoriesauthenticatedList all categories
GET/api/emotions/categories/with-emotionsauthenticatedList categories with emotions
GET/api/emotions/categories/:idauthenticatedGet category by ID
POST/api/emotions/categoriesemotion:category:createCreate a category
PUT / PATCH/api/emotions/categories/:idemotion:category:editUpdate a category
DELETE/api/emotions/categories/:idemotion:category:deleteDelete a category

Emotion Endpoints

List emotions

GET /api/emotions/emotions — Auth required

Query params (optional)

ParamTypeDescription
categoryIdstringFilter by category UUID

Response200

[
{
"id": "em-uuid-001",
"emoji": "😊",
"keywords": ["happy", "cheerful", "glad"],
"categoryId": "cat-uuid-001",
"createdAt": "2025-01-10T09:00:00.000Z",
"updatedAt": "2025-01-10T09:00:00.000Z",
"keywordsI18n": {
"uk": ["щасливий", "веселий", "радісний"],
"en": ["happy", "cheerful", "glad"],
"es": ["feliz", "alegre", "contento"]
}
}
]

Get emotion by ID

GET /api/emotions/emotions/:id — Auth required

Response200 — single emotion object (same shape as list item)


Create emotion

POST /api/emotions/emotions — Auth required, Permission: emotion:create

Request body

{
"emoji": "😊",
"keywords": ["happy", "cheerful", "glad"],
"categoryId": "cat-uuid-001",
"lang": "en"
}
FieldRequiredNotes
emojiyesEmoji character
keywordsyesNon-empty string array
categoryIdyesUUID of the parent category
langnoSource language (uk, en, es). Auto-detected if omitted.

Response201

{
"id": "em-uuid-002",
"emoji": "😊",
"keywords": ["happy", "cheerful", "glad"],
"categoryId": "cat-uuid-001",
"createdAt": "2025-04-10T08:00:00.000Z",
"updatedAt": "2025-04-10T08:00:00.000Z",
"keywordsI18n": {
"uk": ["щасливий", "веселий", "радісний"],
"en": ["happy", "cheerful", "glad"],
"es": ["feliz", "alegre", "contento"]
}
}

Update emotion

PUT /api/emotions/emotions/:id or PATCH /api/emotions/emotions/:id — Auth required, Permission: emotion:edit

Request body (all fields optional)

{
"emoji": "😄",
"keywords": ["joyful", "elated"],
"categoryId": "cat-uuid-001",
"lang": "en"
}

Response200 — updated emotion object


Delete emotion

DELETE /api/emotions/emotions/:id — Auth required, Permission: emotion:delete

Response204


Emotion Category Endpoints

List all categories

GET /api/emotions/categories — Auth required

Response200

[
{
"id": "cat-uuid-001",
"icon": "😊",
"name": "Positive",
"order": 1,
"createdAt": "2025-01-08T09:00:00.000Z",
"updatedAt": "2025-01-08T09:00:00.000Z",
"nameI18n": { "uk": "Позитивні", "en": "Positive", "es": "Positivas" }
}
]

List categories with emotions

GET /api/emotions/categories/with-emotions — Auth required

Returns each category with its nested emotions array — used when populating the emotion picker.

Response200

[
{
"id": "cat-uuid-001",
"icon": "😊",
"name": "Positive",
"order": 1,
"nameI18n": { "uk": "Позитивні", "en": "Positive", "es": "Positivas" },
"emotions": [
{
"id": "em-uuid-001",
"emoji": "😊",
"keywords": ["happy", "cheerful"],
"categoryId": "cat-uuid-001",
"keywordsI18n": {
"uk": ["щасливий", "веселий"],
"en": ["happy", "cheerful"],
"es": ["feliz", "alegre"]
}
}
]
}
]

Get category by ID

GET /api/emotions/categories/:id — Auth required

Response200 — single category object (same shape as list item, without emotions)


Create category

POST /api/emotions/categories — Auth required, Permission: emotion:category:create

Request body

{
"icon": "😊",
"name": "Positive",
"order": 1
}
FieldRequiredNotes
iconyesEmoji or icon string
nameyesAuto-translated
orderyesNon-negative integer for display ordering

Response201

{
"id": "cat-uuid-002",
"icon": "😊",
"name": "Positive",
"order": 1,
"nameI18n": { "uk": "Позитивні", "en": "Positive", "es": "Positivas" }
}

Update category

PUT /api/emotions/categories/:id or PATCH /api/emotions/categories/:id — Auth required, Permission: emotion:category:edit

Request body (all fields optional)

{
"icon": "🌟",
"name": "Uplifting",
"order": 2
}

Response200 — updated category object


Delete category

DELETE /api/emotions/categories/:id — Auth required, Permission: emotion:category:delete

Response204