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

# Close gap

> Compares the sales goal for the period against closed-won bookings and reports the remaining gap. Use the forecast endpoints for projected closures.



## OpenAPI

````yaml /api-reference/cx/swagger.json post /deals/reporting/_close_gap
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/_close_gap:
    post:
      tags:
        - deals
      summary: Close gap
      description: >-
        Compares the sales goal for the period against closed-won bookings and
        reports the remaining gap. Use the forecast endpoints for projected
        closures.
      requestBody:
        $ref: '#/components/requestBodies/pkg_routes_deals_reporting.ReportingRequest'
      responses:
        '200':
          description: Close gap breakdown
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/pkg_routes_deals_reporting.CloseGapResponse
        '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.CloseGapResponse:
      type: object
      properties:
        end_date:
          type: string
        gap:
          type: number
        goal:
          type: number
        has_goal:
          type: boolean
        start_date:
          type: string
        won:
          type: number
    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
  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.