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

# Query company rows

> Company table rows with every cell resolved. Default columns: name, status, value, pulse, tags, primary contact, plan consultant, financial advisor, plan count, active-project count, payroll status. Opt-in via `columns`: notes, created_at, won_value. The light-mode sibling of /clients/_list — one flat row per company instead of a client document plus side lists. Role names default to "Primary Contact", "Plan Consultant" and "Financial Advisor" and can be overridden per request via `roles`.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /clients/_query
openapi: 3.0.0
info:
  description: CX API.
  title: CX API
  contact:
    name: API Support
    url: https://stax.ai
    email: support@stax.ai
  version: '1.0'
servers:
  - url: https://api.cx.stax.ai
security: []
paths:
  /clients/_query:
    post:
      tags:
        - clients
      summary: Query company rows
      description: >-
        Company table rows with every cell resolved. Default columns: name,
        status, value, pulse, tags, primary contact, plan consultant, financial
        advisor, plan count, active-project count, payroll status. Opt-in via
        `columns`: notes, created_at, won_value. The light-mode sibling of
        /clients/_list — one flat row per company instead of a client document
        plus side lists. Role names default to "Primary Contact", "Plan
        Consultant" and "Financial Advisor" and can be overridden per request
        via `roles`.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_clients.QueryCompaniesRequest'
        description: Query companies request
        required: true
      responses:
        '200':
          description: Company rows
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_clients.QueryCompaniesResponse'
        '400':
          description: Bad request - invalid request body
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  schemas:
    pkg_routes_clients.QueryCompaniesRequest:
      type: object
      properties:
        columns:
          description: >-
            Columns names the optional cells to add to the default response. See
            the

            companyCol* constants for what a company row can be asked for.
          type: array
          items:
            type: string
        filters:
          $ref: '#/components/schemas/pkg_routes_clients.QueryCompaniesFilters'
        page:
          $ref: '#/components/schemas/types.ListPagination'
        roles:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.RoleNames'
        sort:
          $ref: '#/components/schemas/types.ListSort'
    pkg_routes_clients.QueryCompaniesResponse:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_clients.CompanyRow'
        total:
          type: integer
    pkg_routes_clients.QueryCompaniesFilters:
      type: object
      properties:
        assignee:
          type: array
          items:
            type: string
        created:
          $ref: '#/components/schemas/types.ListFilterDate'
        data:
          type: array
          items:
            $ref: '#/components/schemas/types.ListFilterData'
        ids:
          type: array
          items:
            type: string
        payroll_provider:
          type: array
          items:
            type: string
        payroll_status:
          type: array
          items:
            type: string
        search:
          type: string
        status:
          type: array
          items:
            type: string
        tags:
          type: array
          items:
            type: string
    types.ListPagination:
      type: object
      properties:
        limit:
          type: integer
        skip:
          type: integer
    stax_ai_cx_cx-api_pkg_routes_query.RoleNames:
      type: object
      properties:
        advisor:
          type: string
        consultant:
          type: string
        consultant_fallback:
          type: string
        contact:
          type: string
    types.ListSort:
      type: object
      properties:
        field:
          type: string
        last: {}
        order:
          type: integer
    pkg_routes_clients.CompanyRow:
      type: object
      properties:
        _id:
          type: string
        created_at:
          type: string
        financial_advisor:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.Person'
        n_active_projects:
          type: integer
        n_plans:
          type: integer
        name:
          type: string
        notes:
          description: >-
            Notes and CreatedAt are opt-in; both are null unless their column
            was

            requested, which is what tells an empty note from an unasked-for
            one.
          type: string
        payroll_status:
          type: string
        plan_consultant:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.Person'
        primary_contact:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.Person'
        pulse:
          description: >-
            Pulse is the company's overall score, null when none has been
            recorded.
          type: integer
        status:
          type: string
        tags:
          type: array
          items:
            type: string
        value:
          description: >-
            Value is the sum of every deal on the company, zero when it has
            none.

            WonValue is the won subset, and is only populated when asked for.
          type: number
        won_value:
          type: number
    types.ListFilterDate:
      type: object
      properties:
        after:
          type: string
        before:
          type: string
    types.ListFilterData:
      type: object
      properties:
        key:
          type: string
        op:
          type: string
        value: {}
    stax_ai_cx_cx-api_pkg_routes_query.Person:
      type: object
      properties:
        _id:
          type: string
        email:
          type: string
        name:
          type: string
        role:
          type: string
  securitySchemes:
    ApiKeyAuth:
      description: CX API key. Create one in CX under Settings → Advanced → API Keys.
      in: header
      name: x-api-key
      type: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.