> ## Documentation Index
> Fetch the complete documentation index at: https://uiform-codex-generated-frontend-snippets.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query Table

Read a filtered, sorted, or windowed preview of a CSV table. This route is read-only; table writes replace the whole CSV.

```python Python theme={null}
rows = client.tables.query(
    table_id="workflow_table_123",
    limit=100,
)
```

```typescript TypeScript theme={null}
const rows = await client.tables.query("workflow_table_123", {
  limit: 100,
});
```

```go Go theme={null}
rows, err := client.Tables.Query(ctx, "workflow_table_123", &retab.TablesQueryParams{
  Body: map[string]any{"limit": 100},
})
```

```java Java theme={null}
// Query table rows for read-only preview.
```

```bash cURL theme={null}
curl -X POST https://api.retab.com/v1/tables/workflow_table_123/query \
  -H "Authorization: Bearer $RETAB_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"limit":100}'
```


## OpenAPI

````yaml POST /v1/tables/{table_id}/query
openapi: 3.1.0
info:
  title: FastAPI
  version: 0.1.0
servers:
  - url: https://api.retab.com
security: []
paths:
  /v1/tables/{table_id}/query:
    post:
      tags:
        - Tables
      summary: Table.Query
      operationId: query_table
      parameters:
        - in: path
          name: table_id
          required: true
          schema:
            type: string
            title: Table Id
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/QueryWorkflowTableRequest'
                - type: 'null'
              title: Payload
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowTableRowsResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - HTTPBearer: []
components:
  schemas:
    QueryWorkflowTableRequest:
      properties:
        filters:
          items:
            $ref: '#/components/schemas/WorkflowTableFilterRule'
          type: array
          title: Filters
          default: []
        search:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableSearchRequest'
            - type: 'null'
        case_sensitive:
          type: boolean
          title: Case Sensitive
          default: false
        select:
          items:
            type: string
          type: array
          title: Select
          default: []
        distinct:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableDistinctRequest'
            - type: 'null'
        group_by:
          items:
            type: string
          type: array
          title: Group By
          default: []
        aggregations:
          items:
            $ref: '#/components/schemas/WorkflowTableAggregationRequest'
          type: array
          title: Aggregations
          default: []
        sort:
          items:
            $ref: '#/components/schemas/WorkflowTableSortRule'
          type: array
          title: Sort
          default: []
        sample:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableSampleRequest'
            - type: 'null'
        tail:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableTailRequest'
            - type: 'null'
        count_only:
          type: boolean
          title: Count Only
          default: false
        include_explain:
          type: boolean
          title: Include Explain
          default: false
        sort_column:
          anyOf:
            - type: string
            - type: 'null'
          title: Sort Column
        sort_direction:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableSortDirection'
            - type: 'null'
        viewer_mode:
          anyOf:
            - type: string
              const: windowed
            - type: 'null'
          title: Viewer Mode
        offset:
          type: integer
          minimum: 0
          title: Offset
          default: 0
        limit:
          anyOf:
            - type: integer
              maximum: 500
              minimum: 1
            - type: 'null'
          title: Limit
      type: object
      title: QueryWorkflowTableRequest
    WorkflowTableRowsResponse:
      properties:
        table_id:
          type: string
          title: Table Id
        columns:
          items:
            $ref: '#/components/schemas/WorkflowTableColumn'
          type: array
          title: Columns
          default: []
        rows:
          items:
            $ref: '#/components/schemas/WorkflowTableRow'
          type: array
          title: Rows
          default: []
        row_count:
          type: integer
          title: Row Count
        filtered_row_count:
          anyOf:
            - type: integer
            - type: 'null'
          title: Filtered Row Count
        offset:
          type: integer
          title: Offset
          default: 0
        limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Limit
        has_more:
          type: boolean
          title: Has More
          default: false
        next_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Next Cursor
        previous_cursor:
          anyOf:
            - type: string
            - type: 'null'
          title: Previous Cursor
        explain:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableExplain'
            - type: 'null'
      type: object
      required:
        - row_count
        - table_id
      title: WorkflowTableRowsResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
          default: []
      type: object
      title: HTTPValidationError
    WorkflowTableFilterRule:
      properties:
        column:
          type: string
          title: Column
        operator:
          $ref: '#/components/schemas/WorkflowTableFilterOperator'
        value:
          title: Value
          default: null
      type: object
      required:
        - column
        - operator
      title: WorkflowTableFilterRule
    WorkflowTableSearchRequest:
      properties:
        query:
          type: string
          title: Query
        columns:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Columns
      type: object
      required:
        - query
      title: WorkflowTableSearchRequest
    WorkflowTableDistinctRequest:
      properties:
        column:
          type: string
          title: Column
      type: object
      required:
        - column
      title: WorkflowTableDistinctRequest
    WorkflowTableAggregationRequest:
      properties:
        function:
          $ref: '#/components/schemas/WorkflowTableAggregationFunction'
        column:
          anyOf:
            - type: string
            - type: 'null'
          title: Column
        alias:
          anyOf:
            - type: string
            - type: 'null'
          title: Alias
      type: object
      required:
        - function
      title: WorkflowTableAggregationRequest
    WorkflowTableSortRule:
      properties:
        column:
          type: string
          title: Column
        direction:
          $ref: '#/components/schemas/WorkflowTableSortDirection'
          default: asc
      type: object
      required:
        - column
      title: WorkflowTableSortRule
    WorkflowTableSampleRequest:
      properties:
        size:
          type: integer
          maximum: 500
          minimum: 1
          title: Size
      type: object
      required:
        - size
      title: WorkflowTableSampleRequest
    WorkflowTableTailRequest:
      properties:
        size:
          type: integer
          maximum: 500
          minimum: 1
          title: Size
      type: object
      required:
        - size
      title: WorkflowTableTailRequest
    WorkflowTableSortDirection:
      type: string
      enum:
        - asc
        - desc
      title: WorkflowTableSortDirection
    WorkflowTableColumn:
      properties:
        name:
          type: string
          title: Name
        json_schema:
          additionalProperties: true
          type: object
          title: Json Schema
          default: {}
        sample_values:
          items:
            type: string
          type: array
          title: Sample Values
          default: []
        required:
          type: boolean
          title: Required
          default: false
        unique:
          type: boolean
          title: Unique
          default: false
      type: object
      required:
        - name
      title: WorkflowTableColumn
    WorkflowTableRow:
      properties:
        id:
          type: string
          title: Id
        data:
          additionalProperties: true
          type: object
          title: Data
          default: {}
        position:
          type: integer
          title: Position
      type: object
      required:
        - id
        - position
      title: WorkflowTableRow
    WorkflowTableExplain:
      properties:
        table_id:
          type: string
          title: Table Id
        snapshot_file_id:
          type: string
          title: Snapshot File Id
          default: ''
        selected_columns:
          items:
            type: string
          type: array
          title: Selected Columns
          default: []
        filters:
          items:
            $ref: '#/components/schemas/WorkflowTableFilterRule'
          type: array
          title: Filters
          default: []
        search:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableSearchRequest'
            - type: 'null'
        sort:
          items:
            $ref: '#/components/schemas/WorkflowTableSortRule'
          type: array
          title: Sort
          default: []
        offset:
          type: integer
          title: Offset
          default: 0
        limit:
          anyOf:
            - type: integer
            - type: 'null'
          title: Limit
        distinct:
          anyOf:
            - $ref: '#/components/schemas/WorkflowTableDistinctRequest'
            - type: 'null'
        group_by:
          items:
            type: string
          type: array
          title: Group By
          default: []
        aggregations:
          items:
            $ref: '#/components/schemas/WorkflowTableAggregationRequest'
          type: array
          title: Aggregations
          default: []
      type: object
      required:
        - table_id
      title: WorkflowTableExplain
    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
          default: null
        ctx:
          type: object
          title: Context
          default: {}
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    WorkflowTableFilterOperator:
      type: string
      enum:
        - eq
        - ne
        - gt
        - gte
        - lt
        - lte
        - contains
        - not_contains
        - starts_with
        - ends_with
        - in
        - not_in
        - between
        - is_empty
        - is_not_empty
        - is_null
        - is_not_null
      title: WorkflowTableFilterOperator
    WorkflowTableAggregationFunction:
      type: string
      enum:
        - count
        - count_distinct
        - min
        - max
        - sum
        - avg
      title: WorkflowTableAggregationFunction
  securitySchemes:
    HTTPBearer:
      type: http
      scheme: bearer

````