> ## Documentation Index
> Fetch the complete documentation index at: https://pmxt-sync-hosted-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Execute a read-only SQL query against ClickHouse



## OpenAPI

````yaml /api-reference/openapi-hosted.json post /v0/sql
openapi: 3.0.0
info:
  title: PMXT Hosted Router API
  description: Hosted-only endpoints for cross-venue search, matching, arbitrage, and SQL.
  version: 3bed49d
servers:
  - url: https://api.pmxt.dev
    description: Production
security:
  - bearerAuth: []
paths:
  /v0/sql:
    post:
      tags:
        - SQL
      summary: Execute a read-only SQL query against ClickHouse
      operationId: postV0Sql
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - query
              properties:
                query:
                  type: string
                  example: SELECT * FROM markets LIMIT 10
      responses:
        '200':
          description: Query executed successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                    example:
                      - column1: value1
                  meta:
                    type: object
                    properties:
                      columns:
                        type: array
                        items:
                          type: object
                          properties:
                            name:
                              type: string
                            type:
                              type: string
                        example:
                          - name: column1
                            type: String
                      rows:
                        type: integer
                        example: 1
                      statistics:
                        type: object
                        properties:
                          elapsed:
                            type: number
                            example: 0.005
                          rows_read:
                            type: integer
                            example: 100
                          bytes_read:
                            type: integer
                            example: 5000
        '400':
          description: Invalid or disallowed query
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: query_error
                  message:
                    type: string
        '403':
          description: Enterprise plan required
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: sql_access_denied
                  message:
                    type: string
                    example: SQL query access requires an Enterprise plan
        '408':
          description: Query timed out
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: query_timeout
                  message:
                    type: string
                    example: Query exceeded the maximum execution time (5s)
        '503':
          description: ClickHouse not configured
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: service_unavailable
                  message:
                    type: string
                    example: SQL query service is not available
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Required when calling the hosted API directly (curl, requests, fetch).
        SDK users pass credentials via constructor params instead.

````