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

# Search Documents

> Search for documents using sort, filter and pagination.



## OpenAPI

````yaml POST /document/search
openapi: 3.0.1
info:
  title: Machina Sports SDK
  description: >-
    Machina Sports API for seamless AI integration in sports, offering real-time
    insights, personalized content, and fan sentiment analysis.
  version: '1.0'
  termsOfService: http://machina.gg/tos/
  contact:
    email: support@machina.gg
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://{api-address}.org.machina.gg
    description: Production server
    variables:
      api-address:
        default: https://api.machina.gg
        description: Your api-address
  - url: http://local.machina:5001
    description: Local development server
security:
  - ApiToken: []
paths:
  /document/search:
    post:
      tags:
        - documents
      summary: Search Documents
      description: Search for documents using sort, filter and pagination.
      operationId: searchDocuments
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                filters:
                  type: object
                  description: Filter criteria for the search
                  default: {}
                  example: {}
                sorters:
                  type: array
                  description: Sorting instructions (field name and direction)
                  items:
                    type: string
                  default:
                    - _id
                    - -1
                  example:
                    - name
                    - 1
                page:
                  type: integer
                  default: 1
                  description: Page number for pagination
                  example: 1
                page_size:
                  type: integer
                  default: 10
                  description: Number of results per page
                  example: 10
              example:
                filters: {}
                sorters:
                  - name
                  - 1
                page: 1
                page_size: 10
      responses:
        '200':
          description: Search results
          content:
            application/json:
              schema:
                type: object
                properties:
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        _id:
                          type: string
                          description: Unique identifier of the document
                          example: 67e1fc8c2a5ade8c69c03fe7
                        name:
                          type: string
                          description: Unique name of the document
                          example: New test document
                        value:
                          type: object
                          description: The main data of the document
                          example:
                            chat:
                              - What is Lorem Ipsum?
                              - >-
                                Lorem Ipsum is simply dummy text of the printing
                                and typesetting industry. Lorem Ipsum has been
                                the industry's standard dummy text ever since
                                the 1500s, when an unknown printer took a galley
                                of type and scrambled it to make a type specimen
                                book.
                              - ' It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'
                        metadata:
                          type: object
                          description: Additional metadata for the document
                          example:
                            agent_id: '123'
                        status:
                          type: string
                          description: Current status of the document
                          example: null
                        created:
                          type: string
                          description: Creation timestamp
                          example: Tue, 25 Mar 2025 00:45:00 GMT
                        updated:
                          type: string
                          description: Update timestamp
                          example: Tue, 25 Mar 2025 00:45:00 GMT
                        date:
                          type: string
                          description: Document date derived from ID
                          example: Tue, 25 Mar 2025 00:45:00 GMT
                        embed-vector:
                          type: boolean
                          description: Whether a vector embedding was created
                          example: false
                    description: Array of matching documents
                  total_documents:
                    type: integer
                    description: Total number of matching documents
                    example: 4
                  status:
                    type: boolean
                    description: Operation status
                    example: true
                example:
                  data:
                    - _id: 67e1fc8c2a5ade8c69c03fe7
                      created: Tue, 25 Mar 2025 00:45:00 GMT
                      date: Tue, 25 Mar 2025 00:45:00 GMT
                      embed-vector: false
                      metadata:
                        agent_id: '123'
                      name: New test document
                      status: null
                      updated: Tue, 25 Mar 2025 00:45:00 GMT
                      value:
                        chat:
                          - What is Lorem Ipsum?
                          - >-
                            Lorem Ipsum is simply dummy text of the printing and
                            typesetting industry. Lorem Ipsum has been the
                            industry's standard dummy text ever since the 1500s,
                            when an unknown printer took a galley of type and
                            scrambled it to make a type specimen book.
                          - ' It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.'
                  status: true
                  total_documents: 4
        '400':
          description: Invalid search parameters
        '401':
          description: Unauthorized
components:
  securitySchemes:
    ApiToken:
      type: apiKey
      name: x-api-token
      in: header
      description: API key authentication

````