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

# Advanced query with filtering

> Executes advanced queries with complex filtering, grouping, sorting, and aggregation capabilities.



## OpenAPI

````yaml openapi.json post /tables/{tableId}/rows/query
openapi: 3.0.0
info:
  title: Aurora Database API
  description: >-
    Comprehensive database management API providing dynamic database
    connections, real-time table operations, advanced querying, and transaction
    logging. Supports both managed PostgreSQL databases and external database
    connections with full CRUD operations.
  contact:
    name: Aurora Development Team
    email: support@aurora.com
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
  version: '1.0'
servers:
  - url: /api
    description: Aurora API Server
security:
  - sanctum: []
tags:
  - name: Database Management
    description: >-
      🗄️ **Create, manage, and connect databases** - Start here to set up your
      PostgreSQL databases or connect to existing ones. These endpoints let you
      create managed databases, test connections, and handle basic database
      operations.
  - name: Table Operations
    description: >-
      📊 **Design your data structure** - Build and manage tables within your
      databases. Create tables with custom names, get table information, and
      organize your data structure exactly how you need it.
  - name: Column Management
    description: >-
      🏗️ **Define your data fields** - Add columns to your tables with various
      data types like text, numbers, dates, and more. Configure column
      properties, validation rules, and organize your data schema.
  - name: Formula Management
    description: >-
      🧮 **Create calculated fields** - Build dynamic Formula columns that
      automatically calculate values based on other columns in your table.
      Perfect for CRM calculations like deal values, commissions, and lead
      scoring.
  - name: Data Operations
    description: >-
      📝 **Work with your data** - The core endpoints for managing your actual
      data. Insert new records, update existing ones, delete data, and retrieve
      information with powerful filtering and search capabilities.
  - name: Advanced Queries
    description: >-
      🔍 **Powerful data analysis** - Advanced querying capabilities including
      complex filtering, aggregations, grouping, and custom search operations.
      Perfect for analytics and reporting.
  - name: Transaction History
    description: >-
      📋 **Audit and monitoring** - Track all changes and operations performed
      on your databases. View transaction logs, get statistics, and maintain a
      complete audit trail of your data operations.
  - name: Account
    description: Account
  - name: Agents
    description: Agents
  - name: Agents - Skills
    description: Agents - Skills
  - name: Agents - Tools
    description: Agents - Tools
  - name: Agents - Runs
    description: Agents - Runs
  - name: Row Comments
    description: Row Comments
  - name: Bulk Data Operations
    description: Bulk Data Operations
  - name: Browser Utilities
    description: Browser Utilities
  - name: Utility Management
    description: Utility Management
  - name: File Utilities
    description: File Utilities
  - name: Image Utilities
    description: Image Utilities
  - name: Media Utilities
    description: Media Utilities
  - name: Vector Collections
    description: Vector Collections
  - name: Vector Store
    description: Vector Store
  - name: Vector Points
    description: Vector Points
  - name: Vector Search
    description: Vector Search
paths:
  /tables/{tableId}/rows/query:
    post:
      tags:
        - Advanced Queries
      summary: Advanced query with filtering
      description: >-
        Executes advanced queries with complex filtering, grouping, sorting, and
        aggregation capabilities.
      operationId: advancedTableQuery
      parameters:
        - name: tableId
          in: path
          description: Table ID
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Advanced query configuration
        required: true
        content:
          application/json:
            schema:
              properties:
                pagination:
                  properties:
                    page:
                      type: integer
                      default: 1
                    per_page:
                      type: integer
                      default: 100
                      maximum: 1000
                  type: object
                filterTree:
                  properties:
                    op:
                      type: string
                      enum:
                        - AND
                        - OR
                    conditions:
                      type: array
                      items:
                        properties:
                          field:
                            type: string
                          operator:
                            type: string
                            enum:
                              - equals
                              - not_equal
                              - lt
                              - lte
                              - gt
                              - gte
                              - between
                              - in
                              - not_in
                              - contains
                              - not_contains
                              - starts_with
                              - ends_with
                              - is_null
                              - is_not_null
                              - blank
                              - not_blank
                          value: {}
                        type: object
                  type: object
                sort:
                  type: array
                  items:
                    properties:
                      field:
                        type: string
                      dir:
                        type: string
                        enum:
                          - asc
                          - desc
                    type: object
                groupBy:
                  type: array
                  items:
                    type: string
                aggregations:
                  type: array
                  items:
                    properties:
                      field:
                        type: string
                      type:
                        type: string
                        enum:
                          - count
                          - sum
                          - avg
                          - min
                          - max
                          - countdistinct
                      alias:
                        type: string
                    type: object
              type: object
      responses:
        '200':
          description: Query executed successfully
          content:
            application/json:
              schema:
                properties:
                  data:
                    type: array
                    items:
                      type: object
                  current_page:
                    type: integer
                  per_page:
                    type: integer
                  total:
                    type: integer
                  last_page:
                    type: integer
                type: object
        '404':
          description: Table not found
          content:
            application/json:
              schema:
                properties:
                  error:
                    type: string
                    example: Table not found
                type: object
        '422':
          description: Invalid query parameters
          content:
            application/json:
              schema:
                properties:
                  message:
                    type: string
                  errors:
                    type: object
                type: object
      security:
        - sanctum: []
components:
  securitySchemes:
    sanctum:
      type: apiKey
      description: Enter token in format (Bearer <token>)
      name: Authorization
      in: header

````