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

# List Accounts

> List all accounts with pagination, sorting, and search.

Returns a paginated list of accounts with user counts.
Only superadmins can access this endpoint.



## OpenAPI

````yaml get /api/v1/accounts
openapi: 3.1.0
info:
  title: SnackBase
  description: Open-source Backend-as-a-Service (BaaS)
  version: 0.1.0
servers: []
security: []
paths:
  /api/v1/accounts:
    get:
      tags:
        - accounts
      summary: List Accounts
      description: |-
        List all accounts with pagination, sorting, and search.

        Returns a paginated list of accounts with user counts.
        Only superadmins can access this endpoint.
      operationId: list_accounts_api_v1_accounts_get
      parameters:
        - name: page
          in: query
          required: false
          schema:
            type: integer
            minimum: 1
            description: Page number (1-indexed)
            default: 1
            title: Page
          description: Page number (1-indexed)
        - name: page_size
          in: query
          required: false
          schema:
            type: integer
            maximum: 100
            minimum: 1
            description: Items per page
            default: 25
            title: Page Size
          description: Items per page
        - name: sort_by
          in: query
          required: false
          schema:
            type: string
            description: Column to sort by
            default: created_at
            title: Sort By
          description: Column to sort by
        - name: sort_order
          in: query
          required: false
          schema:
            type: string
            pattern: ^(asc|desc)$
            description: Sort order
            default: desc
            title: Sort Order
          description: Sort order
        - name: search
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: Search query
            title: Search
          description: Search query
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountListResponse'
        '403':
          description: Superadmin access required
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    AccountListResponse:
      properties:
        items:
          items:
            $ref: '#/components/schemas/AccountListItem'
          type: array
          title: Items
          description: List of accounts
        total:
          type: integer
          title: Total
          description: Total number of accounts
        page:
          type: integer
          title: Page
          description: Current page number (1-indexed)
        page_size:
          type: integer
          title: Page Size
          description: Number of items per page
        total_pages:
          type: integer
          title: Total Pages
          description: Total number of pages
      type: object
      required:
        - items
        - total
        - page
        - page_size
        - total_pages
      title: AccountListResponse
      description: Paginated response for account list.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AccountListItem:
      properties:
        id:
          type: string
          title: Id
          description: Account ID (UUID)
        account_code:
          type: string
          title: Account Code
          description: Human-readable account code in XX#### format (e.g., AB1234)
        slug:
          type: string
          title: Slug
          description: URL-friendly account identifier
        name:
          type: string
          title: Name
          description: Display name for the account
        created_at:
          type: string
          format: date-time
          title: Created At
          description: When the account was created
        user_count:
          type: integer
          title: User Count
          description: Number of users in this account
        status:
          type: string
          title: Status
          description: Account status
          default: active
      type: object
      required:
        - id
        - account_code
        - slug
        - name
        - created_at
        - user_count
      title: AccountListItem
      description: Account item in list view with statistics.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````