> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vellaro.io/llms.txt
> Use this file to discover all available pages before exploring further.

# List Categories

> Return all active categories — flat or nested tree.

The tree is assembled in Python from ONE flat query (active, not
soft-deleted), like `admin_list_categories`. The old version validated the
ORM rows recursively over `selectinload(Category.children)`: that relation
is unfiltered, so a deleted/inactive child came along, and its own
(unloaded) children → MissingGreenlet → 500 on the whole public tree; the
storefront swallowed the error and lost every category (CAT-2).

Tree mode: a node whose parent is not visible (inactive or deleted) is
dropped together with its subtree, so deactivating a middle level hides
what hangs below it. Flat mode keeps every active category; each item
still carries its visible children, as before.



## OpenAPI

````yaml https://api.vellaro.io/openapi/storefront.json get /api/v1/categories
openapi: 3.1.0
info:
  title: Vellaro Storefront API
  description: >-
    The API of storefronts and mobile apps. The store comes from the publishable
    key in the `X-Vellaro-Key` header (or from the store's domain); the
    customer's endpoints also take the customer's token as `Authorization:
    Bearer <access_token>`.
  version: 0.1.0
servers:
  - url: https://api.vellaro.io
    description: Produzione
security: []
tags:
  - name: Authentication
    description: >-
      Customer sign-up and login, tokens, password reset, email verification,
      Google and Apple login, two-factor authentication.
  - name: Catalog
    description: Products, categories and brands, with filters, sorting and pagination.
  - name: Search
    description: Full-text product search and suggestions as you type.
  - name: Cart
    description: >-
      The cart of a guest (`X-Cart-Token`) or of the logged-in customer, and the
      extra warranty offered on a product page.
  - name: Checkout & orders
    description: >-
      Checkout, the customer's orders and reorder, «Order on WhatsApp» (cart
      codes, clicks).
  - name: Payments
    description: >-
      The store's payment methods, paying an order again, and the confirmation
      steps of PayPal, PokPay and Iute.
  - name: Account
    description: >-
      The logged-in customer: profile, addresses, wishlist, digital downloads,
      subscriptions, affiliate account.
  - name: Reviews & questions
    description: Product reviews and product questions.
  - name: AI chat
    description: 'The store''s AI shopping assistant: conversations, messages, feedback.'
  - name: Content
    description: CMS pages, menus, banners, flipbooks and information pages.
  - name: Marketing & contact
    description: >-
      Newsletter sign-up and email links, the contact form, campaign click
      tracking.
  - name: Store
    description: >-
      The store for the storefront: brand, public settings, languages,
      translations, currencies, physical stores, theme.
  - name: Devices
    description: Push-notification devices of the mobile app.
paths:
  /api/v1/categories:
    get:
      tags:
        - Catalog
      summary: List Categories
      description: >-
        Return all active categories — flat or nested tree.


        The tree is assembled in Python from ONE flat query (active, not

        soft-deleted), like `admin_list_categories`. The old version validated
        the

        ORM rows recursively over `selectinload(Category.children)`: that
        relation

        is unfiltered, so a deleted/inactive child came along, and its own

        (unloaded) children → MissingGreenlet → 500 on the whole public tree;
        the

        storefront swallowed the error and lost every category (CAT-2).


        Tree mode: a node whose parent is not visible (inactive or deleted) is

        dropped together with its subtree, so deactivating a middle level hides

        what hangs below it. Flat mode keeps every active category; each item

        still carries its visible children, as before.
      operationId: list_categories_api_v1_categories_get
      parameters:
        - name: tree
          in: query
          required: false
          schema:
            type: boolean
            description: Return as nested tree
            default: true
            title: Tree
          description: Return as nested tree
        - name: lang
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Force content language (it|en|sq)
            title: Lang
          description: Force content language (it|en|sq)
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiResponse_list_CategoryOut__'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    ApiResponse_list_CategoryOut__:
      properties:
        data:
          anyOf:
            - items:
                $ref: >-
                  #/components/schemas/app__modules__products__schemas__CategoryOut
              type: array
            - type: 'null'
          title: Data
        meta:
          anyOf:
            - $ref: '#/components/schemas/PaginationMeta'
            - type: 'null'
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      title: ApiResponse[list[CategoryOut]]
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    app__modules__products__schemas__CategoryOut:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        name:
          type: string
          title: Name
        name_i18n:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Name I18N
        slug:
          type: string
          title: Slug
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
        description_i18n:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Description I18N
        image_url:
          anyOf:
            - type: string
            - type: 'null'
          title: Image Url
        parent_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Parent Id
        position:
          type: integer
          title: Position
        is_active:
          type: boolean
          title: Is Active
        children:
          items:
            $ref: '#/components/schemas/app__modules__products__schemas__CategoryOut'
          type: array
          title: Children
          default: []
      type: object
      required:
        - id
        - name
        - slug
        - description
        - image_url
        - parent_id
        - position
        - is_active
      title: CategoryOut
    PaginationMeta:
      properties:
        page:
          type: integer
          title: Page
        page_size:
          type: integer
          title: Page Size
        total:
          type: integer
          title: Total
        total_pages:
          type: integer
          title: Total Pages
      type: object
      required:
        - page
        - page_size
        - total
        - total_pages
      title: PaginationMeta
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.