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

# Get knowledge base

> Returns a knowledge base's details and its data sources, one page at a time.



## OpenAPI

````yaml GET /v1/ai/knowledge-base/{knowledge_base_id}
openapi: 3.1.0
info:
  title: WotNot API
  version: 1.0.0
  description: 'WotNot API: Get knowledge base.'
servers:
  - url: https://api.wotnot.io
    description: Production
security:
  - bearerAuth: []
paths:
  /v1/ai/knowledge-base/{knowledge_base_id}:
    get:
      summary: Get knowledge base
      description: >-
        Returns a knowledge base's details and its data sources, one page at a
        time.
      operationId: getKnowledgeBase
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          description: The ID of the knowledge base you want to fetch.
          schema:
            type: string
      requestBody:
        required: true
        description: Which page of data sources to return.
        content:
          application/json:
            schema:
              type: object
              required:
                - limit
                - offset
              properties:
                limit:
                  type: integer
                  description: >-
                    How many data sources to return in one page, for example
                    `100`.
                  example: 100
                offset:
                  type: integer
                  description: Where to start in the list of data sources, for example `1`.
                  example: 1
            example:
              limit: 100
              offset: 1
      responses:
        '200':
          description: >-
            Returns the knowledge base's details, one page of its data sources
            in `data_source`, and `pagination` to help you fetch the rest.
          content:
            application/json:
              schema:
                type: object
                required:
                  - ok
                  - id
                  - name
                  - total_tokens
                  - total_data_sources
                  - data_source
                  - domains
                  - pagination
                  - last_trained_at
                properties:
                  ok:
                    type: boolean
                    description: '`true` when the request worked. Errors return `false`.'
                    example: true
                  id:
                    type: integer
                    description: The knowledge base's ID.
                    example: 2451
                  name:
                    type: string
                    description: The knowledge base's name.
                    example: KNOWLEDGE_BASE_NAME
                  total_tokens:
                    type: integer
                    description: The total number of tokens used in the knowledge base.
                    example: 18450
                  total_data_sources:
                    type: integer
                    description: How many data sources the knowledge base has in total.
                    example: 12
                  data_source:
                    type: array
                    description: >-
                      One page of the knowledge base's data sources. Use
                      `pagination` to get the others.
                    items:
                      type: object
                      required:
                        - id
                        - name
                        - source
                        - token
                        - domain_id
                        - refresh_frequency
                        - last_trained_at
                        - status
                        - failed_reason
                        - type
                        - created_at
                        - created_by
                        - user_name
                      properties:
                        id:
                          type: integer
                          description: The data source's ID.
                          example: 88213
                        name:
                          type: string
                          description: The data source's name.
                          example: DATA_SOURCE_NAME
                        source:
                          type: string
                          description: >-
                            The URL the data source came from, or its content if
                            it was added as text.
                          example: DATA_SOURCE_URL_OR_CONTENT
                        token:
                          type: integer
                          description: The number of tokens used in this data source.
                          example: 1540
                        domain_id:
                          type: integer
                          description: The ID of the domain the data source belongs to.
                          example: 3107
                        refresh_frequency:
                          type:
                            - string
                            - 'null'
                          description: >-
                            How often the data source is refreshed. `null` in
                            the example.
                          example: null
                        last_trained_at:
                          type:
                            - string
                            - 'null'
                          description: >-
                            When the data source was last trained, in the format
                            `YYYY-MM-DD HH:MM:SS.ffffff`, for example
                            `2024-12-27 09:10:11.870000`.
                          example: '2024-12-27 09:10:11.870000'
                        status:
                          type: string
                          description: >-
                            Where the data source is in training: `in-progress`,
                            `trained` or `failed`.
                          example: trained
                        failed_reason:
                          type:
                            - string
                            - 'null'
                          description: Why training failed. `null` when it didn't fail.
                          example: null
                        type:
                          type: string
                          description: The data source type, for example `url`.
                          example: url
                        created_at:
                          type: string
                          description: >-
                            When the data source was added, in the format
                            `YYYY-MM-DD HH:MM:SS.ffffff`, for example
                            `2024-12-27 09:10:02.411000`.
                          example: '2024-12-27 09:10:02.411000'
                        created_by:
                          type: integer
                          description: The ID of the user who added the data source.
                          example: 5521
                        user_name:
                          type: string
                          description: The name of the user who added the data source.
                          example: USER_NAME
                  domains:
                    type: array
                    description: >-
                      The domains added to the knowledge base. Empty (`[]`) in
                      the example.
                    items:
                      type: object
                      description: >-
                        One domain added to the knowledge base with Add domain
                        data source.
                      additionalProperties: true
                  pagination:
                    type: object
                    description: Where this page sits in the full list of data sources.
                    required:
                      - limit
                      - offset
                      - total
                    properties:
                      limit:
                        type: integer
                        description: The `limit` used for this page.
                        example: 100
                      offset:
                        type: integer
                        description: The `offset` used for this page.
                        example: 1
                      total:
                        type: integer
                        description: The total number of data sources.
                        example: 12
                  last_trained_at:
                    type: string
                    description: >-
                      When the knowledge base was last trained, in the format
                      `YYYY-MM-DD HH:MM:SS.ffffff`, for example `2024-12-27
                      09:13:26.905000`.
                    example: '2024-12-27 09:13:26.905000'
              example:
                ok: true
                id: 2451
                name: KNOWLEDGE_BASE_NAME
                total_tokens: 18450
                total_data_sources: 12
                data_source:
                  - id: 88213
                    name: DATA_SOURCE_NAME
                    source: DATA_SOURCE_URL_OR_CONTENT
                    token: 1540
                    domain_id: 3107
                    refresh_frequency: null
                    last_trained_at: '2024-12-27 09:10:11.870000'
                    status: trained
                    failed_reason: null
                    type: url
                    created_at: '2024-12-27 09:10:02.411000'
                    created_by: 5521
                    user_name: USER_NAME
                domains: []
                pagination:
                  limit: 100
                  offset: 1
                  total: 12
                last_trained_at: '2024-12-27 09:13:26.905000'
        '404':
          description: The knowledge base wasn't found. Check the `knowledge_base_id`.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodedError'
              example:
                ok: false
                message: Resource not found
                error: RESOURCE_NOT_FOUND
                code: RESOURCE_NOT_FOUND
components:
  schemas:
    CodedError:
      type: object
      description: An error with a short code that says what went wrong.
      required:
        - ok
        - message
        - error
        - code
      properties:
        ok:
          type: boolean
          description: Always `false` when something went wrong.
          example: false
        message:
          type: string
          description: What went wrong, in plain words.
          example: Please reach out to support to use this feature
        error:
          type: string
          description: >-
            A short error code in capital letters, for example
            `UNAUTHORIZED_FEATURE`. Check this in your code to tell errors
            apart.
          example: UNAUTHORIZED_FEATURE
        code:
          type: string
          description: A code for the result. In these examples it matches `error`.
          example: UNAUTHORIZED_FEATURE
        status:
          type: integer
          description: >-
            The HTTP status code, repeated in the body. Not every error includes
            it.
          example: 401
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        All of WotNot's APIs use Bearer token authentication. Send your account
        token as `Bearer <token>`. You can find it in Settings > Account
        Settings > Developer. Keep it on your server: anyone who has it can call
        the API as your account.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.