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

> Deal table rows with every reference resolved: company, funnel, stage, owner, value, status, source, tags, company pulse, open company task count, close dates, closed reason, closed reason detail, last stage move and created date. The light-mode sibling of /deals/_list — one flat row per deal, and unlike the list it does not scan the caller's mailbox for per-company message counts.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /deals/_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:
  /deals/_query:
    post:
      tags:
        - deals
      summary: Query deal rows
      description: >-
        Deal table rows with every reference resolved: company, funnel, stage,
        owner, value, status, source, tags, company pulse, open company task
        count, close dates, closed reason, closed reason detail, last stage move
        and created date. The light-mode sibling of /deals/_list — one flat row
        per deal, and unlike the list it does not scan the caller's mailbox for
        per-company message counts.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/pkg_routes_deals.QueryDealsRequest'
        description: Query deals request
        required: true
      responses:
        '200':
          description: Deal rows
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_deals.QueryDealsResponse'
        '400':
          description: Bad request - invalid request body or funnel 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_deals.QueryDealsRequest:
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/pkg_routes_deals.QueryDealsFilters'
        page:
          $ref: '#/components/schemas/types.ListPagination'
        sort:
          $ref: '#/components/schemas/types.ListSort'
    pkg_routes_deals.QueryDealsResponse:
      type: object
      properties:
        rows:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals.DealRow'
        total:
          type: integer
    pkg_routes_deals.QueryDealsFilters:
      type: object
      properties:
        client:
          type: array
          items:
            type: string
        created:
          $ref: '#/components/schemas/types.ListFilterDate'
        funnel:
          type: string
        owner:
          type: array
          items:
            type: string
        search:
          type: string
        source:
          type: array
          items:
            type: string
        stage:
          type: array
          items:
            type: string
        status:
          type: array
          items:
            type: string
        tags:
          type: array
          items:
            type: string
        value:
          type: array
          items:
            $ref: '#/components/schemas/types.ListFilterData'
    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_deals.DealRow:
      type: object
      properties:
        _id:
          type: string
        close_date:
          type: string
        closed_at:
          type: string
        closed_reason:
          type: string
        closed_reason_detail:
          type: string
        company:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.CompanyRef'
        created_at:
          type: string
        funnel:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.NamedRef'
        last_activity:
          description: LastActivity is when the deal last moved between stages.
          type: string
        n_tasks:
          description: >-
            NumTasks is the count of open tasks on the deal's company, not on
            the

            deal — tasks hang off projects and companies, never off a deal.
            Matches

            the n_tasks the deal cards on /deals/_list have always shown.
          type: integer
        name:
          type: string
        owner:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.Person'
        proposal_count:
          type: integer
        proposals:
          type: array
          items:
            $ref: '#/components/schemas/types.LinkedProposalSummary'
        pulse:
          description: >-
            Pulse is the company's overall score, null when none has been
            recorded.
          type: integer
        source:
          type: string
        stage:
          $ref: '#/components/schemas/stax_ai_cx_cx-api_pkg_routes_query.NamedRef'
        status:
          type: string
        tags:
          type: array
          items:
            type: string
        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.CompanyRef:
      type: object
      properties:
        _id:
          type: string
        name:
          type: string
        status:
          type: string
    stax_ai_cx_cx-api_pkg_routes_query.NamedRef:
      type: object
      properties:
        _id:
          type: string
        name:
          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
    types.LinkedProposalSummary:
      type: object
      properties:
        _id:
          type: string
        created_at:
          type: string
        name:
          type: string
        plan_type:
          type: string
        progress:
          type: number
        status:
          type: string
        updated_at:
          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.