> ## 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 view rows

> View table rows. Default columns: name, resource type, field count, whether it is a default view, the project templates it is used in, and created date. Opt-in via `columns`: resources_used_in (a count of the records pointing at the view, one query per resource type on the page).



## OpenAPI

````yaml /api-reference/cx/swagger.json post /library/view/_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:
  /library/view/_query:
    post:
      tags:
        - library
      summary: Query view rows
      description: >-
        View table rows. Default columns: name, resource type, field count,
        whether it is a default view, the project templates it is used in, and
        created date. Opt-in via `columns`: resources_used_in (a count of the
        records pointing at the view, one query per resource type on the page).
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_library_views.QueryViewsRequest'
        description: Query views request
        required: true
      responses:
        '200':
          description: View rows
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/pkg_routes_library_views.QueryViewsResponse
        '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_library_views.QueryViewsRequest:
      type: object
      properties:
        columns:
          description: Columns names the optional cells to add to the default response.
          type: array
          items:
            type: string
        filters:
          $ref: '#/components/schemas/pkg_routes_library_views.QueryViewsFilters'
        page:
          $ref: '#/components/schemas/types.ListPagination'
        sort:
          $ref: '#/components/schemas/types.ListSort'
    pkg_routes_library_views.QueryViewsResponse:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_library_views.ViewRow'
        total:
          type: integer
    pkg_routes_library_views.QueryViewsFilters:
      type: object
      properties:
        created:
          $ref: '#/components/schemas/types.ListFilterDate'
        ids:
          type: array
          items:
            type: string
        is_default:
          type: boolean
        on_type:
          type: array
          items:
            type: string
        search:
          type: string
    types.ListPagination:
      type: object
      properties:
        limit:
          type: integer
        skip:
          type: integer
    types.ListSort:
      type: object
      properties:
        field:
          type: string
        last: {}
        order:
          type: integer
    pkg_routes_library_views.ViewRow:
      type: object
      properties:
        _id:
          type: string
        created_at:
          type: string
        default_for:
          type: object
          additionalProperties:
            type: string
        is_default:
          description: |-
            IsDefault reports whether the view is the default for any resource
            matching DefaultFor, which carries the criteria it defaults on.
          type: boolean
        n_fields:
          description: |-
            NumFields counts the field elements on the view; the heading and
            paragraph elements that lay it out are not fields.
          type: integer
        name:
          type: string
        resource_type:
          description: >-
            ResourceType is what the view describes — Client, Plan, Project, or
            one

            of the employee/census variants.
          type: string
        resources_used_in:
          description: >-
            ResourcesUsedIn is opt-in: the number of records of ResourceType
            that

            point at this view. Null unless its column was requested.
          type: integer
        templates_used_in:
          description: TemplatesUsedIn is every project template that renders this view.
          type: array
          items:
            $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.NamedRef'
    types.ListFilterDate:
      type: object
      properties:
        after:
          type: string
        before:
          type: string
    stax_ai_cx_cx-api_pkg_routes_query.NamedRef:
      type: object
      properties:
        _id:
          type: string
        name:
          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.