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

# Return a list of Knowledge Base Items.



## OpenAPI

````yaml /api-reference/openapi.json get /v1/voice-agents/knowledge-base/list
openapi: 3.0.1
info:
  title: Hamsa API
  description: Trying out our transcription and media-to-text APIs
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.tryhamsa.com
security: []
paths:
  /v1/voice-agents/knowledge-base/list:
    get:
      summary: Return a list of Knowledge Base Items.
      parameters:
        - name: voiceAgentId
          in: query
          schema:
            type: string
            description: >-
              Optional UUID of the voice agent to filter associated knowledge
              bases items.
            example: d949f13f-40d2-4e48-ac86-b66633070603
          required: false
        - name: isActive
          in: query
          schema:
            type: boolean
            description: >-
              Optional boolean indicating whether to fetch active knowledge base
              items.
            example: true
          required: false
        - name: used
          in: query
          schema:
            type: string
            description: >-
              Optional boolean-like string indicating whether to fetch used
              knowledge base items in any voice agent.
            example: 'true'
          required: false
        - name: skip
          in: query
          schema:
            type: string
            description: Page number for pagination. Defaults to '1'.
            example: '1'
          required: false
        - name: take
          in: query
          schema:
            type: string
            description: Number of items to take for pagination. Defaults to '10'.
            example: '10'
          required: false
        - name: search
          in: query
          schema:
            type: string
            description: A search query to filter knowledge base items' names.
            example: Product Catalog
          required: false
        - name: type
          in: query
          schema:
            type: array
            items:
              type: string
              enum:
                - TEXT
                - URL
                - FILE
            description: An array of knowledge base item type to filter by.
            example:
              - TEXT
              - URL
          required: false
        - name: status
          in: query
          schema:
            type: array
            items:
              type: string
              enum:
                - PROCESSED
                - FAILED
                - COMPLETED_WITH_ERRORS
                - UPLOAD_FAILURE
                - READING_FAILURE
                - INGESTION_FAILURE
            description: An array of knowledge base item status to filter by.
            example:
              - INGESTION_FAILURE
              - PROCESSED
          required: false
        - name: extensions
          in: query
          schema:
            type: array
            items:
              type: string
              enum:
                - pdf
                - docx
                - doc
                - txt
                - html
                - epub
            description: >-
              An array of knowledge base item extensions to filter by when the
              type is FILE.
            example:
              - pdf
              - txt
              - html
          required: false
        - name: sortField
          in: query
          schema:
            type: string
            enum:
              - words
              - createdAt
              - fileSize
            description: The field name to sort the results by
            example: createdAt
          required: false
        - name: sortOrder
          in: query
          schema:
            type: string
            enum:
              - asc
              - desc
            description: Sort order. Can be 'asc' or 'desc'.
            example: asc
          required: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ListKnowledgeBaseItemsResponse'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
        '500':
          description: Server Side Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorSchema'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    ListKnowledgeBaseItemsResponse:
      type: object
      properties:
        success:
          type: boolean
          default: false
        message:
          type: string
          default: success
        data:
          type: object
          properties:
            total:
              type: number
              description: The total number of knowledge base items over all pages.
              example: 100
            filtered:
              type: number
              description: The filtered/returned number of knowledge base items.
              example: 100
            items:
              type: array
              items:
                $ref: '#/components/schemas/KnowledgeBaseItem'
    ErrorSchema:
      type: object
      properties:
        code:
          type: integer
        message:
          type: string
    KnowledgeBaseItem:
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the knowledge base item.
          example: 550e8400-e29b-41d4-a716-446655440000
        userId:
          type: string
          description: The user ID associated with the knowledge base item.
          example: 550e8400-e29b-41d4-a716-446655440000
        projectId:
          type: string
          description: The project ID associated with the knowledge base item.
          example: 550e8400-e29b-41d4-a716-446655440000
        itemName:
          type: string
          description: The name of the knowledge base item.
          example: Product Documentation
        fileSize:
          type: string
          description: The size of the file.
          example: 2.5MB
        type:
          type: string
          description: The type of the knowledge base item.
          enum:
            - TEXT
            - URL
            - FILE
          example: TEXT
        status:
          type: string
          description: The current status of the knowledge base item.
          example: PROCESSED
        failureReason:
          type: string
          description: The reason for failure if the item processing failed.
          example: File format not supported
        content:
          type: string
          description: The text content of the knowledge base item.
          example: This is the content of the knowledge base item...
        itemUrl:
          type: string
          description: The URL of the knowledge base item.
          example: https://example.com/document.pdf
        itemUrls:
          type: array
          description: The URLs of the item (required when the type is URL).
          items:
            type: string
            description: The URL item of the URLs array (required when the type is URL).
            example: https://example.com/document.pdf
          example:
            - https://example.com/document.pdf
        wordsNumber:
          type: number
          description: The words count in the knowledge base item.
          example: 1298
        extension:
          type: string
          description: The extension of the knowledge base item in case it was a file.
          example: 1298
        createdAt:
          type: string
          format: date-time
          description: The timestamp when the knowledge base item was created.
          example: '2024-01-15T10:30:00Z'
        isActive:
          type: boolean
          description: >-
            Indicates whether the knowledge base item is currently active in any
            voice agent.
          example: true
        used:
          type: boolean
          description: >-
            Indicates whether the knowledge base item is currently used in any
            voice agent. Can be used in filtering.
          example: true
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: Authorization
      description: >-
        Pass the API key in the Authorization header, You need to put Token
        keyword before the API key. e.g. 'Authorization: Token <api-key>'

````