Skip to main content

Endpoint

GET /api/categories
Retrieves all categories for a specific account, including their associated subcategories. Categories are returned in alphabetical order by name.

Authentication

This endpoint requires authentication via Bearer token.

Query Parameters

account_id
string
required
The UUID of the account to retrieve categories for. Must be a valid UUID format.

Response

success
boolean
Indicates whether the request was successful.
categories
array
Array of category objects.

Example Request

curl -X GET "https://api.yourapp.com/api/categories?account_id=123e4567-e89b-12d3-a456-426614174000" \
  -H "Authorization: Bearer YOUR_TOKEN"

Example Response

{
  "success": true,
  "categories": [
    {
      "id": "987fcdeb-51a2-43e7-9abc-123456789def",
      "account_id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Food & Dining",
      "name_encrypted": null,
      "color": "#10B981",
      "icon": "utensils",
      "created_at": "2026-03-01T10:00:00.000Z",
      "updated_at": null,
      "subcategories": [
        {
          "id": "abc12345-6789-0def-1234-567890abcdef",
          "category_id": "987fcdeb-51a2-43e7-9abc-123456789def",
          "name": "Groceries",
          "name_encrypted": null,
          "created_at": "2026-03-01T10:05:00.000Z",
          "updated_at": null
        },
        {
          "id": "def67890-abcd-ef12-3456-7890abcdef12",
          "category_id": "987fcdeb-51a2-43e7-9abc-123456789def",
          "name": "Restaurants",
          "name_encrypted": null,
          "created_at": "2026-03-01T10:06:00.000Z",
          "updated_at": null
        }
      ]
    },
    {
      "id": "456789ab-cdef-1234-5678-90abcdef1234",
      "account_id": "123e4567-e89b-12d3-a456-426614174000",
      "name": "Transportation",
      "name_encrypted": null,
      "color": "#3B82F6",
      "icon": "car",
      "created_at": "2026-03-02T14:00:00.000Z",
      "updated_at": null,
      "subcategories": []
    }
  ]
}

Error Responses

400
error
Bad Request - Missing or invalid account_id.
{
  "success": false,
  "message": "account_id es requerido"
}
403
error
Forbidden - User does not have access to the specified account.
{
  "success": false,
  "message": "You do not have access to this account"
}

Notes

  • Categories are returned in alphabetical order by name
  • Subcategories are also sorted alphabetically within each category
  • The user must have access to the specified account
  • Empty subcategories array means the category has no subcategories

Build docs developers (and LLMs) love