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

# Search Flow Classification

> Classify whether a query should be answered by search or by chat. This powers the query bar in the Onyx Search UI.

Queries longer than 200 characters are classified as a chat flow without calling an LLM. If classification fails, the endpoint falls back to `is_search_flow: false` rather than erroring.

<Info>
  **Required permission:** Search — Read (`read:search`), which `basic` includes, so any signed-in user has it.
  A limited [Personal Access Token](/developers/overview#personal-access-tokens) needs the Search — Read scope.
</Info>

<Note>
  A helper for query bars that offer both search and chat:
  it costs one small LLM call and answers whether a query reads like a document search. It is a routing hint,
  not a guarantee — queries over 200 characters are called a chat flow without asking the LLM at all,
  and a failed classification returns `is_search_flow: false` rather than an error.
</Note>


## OpenAPI

````yaml POST /search/search-flow-classification
openapi: 3.1.0
info:
  title: Onyx API
  description: Onyx API for AI-powered enterprise search and chat
  version: Development
servers:
  - url: https://cloud.onyx.app/api
security: []
paths:
  /search/search-flow-classification:
    post:
      tags:
        - public
      summary: Search Flow Classification
      description: >-
        Classify whether a query should be answered by search or by chat. This
        powers the query bar in the Onyx Search UI.


        Queries longer than 200 characters are classified as a chat flow without
        calling an LLM. If classification fails, the endpoint falls back to
        `is_search_flow: false` rather than erroring.
      operationId: search_flow_classification
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SearchFlowClassificationRequest'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SearchFlowClassificationResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - BearerAuth: []
components:
  schemas:
    SearchFlowClassificationRequest:
      properties:
        user_query:
          type: string
          title: User Query
          description: The query to classify.
      type: object
      required:
        - user_query
      title: SearchFlowClassificationRequest
    SearchFlowClassificationResponse:
      properties:
        is_search_flow:
          type: boolean
          title: Is Search Flow
          description: >-
            True when the query looks like a search for documents, false when it
            should be sent to chat.
      type: object
      required:
        - is_search_flow
      title: SearchFlowClassificationResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      description: Authorization header with Bearer token

````