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

# Search leads



## OpenAPI

````yaml https://megastream25-api.closebot.com/swagger/v1/swagger.json post /lead/search
openapi: 3.0.1
info:
  title: CloseBot API
  version: v1
servers:
  - url: https://api.closebot.com
    description: CloseBot API Endpoint
security:
  - Key: []
paths:
  /lead/search:
    post:
      tags:
        - Lead
      summary: Search leads
      requestBody:
        description: The search query input.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchQueryInput'
          text/json:
            schema:
              $ref: '#/components/schemas/SearchQueryInput'
          application/*+json:
            schema:
              $ref: '#/components/schemas/SearchQueryInput'
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/SearchLeadResultDto'
            application/json:
              schema:
                $ref: '#/components/schemas/SearchLeadResultDto'
            text/json:
              schema:
                $ref: '#/components/schemas/SearchLeadResultDto'
        '401':
          description: Unauthorized
          content:
            text/plain:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
            text/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
components:
  schemas:
    SearchQueryInput:
      type: object
      properties:
        totalOnly:
          type: boolean
          nullable: true
        sourceOnlyFast:
          type: boolean
          nullable: true
        offset:
          type: integer
          description: The offset of the search results.
          format: int32
          nullable: true
        count:
          type: integer
          description: The count of the search results.
          format: int32
          nullable: true
        search:
          type: string
          description: The search query.
          nullable: true
        sourceIds:
          type: array
          items:
            type: string
          description: The source IDs.
          nullable: true
        channels:
          type: array
          items:
            type: string
          description: The channel IDs.
          nullable: true
        botIds:
          type: array
          items:
            type: string
          description: The bot IDs.
          nullable: true
        personaIds:
          type: array
          items:
            type: string
          description: The persona IDs.
          nullable: true
        minimumResponses:
          type: integer
          description: The minimum number of responses.
          format: int32
          nullable: true
        lastMessageDirection:
          type: string
          description: The last message direction.
          nullable: true
        followUpScheduled:
          type: boolean
          description: Whether the follow up is scheduled.
          nullable: true
      additionalProperties: false
    SearchLeadResultDto:
      type: object
      properties:
        leads:
          type: array
          items:
            $ref: '#/components/schemas/LeadDto'
          nullable: true
        total:
          type: integer
          format: int32
      additionalProperties: false
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    LeadDto:
      type: object
      properties:
        id:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        contactId:
          type: string
          nullable: true
        lastMessageTime:
          type: string
          format: date-time
          nullable: true
        lastMessage:
          type: string
          nullable: true
        lastMessageDirection:
          type: string
          nullable: true
        lastMessageBotId:
          type: string
          nullable: true
        mostRecentFailureReason:
          type: string
          nullable: true
        mimicSourceId:
          type: string
          nullable: true
        starred:
          type: boolean
        unread:
          type: boolean
        source:
          $ref: '#/components/schemas/LeadSourceDto'
        wontRespondUntil:
          type: string
          format: date-time
          nullable: true
        tags:
          type: array
          items:
            type: string
          nullable: true
        fields:
          type: array
          items:
            $ref: '#/components/schemas/LeadFieldDto'
          nullable: true
        instances:
          type: array
          items:
            $ref: '#/components/schemas/BotInstanceDto'
          nullable: true
      additionalProperties: false
    LeadSourceDto:
      type: object
      properties:
        name:
          type: string
          nullable: true
        id:
          type: string
          nullable: true
      additionalProperties: false
    LeadFieldDto:
      type: object
      properties:
        field:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        value:
          type: string
          nullable: true
        aiProduced:
          type: boolean
      additionalProperties: false
    BotInstanceDto:
      type: object
      properties:
        botId:
          type: string
          nullable: true
        botVersion:
          type: string
          nullable: true
        followUpTimezoneKind:
          type: string
          nullable: true
        followUpTimezone:
          type: string
          nullable: true
        followUpTime:
          type: string
          format: date-time
          nullable: true
        isSmartFollowUpTime:
          type: boolean
        scheduleRespondTime:
          type: string
          format: date-time
          nullable: true
      additionalProperties: false
  securitySchemes:
    Key:
      type: apiKey
      description: CloseBot API Key Authorization
      name: X-CB-KEY
      in: header

````