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

> Plan table rows with the company and its plan consultant resolved onto each row. Default columns: plan code, name, company name, plan consultant, plan status, type, tags, PYE, effective date. Opt-in via `columns`: company_status, plan_structure, sequence, notes, created_at. The light-mode sibling of /packages/retirement/plans/_list. Joinder plans are excluded unless `filters.include_joinders` is set. Sorting is limited to plan fields — company columns live on another collection and would force a join before paging.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /packages/retirement/plans/_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:
  /packages/retirement/plans/_query:
    post:
      tags:
        - packages
      summary: Query plan rows
      description: >-
        Plan table rows with the company and its plan consultant resolved onto
        each row. Default columns: plan code, name, company name, plan
        consultant, plan status, type, tags, PYE, effective date. Opt-in via
        `columns`: company_status, plan_structure, sequence, notes, created_at.
        The light-mode sibling of /packages/retirement/plans/_list. Joinder
        plans are excluded unless `filters.include_joinders` is set. Sorting is
        limited to plan fields — company columns live on another collection and
        would force a join before paging.
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/pkg_routes_packages_retirement_plans.QueryPlansRequest
        description: Query plans request
        required: true
      responses:
        '200':
          description: Plan rows
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/pkg_routes_packages_retirement_plans.QueryPlansResponse
        '400':
          description: Bad request - invalid request body or parent_plan ID
          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_packages_retirement_plans.QueryPlansRequest:
      type: object
      properties:
        columns:
          description: >-
            Columns names the optional cells to add to the default response. See
            the

            PlanCol* constants for what a plan row can be asked for.
          type: array
          items:
            type: string
        filters:
          $ref: >-
            #/components/schemas/pkg_routes_packages_retirement_plans.QueryPlansFilters
        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_packages_retirement_plans.QueryPlansResponse:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_packages_retirement_plans.PlanRow'
        total:
          type: integer
    pkg_routes_packages_retirement_plans.QueryPlansFilters:
      type: object
      properties:
        assignee:
          type: array
          items:
            type: string
        client:
          description: >-
            Client narrows to specific companies; Assignee narrows to the
            companies a

            user is assigned to. Both resolve onto the plan's client field, and
            a

            plan matching either one is kept.
          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
        include_joinders:
          description: >-
            IncludeJoinders keeps the joinder plans of a MEP/PEP in the result.
            It

            defaults to false on the wire, so callers wanting them must say so.
          type: boolean
        parent_plan:
          type: string
        plan_structure:
          type: array
          items:
            type: string
        pye:
          type: array
          items:
            type: string
        record_keeper:
          type: array
          items:
            type: string
        search:
          type: string
        status:
          type: array
          items:
            type: string
        tags:
          type: array
          items:
            type: string
        type:
          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_packages_retirement_plans.PlanRow:
      type: object
      properties:
        _id:
          type: string
        code:
          type: string
        company:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.CompanyRef'
        created_at:
          type: string
        effective_on:
          type: string
        name:
          type: string
        notes:
          type: string
        parent_plan:
          description: ParentPlan is set on the joinder plans of a MEP/PEP.
          type: string
        plan_consultant:
          description: >-
            PlanConsultant is the company's consultant, preferring one assigned
            to

            this plan specifically over the company-wide one.
          allOf:
            - $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.Person'
        plan_structure:
          description: >-
            The opt-in cells: all null unless their column was requested, which
            is

            what tells an empty value from one that was never asked for. Company

            status is opt-in too, and is left off the company cell without it.
          type: string
        pye:
          description: PYE is the plan year end as stored — a MM/DD string, not a date.
          type: string
        sequence:
          type: integer
        status:
          type: string
        tags:
          type: array
          items:
            type: string
        type:
          type: string
    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.CompanyRef:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        status:
          type: string
    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.