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

# Count the leads of a selection

> The number of leads a bulk action with the same body would act on, for a confirmation such as "1,238 leads
     * will be moved". With `select_all` it equals the `meta.total` of `GET /leads` with the same filters; with
`lead_ids` it is the number of those leads the caller can see.



## OpenAPI

````yaml post /v1/leads/bulk-count
openapi: 3.1.0
info:
  title: Flextell API
  version: 0.0.1
  description: >-
    Flextell REST API referansı. Kimlik doğrulama, scope ve istek kuralları için
    API sekmesindeki rehberlere bakın.
servers:
  - url: https://app.flextell.ai/api
    description: Üretim
security:
  - oauth2: []
  - bearer: []
paths:
  /v1/leads/bulk-count:
    post:
      tags:
        - Lead
      summary: Count the leads of a selection
      description: >-
        The number of leads a bulk action with the same body would act on, for a
        confirmation such as "1,238 leads
             * will be moved". With `select_all` it equals the `meta.total` of `GET /leads` with the same filters; with
        `lead_ids` it is the number of those leads the caller can see.
      operationId: lead.bulkCount
      parameters:
        - name: X-Tenant
          in: header
          required: true
          description: >-
            Tenant identifier. Send the Tenant ID in the `X-Tenant` header to
            scope API requests to a specific tenant.
          schema:
            type: number
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LeadBulkCountRequest'
      responses:
        '200':
          description: ''
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                  data:
                    type: object
                    properties:
                      count:
                        type: integer
                    required:
                      - count
                required:
                  - success
                  - data
        '401':
          $ref: '#/components/responses/AuthenticationException'
        '403':
          $ref: '#/components/responses/AuthorizationException'
        '422':
          $ref: '#/components/responses/ValidationException'
        '428':
          description: >-
            Mandatory setup is incomplete. Finish the setup wizard first;
            `data.next_step` names the step to continue with.
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    examples:
                      - false
                  error_code:
                    type: string
                    enum:
                      - SETUP_REQUIRED
                    examples:
                      - SETUP_REQUIRED
                  message:
                    type: string
                    examples:
                      - Complete the required setup steps to continue.
                  data:
                    type: object
                    properties:
                      next_step:
                        type:
                          - string
                          - 'null'
                        examples:
                          - clinic_info
                    required:
                      - next_step
                required:
                  - success
                  - error_code
                  - message
                  - data
components:
  schemas:
    LeadBulkCountRequest:
      type: object
      properties:
        lead_ids:
          type: array
          description: >-
            The identifiers of the selected leads, without a limit. Send either
            these or `select_all`.
          items:
            type: integer
            description: A lead identifier.
          minItems: 1
        select_all:
          type: boolean
          description: >-
            Select every record the list shows with the filters in `filters`.
            The action then runs in the background and the response only carries
            the number of records.
        filters:
          type:
            - object
            - 'null'
          description: >-
            With `select_all`, the filters the list shows, as an object: the
            query parameters of `GET /api/v1/leads` with the same names and
            values, array parameters without the `[]`. Paging and sorting
            parameters are ignored.
          properties:
            pipeline_stage_id:
              type: array
              description: A pipeline stage ID to filter by.
              items:
                type: integer
            lead_reference_source_id:
              type: array
              description: A lead reference source ID to filter by.
              items:
                type: integer
            lost_reason_id:
              type: array
              description: A lost reason ID to filter by.
              items:
                type: integer
            assigned_user_id:
              type: array
              description: An assigned user ID to filter by.
              items:
                type: integer
            converted:
              type:
                - boolean
                - 'null'
              description: Filter by converted status (true for converted leads).
            active:
              type:
                - boolean
                - 'null'
              description: >-
                Filter by active status: `true` returns leads that are neither
                converted nor in a won or

                lost stage (the definition the lead cap and the salesperson's
                `active_lead_count` use),

                `false` returns the rest.
            unassigned:
              type:
                - boolean
                - 'null'
              description: >-
                When `true`, return only active leads that have no assigned user
                (the board's

                "unassigned" quick filter). `false` applies no filter.
            search:
              type:
                - string
                - 'null'
              description: The search query.
              maxLength: 255
            created_at_from:
              type:
                - string
                - 'null'
              format: date-time
              description: Filter by creation date (inclusive lower bound).
            created_at_to:
              type:
                - string
                - 'null'
              format: date-time
              description: Filter by creation date (inclusive upper bound).
            converted_at_from:
              type:
                - string
                - 'null'
              format: date-time
              description: Filter by conversion date (inclusive lower bound).
            converted_at_to:
              type:
                - string
                - 'null'
              format: date-time
              description: Filter by conversion date (inclusive upper bound).
        except_ids:
          type:
            - array
            - 'null'
          description: >-
            With `select_all`, the identifiers of the records to leave out, at
            most 1000.
          items:
            type: integer
            description: A record identifier to leave out.
            minimum: 1
          maxItems: 1000
      title: LeadBulkCountRequest
  responses:
    AuthenticationException:
      description: Unauthenticated
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    AuthorizationException:
      description: Authorization error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Error overview.
            required:
              - message
    ValidationException:
      description: Validation error
      content:
        application/json:
          schema:
            type: object
            properties:
              message:
                type: string
                description: Errors overview.
              errors:
                type: object
                description: A detailed description of each field that failed validation.
                additionalProperties:
                  type: array
                  items:
                    type: string
            required:
              - message
              - errors
  securitySchemes:
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://app.flextell.ai/oauth/authorize
          tokenUrl: https://app.flextell.ai/oauth/token
          scopes:
            '*': all
    bearer:
      type: http
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.