> ## 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.

# Deals performance by sales rep

> Per-rep pipeline metrics (won, lost, new, open $ and counts) plus activity counts (emails sent, tasks completed, platform activity) for the period. Every configured rep appears even with zero deals.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /deals/reporting/_by_rep
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/reporting/_by_rep:
    post:
      tags:
        - deals
      summary: Deals performance by sales rep
      description: >-
        Per-rep pipeline metrics (won, lost, new, open $ and counts) plus
        activity counts (emails sent, tasks completed, platform activity) for
        the period. Every configured rep appears even with zero deals.
      requestBody:
        $ref: '#/components/requestBodies/pkg_routes_deals_reporting.ReportingRequest'
      responses:
        '200':
          description: Per-rep performance
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pkg_routes_deals_reporting.ByRepResponse'
        '400':
          description: Bad request - invalid request body
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '403':
          description: Forbidden - deals analytics not enabled
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                additionalProperties: true
      security:
        - ApiKeyAuth: []
components:
  requestBodies:
    pkg_routes_deals_reporting.ReportingRequest:
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/pkg_routes_deals_reporting.ReportingRequest'
      description: Reporting request
      required: true
  schemas:
    pkg_routes_deals_reporting.ByRepResponse:
      type: object
      properties:
        end_date:
          type: string
        reps:
          type: array
          items:
            $ref: '#/components/schemas/pkg_routes_deals_reporting.RepRow'
        start_date:
          type: string
    pkg_routes_deals_reporting.ReportingRequest:
      type: object
      properties:
        assignee:
          description: empty = all reps per settings
          type: array
          items:
            type: string
        bucket_unit:
          description: 'timeseries only: day | week | month (default: by range length)'
          type: string
        compare_previous:
          type: boolean
        end_date:
          type: string
        funnel:
          description: nil = all funnels
          type: string
        start_date:
          type: string
        timezone:
          type: string
    pkg_routes_deals_reporting.RepRow:
      type: object
      properties:
        activity_count:
          type: integer
        emails_sent:
          type: integer
        lost_count:
          type: integer
        lost_total:
          type: number
        name:
          type: string
        new_count:
          type: integer
        new_total:
          type: number
        open_count:
          type: integer
        open_total:
          type: number
        rep:
          type: string
        tasks_completed:
          type: integer
        won_count:
          type: integer
        won_total:
          type: number
  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.