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

# Search Document (v2)

> Search document content using the v2 pipeline.



## OpenAPI

````yaml /specs/openapi-interactive.json post /api/v1/document/{document_id}/search/v2/
openapi: 3.0.3
info:
  title: Perso Interactive API
  version: 0.0.0
servers:
  - url: https://platform.perso.ai
security: []
tags:
  - name: Embed
paths:
  /api/v1/document/{document_id}/search/v2/:
    post:
      tags:
        - Session Resources
      summary: Search Document (v2)
      description: Search document content using the v2 pipeline.
      operationId: v1_document_search_v2_create
      parameters:
        - in: path
          name: document_id
          schema:
            type: string
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentSearchV2RequestRequest'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/DocumentSearchV2RequestRequest'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/DocumentSearchV2RequestRequest'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentSearchV2Response'
          description: ''
        '400':
          description: Bad Request - Invalid input data or parameters.
        '401':
          description: Unauthorized - Invalid or missing authentication credentials.
        '403':
          description: Forbidden - You do not have permission to perform this action.
        '404':
          description: Not Found - The requested resource could not be found.
        '500':
          description: Internal Server Error - An unexpected error occurred.
        '503':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse500'
              examples:
                RAGUpstreamError:
                  value:
                    type: server_error
                    errors:
                      - code: rag_upstream_error
                        detail: Failed to process upstream embedding model.
                        attr: null
          description: Failed to process upstream embedding model.
      security:
        - {}
components:
  schemas:
    DocumentSearchV2RequestRequest:
      type: object
      properties:
        text:
          type: string
          minLength: 1
          description: >-
            Query string to embed and search against the document via the v2
            pipeline.
        count:
          type: integer
          nullable: true
          description: Maximum number of matching chunks to return.
      required:
        - text
    DocumentSearchV2Response:
      type: object
      properties:
        result:
          type: array
          items:
            type: string
      required:
        - result
    ErrorResponse500:
      type: object
      properties:
        type:
          $ref: '#/components/schemas/ServerErrorEnum'
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error500'
      required:
        - errors
        - type
    ServerErrorEnum:
      enum:
        - server_error
      type: string
      description: '* `server_error` - Server Error'
    Error500:
      type: object
      properties:
        code:
          $ref: '#/components/schemas/ErrorCode500Enum'
        detail:
          type: string
        attr:
          type: string
          nullable: true
      required:
        - attr
        - code
        - detail
    ErrorCode500Enum:
      enum:
        - error
      type: string
      description: '* `error` - Error'

````