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

# Query documents

> Search an index with a query and return the most similar documents.



## OpenAPI

````yaml post /projects/{projectId}/indexes/{indexName}/query
openapi: 3.1.1
info:
  title: Wrtn AIMP API
  summary: Wrtn AIMP Open API Spec
  version: 1.0.0
servers:
  - url: https://{baseUrl}/{version}
    description: AIMP API endpoints
    variables:
      baseUrl:
        enum:
          - qqcyn6e2xc.execute-api.ap-northeast-2.amazonaws.com
        default: qqcyn6e2xc.execute-api.ap-northeast-2.amazonaws.com
      version:
        enum:
          - v1beta1
        default: v1beta1
security: []
paths:
  /projects/{projectId}/indexes/{indexName}/query:
    post:
      description: Search an index with a query and return the most similar documents.
      parameters:
        - $ref: '#/components/parameters/ContentType'
        - $ref: '#/components/parameters/ProjectApiKey'
        - $ref: '#/components/parameters/ProjectId'
        - $ref: '#/components/parameters/IndexName'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                size:
                  type: integer
                  description: >-
                    Number of documents to return. Note that the maximum number
                    of documents is 1000.
                query:
                  type: object
                  description: Query object.
                consistentRead:
                  $ref: '#/components/schemas/ConsistentRead'
                includeVectors:
                  $ref: '#/components/schemas/IncludeVectors'
                sort:
                  type: array
                  description: List of field name, sort direction pairs.
                  items:
                    type: object
                trackScores:
                  type: boolean
                  description: >-
                    If your application needs to track scores with sorting, set
                    trackScores to true.
                  default: false
              required:
                - size
      responses:
        '200':
          description: Documents selected by query.
          content:
            application/json:
              schema:
                type: object
                properties:
                  took:
                    type: integer
                    description: Elapsed time in milliseconds.
                  maxScore:
                    type: number
                    description: Maximum score.
                  total:
                    type: integer
                    description: Total number of documents returned.
                  docs:
                    type: array
                    description: List of documents.
                    items:
                      type: object
                      properties:
                        index:
                          type: string
                          description: Index name.
                        score:
                          type: number
                          description: Document similarity score.
                        doc:
                          type: object
components:
  parameters:
    ContentType:
      in: header
      name: content-type
      required: true
      schema:
        type: string
        default: application/json
    ProjectApiKey:
      in: header
      name: x-api-key
      description: Project API Key.
      required: true
      schema:
        type: string
        description: Project API Key.
    ProjectId:
      in: path
      name: projectId
      description: Project ID.
      required: true
      schema:
        type: string
    IndexName:
      in: path
      name: indexName
      description: Index name.
      required: true
      schema:
        type: string
  schemas:
    ConsistentRead:
      type: boolean
      default: false
      description: >-
        If your application requires a strongly consistent read, set
        consistentRead to true. Although a strongly consistent read might take
        more time than an eventually consistent read, it always returns the last
        updated value.
    IncludeVectors:
      type: boolean
      default: false
      description: >-
        If your application need to include vector values in the response, set
        includeVectors to true.

````