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

# Query Records

> Query records from a table with filtering, sorting, and pagination



## OpenAPI

````yaml https://raw.githubusercontent.com/InsForge/InsForge/main/openapi/records.yaml get /api/database/records/{tableName}
openapi: 3.0.3
info:
  title: Insforge Records API
  version: 2.0.0
  description: PostgREST-style database record operations
servers: []
security:
  - bearerAuth: []
  - apiKey: []
paths:
  /api/database/records/{tableName}:
    get:
      tags:
        - Client
      summary: Query Records
      description: Query records from a table with filtering, sorting, and pagination
      parameters:
        - name: tableName
          in: path
          required: true
          schema:
            type: string
          description: Name of the table to query
          example: posts
        - name: limit
          in: query
          schema:
            type: integer
            default: 100
            minimum: 1
            maximum: 1000
          description: Maximum number of records to return
        - name: offset
          in: query
          schema:
            type: integer
            default: 0
            minimum: 0
          description: Number of records to skip for pagination
        - name: order
          in: query
          schema:
            type: string
          description: Sort order (e.g., "createdAt.desc", "name.asc")
          example: createdAt.desc
        - name: select
          in: query
          schema:
            type: string
          description: Comma-separated list of columns to return
          example: id,title,content
        - name: field
          in: query
          schema:
            type: string
          description: Filter by field value (e.g., "?status=eq.active", "?age=gt.18")
          example: status=eq.active
      responses:
        '200':
          description: List of records
          headers:
            X-Total-Count:
              schema:
                type: integer
              description: Total number of records matching the query
            Content-Range:
              schema:
                type: string
              description: Range of records returned (e.g., "0-99/1234")
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  additionalProperties: true
              example:
                - id: 248373e1-0aea-45ce-8844-5ef259203749
                  title: Getting Started with InsForge
                  content: This is a guide to help you get started...
                  createdAt: '2025-07-18T05:37:24.338Z'
                  updatedAt: '2025-07-18T05:37:24.338Z'
                - id: 348373e1-0aea-45ce-8844-5ef259203750
                  title: Advanced Database Queries
                  content: Learn how to write complex queries...
                  createdAt: '2025-07-19T08:15:10.123Z'
                  updatedAt: '2025-07-19T08:15:10.123Z'
        '400':
          description: Invalid query parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: INVALID_QUERY
                message: Invalid filter syntax
                statusCode: 400
                nextActions: Check PostgREST filter documentation
        '404':
          description: Table not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                error: TABLE_NOT_FOUND
                message: Table 'nonexistent' does not exist
                statusCode: 404
                nextActions: Check table name and try again
      security:
        - bearerAuth: []
        - apiKey: []
components:
  schemas:
    ErrorResponse:
      type: object
      required:
        - error
        - message
        - statusCode
      properties:
        error:
          type: string
          description: Error code for programmatic handling
          example: VALIDATION_ERROR
        message:
          type: string
          description: Human-readable error message
          example: Invalid input data
        statusCode:
          type: integer
          description: HTTP status code
          example: 400
        nextActions:
          type: string
          description: Suggested action to resolve the error
          example: Check the request body format
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
    apiKey:
      type: apiKey
      in: header
      name: x-api-key

````