Skip to main content
PATCH
/
api
/
categories
/
:id
Update Category
curl --request PATCH \
  --url https://api.example.com/api/categories/:id \
  --header 'Content-Type: application/json' \
  --data '
{
  "name": "<string>",
  "type": {},
  "isFixed": true,
  "color": "<string>",
  "icon": "<string>",
  "parentId": "<string>"
}
'
{
  "id": "<string>",
  "userId": "<string>",
  "name": "<string>",
  "type": "<string>",
  "isFixed": true,
  "color": "<string>",
  "icon": "<string>",
  "parentId": "<string>",
  "createdAt": "<string>",
  "updatedAt": "<string>",
  "deletedAt": "<string>"
}

Endpoint

PATCH /api/categories/:id
Updates one or more fields of an existing category. All fields are optional - only provided fields will be updated.

Authentication

Requires JWT authentication via Authorization: Bearer <token> header.

Path Parameters

id
string
required
UUID of the category to update. Must belong to the authenticated user.

Request Body

All fields are optional. Only include fields you want to update.
name
string
New category name (2-50 characters). Must be unique per user, type, and parent.
type
enum
New category type. One of:
  • INCOME
  • EXPENSE
  • BOTH
isFixed
boolean
Update fixed expense status
color
string
New hex color code (e.g., #FF5733). Must match pattern ^#[0-9A-Fa-f]{6}$
icon
string
New icon identifier (max 50 characters)
parentId
string
Change parent category. Set to update hierarchical relationship. Parent must:
  • Exist and belong to the authenticated user
  • Not be the category itself
  • Not be a subcategory (2-level nesting limit)

Validation Rules

  • Name uniqueness: If changing name, it must be unique for the user’s other categories of the same type and parent
  • Parent validation:
    • Parent must exist and belong to the user
    • Category cannot be its own parent
    • Parent cannot be a subcategory (prevents deep nesting)
  • Ownership: Category must belong to the authenticated user

Response

Returns the updated category object:
id
string
Category UUID (unchanged)
userId
string
Owner user ID
name
string
Updated category name
type
string
Updated category type
isFixed
boolean
Updated fixed expense status
color
string
Updated hex color code
icon
string
Updated icon identifier
parentId
string
Updated parent ID
createdAt
string
Original creation timestamp
updatedAt
string
New update timestamp (reflects the update)
deletedAt
string
Deletion timestamp (null for active categories)

Example Request

{
  "name": "Video Streaming",
  "color": "#3498DB",
  "isFixed": true
}

Example Response

{
  "id": "123e4567-e89b-12d3-a456-426614174000",
  "userId": "user-uuid-here",
  "name": "Video Streaming",
  "type": "EXPENSE",
  "isFixed": true,
  "color": "#3498DB",
  "icon": "tv",
  "parentId": "550e8400-e29b-41d4-a716-446655440000",
  "createdAt": "2026-03-04T10:30:00.000Z",
  "updatedAt": "2026-03-04T11:45:00.000Z",
  "deletedAt": null
}

Error Responses

404 Not Found

{
  "statusCode": 404,
  "message": "Category not found"
}

409 Conflict

{
  "statusCode": 409,
  "message": "Category \"Video Streaming\" already exists"
}

400 Bad Request (Invalid Parent)

{
  "statusCode": 400,
  "message": "Invalid parent category"
}

400 Bad Request (Self-Reference)

{
  "statusCode": 400,
  "message": "Category cannot be its own parent"
}

Update Examples

Change only the name

{
  "name": "Subscriptions"
}

Update color and icon

{
  "color": "#FF5733",
  "icon": "star"
}

Move to a different parent

{
  "parentId": "new-parent-uuid"
}

Make it a root category (remove parent)

{
  "parentId": null
}

Build docs developers (and LLMs) love