> ## Documentation Index
> Fetch the complete documentation index at: https://docs.oneperfectslice.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Preview matched call count

> Returns how many calls match your filters without starting an analysis run. Use this to check scope and cost before committing to a run. Dates are required; all other filters are optional.

<Tip>Always preview before running. This call is free — it only counts matching calls without using any AI credits.</Tip>


## OpenAPI

````yaml /api/openapi.yaml post /api/public/v1/slices/{key}/preview-count
openapi: 3.1.0
info:
  title: OnePerfectSlice API
  version: 1.0.0
  description: |
    Programmatic access to OnePerfectSlice. Authenticate with a team-scoped
    API key (Bearer sk_...) obtained from Org Settings → API Keys.
servers:
  - url: https://app.oneperfectslice.ai
    description: Production
security:
  - bearerAuth: []
paths:
  /api/public/v1/slices/{key}/preview-count:
    post:
      tags:
        - Slices
      summary: Preview matched call count
      description: >-
        Returns how many calls match your filters without starting an analysis
        run. Use this to check scope and cost before committing to a run. Dates
        are required; all other filters are optional.
      operationId: previewCount
      parameters:
        - name: key
          in: path
          required: true
          schema:
            type: string
          description: Unique slice key
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SliceFilterRequest'
      responses:
        '200':
          description: Matched call count
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                properties:
                  data:
                    type: object
                    required:
                      - matchedCallCount
                    properties:
                      matchedCallCount:
                        type: integer
                        description: Number of calls matching the filters
                        example: 87
        '400':
          description: Invalid filters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              examples:
                invalidFilters:
                  value:
                    error:
                      code: INVALID_FILTERS
                      message: Filter validation failed
                dateRangeTooWide:
                  value:
                    error:
                      code: DATE_RANGE_TOO_WIDE
                      message: Maximum lookback is 90 days from today.
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          description: Slice not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: SLICE_NOT_FOUND
                  message: Slice not found
        '503':
          description: Preview count request timed out
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
              example:
                error:
                  code: PREVIEW_COUNT_TIMEOUT
                  message: Preview count request timed out
      security:
        - bearerAuth: []
components:
  schemas:
    SliceFilterRequest:
      type: object
      description: >-
        Filters for preview count. `dateFrom` and `dateTo` are required. All
        other filters are optional.
      required:
        - dateFrom
        - dateTo
      properties:
        dateFrom:
          type: string
          format: date
          description: Start date (inclusive)
          example: '2026-03-26'
        dateTo:
          type: string
          format: date
          description: End date (inclusive)
          example: '2026-04-26'
        callTypes:
          type: array
          items:
            type: string
          maxItems: 100
          description: Filter by call types
        callOwnerEmails:
          type: array
          items:
            type: string
          maxItems: 100
          description: Filter by call owner emails
        companyDomains:
          type: array
          items:
            type: string
          maxItems: 100
          description: Filter by company domains
        crmDealIds:
          type: array
          items:
            type: integer
            format: int64
          maxItems: 100
          description: Filter by CRM deal IDs
        crmCompanyIds:
          type: array
          items:
            type: integer
            format: int64
          maxItems: 100
          description: Filter by CRM company IDs
        crmDealStages:
          type: array
          items:
            type: string
          maxItems: 100
          description: Filter by CRM deal stages
          example:
            - Qualification
            - Proposal
        crmAmountMin:
          type: number
          description: Minimum CRM deal amount
        crmAmountMax:
          type: number
          description: Maximum CRM deal amount
        crmCustomFieldFilters:
          type: array
          items:
            $ref: '#/components/schemas/CrmFieldFilterValue'
          description: Custom CRM field filters
    ApiError:
      type: object
      description: Standard error envelope for all public API error responses
      required:
        - error
      properties:
        error:
          type: object
          required:
            - code
            - message
          properties:
            code:
              type: string
              description: Machine-readable UPPER_SNAKE_CASE error code
              example: INVALID_TOKEN
            message:
              type: string
              description: Human-readable error description
              example: Token is invalid
            details:
              type: object
              description: Optional additional error context
              additionalProperties: true
    CrmFieldFilterValue:
      type: object
      description: Custom CRM field filter
      required:
        - entityType
        - fieldName
        - fieldType
      properties:
        entityType:
          type: string
          enum:
            - deal
            - company
            - contact
          description: CRM entity type
        fieldName:
          type: string
          description: Field name in the CRM
        fieldType:
          type: string
          enum:
            - string
            - number
            - date
            - datetime
            - boolean
            - enumeration
          description: Data type of the field
        stringValue:
          type: string
          description: Filter value for string fields
        numberMin:
          type: number
          description: Range start for number fields
        numberMax:
          type: number
          description: Range end for number fields
        dateStart:
          type: string
          description: Range start for date/datetime fields (ISO-8601)
        dateEnd:
          type: string
          description: Range end for date/datetime fields (ISO-8601)
        booleanValue:
          type: boolean
          description: Filter value for boolean fields
        enumValues:
          type: array
          items:
            type: string
          description: Selected values for enumeration fields (multi-select)
  responses:
    Unauthorized:
      description: Authentication failed
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            missingToken:
              value:
                error:
                  code: MISSING_TOKEN
                  message: Authorization header with Bearer token is required
            invalidToken:
              value:
                error:
                  code: INVALID_TOKEN
                  message: Token is invalid
            tokenRevoked:
              value:
                error:
                  code: TOKEN_REVOKED
                  message: Token has been revoked
            tokenExpired:
              value:
                error:
                  code: TOKEN_EXPIRED
                  message: Token has expired
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key with sk_ prefix. Create one in Org Settings → API Keys.
      x-default: sk_your_api_key

````