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

# Get Knowledge Base

> ### Description
Gets the details of a knowledge base.

### Details
This API can be used to get information about a single knowledge base by ID. To use this API,         pass in the `knowledge_base_id` that was returned from your [Create Knowledge Base API](         https://scale-egp.readme.io/reference/create_knowledge_base_v2) call as a path parameter.

This API will return the details of a knowledge base including its ID, name, the embedding         model it uses, any metadata associated with the knowledge base, and the timestamps for its
creation, last-updated time.

#### Backwards Compatibility
V2 and V1 Knowledge Bases are entirely separate and not backwards compatible. Users who         have existing V1 knowledge bases will need to migrate their data to V2 knowledge bases.



## OpenAPI

````yaml https://app.stainlessapi.com/api/spec/documented/sgp/openapi.yml get /v4/knowledge-bases/{knowledge_base_id}
openapi: 3.1.0
info:
  title: EGP API V4
  description: >-
    This is the parent API for all EGP APIs. If you are looking for the EGP API,
    please go to https://api.egp.scale.com/docs.
  contact:
    name: Scale Generative AI Platform
    url: https://scale.com/genai-platform
  version: 0.1.0
servers:
  - url: https://api.egp.scale.com
security: []
tags:
  - name: Models
    description: Model API.
paths:
  /v4/knowledge-bases/{knowledge_base_id}:
    get:
      tags:
        - Knowledge Bases
      summary: Get Knowledge Base
      description: >-
        ### Description

        Gets the details of a knowledge base.


        ### Details

        This API can be used to get information about a single knowledge base by
        ID. To use this API,         pass in the `knowledge_base_id` that was
        returned from your [Create Knowledge Base API](        
        https://scale-egp.readme.io/reference/create_knowledge_base_v2) call as
        a path parameter.


        This API will return the details of a knowledge base including its ID,
        name, the embedding         model it uses, any metadata associated with
        the knowledge base, and the timestamps for its

        creation, last-updated time.


        #### Backwards Compatibility

        V2 and V1 Knowledge Bases are entirely separate and not backwards
        compatible. Users who         have existing V1 knowledge bases will need
        to migrate their data to V2 knowledge bases.
      operationId: GET-V4-/v2/knowledge-bases/{knowledge_base_id}
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Base Id
        - name: include_artifacts_status
          in: query
          required: false
          schema:
            type: boolean
            description: Optional query parameter to include a count of artifacts by status
            default: false
            title: Include Artifacts Status
          description: Optional query parameter to include a count of artifacts by status
        - name: view
          in: query
          required: false
          schema:
            anyOf:
              - type: array
                items:
                  $ref: '#/components/schemas/KnowledgeBaseView'
              - type: 'null'
            title: View
        - name: x-selected-account-id
          in: header
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Account ID Header
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/KnowledgeBaseItemV2'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
      x-codeSamples:
        - lang: Python
          source: |-
            import os
            from scale_gp import SGPClient

            client = SGPClient(
                api_key=os.environ.get("SGP_API_KEY"),  # This is the default and can be omitted
            )
            knowledge_base = client.knowledge_bases.retrieve(
                knowledge_base_id="knowledge_base_id",
            )
            print(knowledge_base.knowledge_base_id)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/stainless-sdks/sgp-go\"\n\t\"github.com/stainless-sdks/sgp-go/option\"\n)\n\nfunc main() {\n\tclient := sgp.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tknowledgeBase, err := client.KnowledgeBases.Get(\n\t\tcontext.TODO(),\n\t\t\"knowledge_base_id\",\n\t\tsgp.KnowledgeBaseGetParams{},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", knowledgeBase.KnowledgeBaseID)\n}\n"
components:
  schemas:
    KnowledgeBaseView:
      type: string
      enum:
        - Connections
        - ArtifactCount
        - IndexConfiguration
      title: KnowledgeBaseView
    KnowledgeBaseItemV2:
      properties:
        knowledge_base_id:
          type: string
          title: Knowledge Base Id
          description: The unique ID of the knowledge base
        vector_store_id:
          title: Vector Store Id
          description: >-
            (Legacy) The unique ID of the underlying vector store. This is to
            allow for backwards compatibility with the V1 Vector Store APIs.
            This will be removed in the near future.
          type: string
        knowledge_base_name:
          type: string
          title: Knowledge Base Name
          description: The name of the knowledge base
        embedding_config:
          $ref: '#/components/schemas/EmbeddingConfig'
          description: The embedding configuration
        metadata:
          title: Metadata
          description: Metadata associated with the knowledge base
          additionalProperties: true
          type: object
        created_at:
          type: string
          title: Created At
          description: The timestamp at which the knowledge base was created
        updated_at:
          title: Updated At
          description: The timestamp at which the knowledge base was last updated
          type: string
        connections:
          title: Connections
          description: >-
            The data source connections associated with the knowledge base. Only
            returned with the `view=Connections` query parameter.
          items:
            $ref: '#/components/schemas/KnowledgeBaseDataSourceConnectionResponse'
          type: array
        artifacts_status:
          $ref: '#/components/schemas/ArtifactsStatus'
          description: >-
            Number of artifacts in each of the various states, such as completed
            and failed for this knowledge base. This includes all data sources.
        artifact_count:
          title: Artifact Count
          description: >-
            The total number of artifacts in the knowledge base. Only returned
            with the `view=ArtifactCount` query parameter.
          type: integer
        cluster_status:
          title: Cluster Status
          description: Whether the knowledge base has been clustered.
          type: string
        created_by_user_id:
          title: Created By User Id
          description: The user ID of the user who created the knowledge base.
          type: string
        index_backend:
          title: Index Backend
          description: The underlying search backend powering this knowledge base.
          type: string
          enum:
            - AzureSearch
            - OpenSearch
            - Redis
            - VertexAISearch
        kb_index_configuration:
          $ref: '#/components/schemas/KBIndexConfiguration'
          description: >-
            The effective metadata schema enforced on this knowledge base's
            underlying index, including system defaults (`page`,
            `artifact_uri_public`, `artifact_name`). Populated for Azure AI
            Search backends; `null` for schemaless backends (OpenSearch, Vertex
            AI). Only returned when the caller opts in via
            `view=IndexConfiguration` on both the GET and list endpoints.
      type: object
      required:
        - knowledge_base_id
        - vector_store_id
        - knowledge_base_name
        - embedding_config
        - created_at
      title: KnowledgeBaseItemV2
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    EmbeddingConfig:
      anyOf:
        - $ref: '#/components/schemas/EmbeddingConfigModelsAPI'
        - $ref: '#/components/schemas/EmbeddingConfigBase'
      title: EmbeddingConfig
    KnowledgeBaseDataSourceConnectionResponse:
      properties:
        deletion_status:
          $ref: '#/components/schemas/KnowledgeBaseDataSourceDeletionStatus'
          description: >-
            The status of the deletion job for this data source connection, if
            any.
        last_uploaded_at:
          type: string
          format: date-time
          title: Last Uploaded At
          description: >-
            The date and time when the last upload for the data source was
            initiated.
        knowledge_base_data_source:
          $ref: '#/components/schemas/KnowledgeBaseDataSourceResponse'
          description: The knowledge base data source entity.
      type: object
      required:
        - last_uploaded_at
        - knowledge_base_data_source
      title: KnowledgeBaseDataSourceConnectionResponse
    ArtifactsStatus:
      properties:
        artifacts_chunking:
          type: integer
          title: Artifacts Chunking
          description: Number of artifacts in the chunking state
        artifacts_embedding:
          type: integer
          title: Artifacts Embedding
          description: Number of artifacts in the embedding state
        artifacts_completed:
          type: integer
          title: Artifacts Completed
          description: Number of artifacts uploaded successfully.
        artifacts_pending:
          type: integer
          title: Artifacts Pending
          description: >-
            Previously: Number of artifacts awaiting upload. Note that this
            status will be deprecated soon and should show 0
        artifacts_uploading:
          type: integer
          title: Artifacts Uploading
          description: Number of artifacts with upload in progress.
        artifacts_failed:
          type: integer
          title: Artifacts Failed
          description: Number of artifacts that failed while being processed.
      type: object
      required:
        - artifacts_chunking
        - artifacts_embedding
        - artifacts_completed
        - artifacts_pending
        - artifacts_uploading
        - artifacts_failed
      title: ArtifactsStatus
    KBIndexConfiguration:
      properties:
        fields:
          additionalProperties: true
          type: object
          title: Fields
          description: >-
            Schema defining metadata fields for the knowledge base. Each field
            can have properties: type (string, int32, int64, double, boolean,
            complex), filterable (bool), searchable (bool). Complex types can
            have nested 'fields' with the same structure.
          example:
            author:
              fields:
                age:
                  filterable: true
                  type: int32
                name:
                  filterable: true
                  searchable: true
                  type: string
              type: complex
            priority:
              filterable: true
              type: int32
        max_index_size:
          title: Max Index Size
          description: >-
            Maximum size (in bytes) for the index. If not provided, uses the
            default.
          type: integer
          exclusiveMinimum: 0
      additionalProperties: true
      type: object
      required:
        - fields
      title: KBIndexConfiguration
      description: >-
        Configuration for knowledge base metadata schema.


        This configuration determines how metadata fields are created in the
        search index.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
          additionalProperties: true
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    EmbeddingConfigModelsAPI:
      properties:
        type:
          type: string
          const: models_api
          title: Type
          description: The type of the embedding configuration.
        model_deployment_id:
          type: string
          title: Model Deployment Id
          description: The ID of the deployment of the created model in the Models API V3.
      type: object
      required:
        - type
        - model_deployment_id
      title: EmbeddingConfigModelsAPI
    EmbeddingConfigBase:
      properties:
        type:
          type: string
          const: base
          title: Type
          description: The type of the embedding configuration.
          default: base
        embedding_model:
          $ref: '#/components/schemas/EmbeddingModelName'
          description: >-
            The name of the base embedding model to use. To use custom models,
            change to type 'models'.
      type: object
      required:
        - embedding_model
      title: EmbeddingConfigBase
    KnowledgeBaseDataSourceDeletionStatus:
      type: string
      enum:
        - DELETING
        - FAILED
      title: KnowledgeBaseDataSourceDeletionStatus
    KnowledgeBaseDataSourceResponse:
      properties:
        name:
          type: string
          title: Name
        description:
          title: Description
          type: string
        data_source_config:
          $ref: '#/components/schemas/RemoteDataSourceConfig'
          can_patch: false
        tagging_information:
          $ref: '#/components/schemas/TaggingInformationAll'
          can_patch: true
        id:
          type: string
          title: Id
          description: The unique identifier of the entity.
        created_at:
          type: string
          format: date-time
          title: Created At
          description: The date and time when the entity was created in ISO format.
        updated_at:
          type: string
          format: date-time
          title: Updated At
          description: The date and time when the entity was last updated in ISO format.
        created_by_user_id:
          type: string
          title: Created By User Id
          description: The user who originally created the entity.
        created_by_identity_type:
          $ref: '#/components/schemas/IdentifierTypeEnum'
          description: The type of identity that created the entity.
        account_id:
          type: string
          title: Account Id
          description: The ID of the account that owns the given entity.
          can_patch: false
      type: object
      required:
        - name
        - data_source_config
        - id
        - created_at
        - updated_at
        - created_by_user_id
        - created_by_identity_type
        - account_id
      title: KnowledgeBaseDataSourceResponse
    EmbeddingModelName:
      type: string
      enum:
        - sentence-transformers/all-MiniLM-L12-v2
        - sentence-transformers/all-mpnet-base-v2
        - sentence-transformers/multi-qa-distilbert-cos-v1
        - sentence-transformers/paraphrase-multilingual-mpnet-base-v2
        - openai/text-embedding-ada-002
        - openai/text-embedding-3-small
        - openai/text-embedding-3-large
        - embed-english-v3.0
        - embed-english-light-v3.0
        - embed-multilingual-v3.0
        - gemini/text-embedding-005
        - gemini/text-multilingual-embedding-002
        - gemini/gemini-embedding-001
      title: EmbeddingModelName
    RemoteDataSourceConfig:
      oneOf:
        - $ref: '#/components/schemas/S3DataSourceConfig'
        - $ref: '#/components/schemas/SharePointDataSourceConfig'
        - $ref: '#/components/schemas/SharePointPageDataSourceConfig'
        - $ref: '#/components/schemas/GoogleDriveDataSourceConfig'
        - $ref: '#/components/schemas/AzureBlobStorageDataSourceConfig'
        - $ref: '#/components/schemas/GoogleCloudStorageDataSourceConfig'
        - $ref: '#/components/schemas/ConfluenceDataSourceConfig'
        - $ref: '#/components/schemas/SlackDataSourceConfig'
        - $ref: '#/components/schemas/SnowflakeDataSourceConfig'
        - $ref: '#/components/schemas/DatabricksDataSourceConfig'
        - $ref: '#/components/schemas/SQLDatabaseDataSourceConfig'
        - $ref: '#/components/schemas/MongoDBDataSourceConfig'
        - $ref: '#/components/schemas/BigQueryDataSourceConfig'
      title: RemoteDataSourceConfig
      discriminator:
        propertyName: source
        mapping:
          AzureBlobStorage:
            $ref: '#/components/schemas/AzureBlobStorageDataSourceConfig'
          BigQuery:
            $ref: '#/components/schemas/BigQueryDataSourceConfig'
          Confluence:
            $ref: '#/components/schemas/ConfluenceDataSourceConfig'
          Databricks:
            $ref: '#/components/schemas/DatabricksDataSourceConfig'
          GoogleCloudStorage:
            $ref: '#/components/schemas/GoogleCloudStorageDataSourceConfig'
          GoogleDrive:
            $ref: '#/components/schemas/GoogleDriveDataSourceConfig'
          MongoDB:
            $ref: '#/components/schemas/MongoDBDataSourceConfig'
          S3:
            $ref: '#/components/schemas/S3DataSourceConfig'
          SQLDatabase:
            $ref: '#/components/schemas/SQLDatabaseDataSourceConfig'
          SharePoint:
            $ref: '#/components/schemas/SharePointDataSourceConfig'
          SharePointPage:
            $ref: '#/components/schemas/SharePointPageDataSourceConfig'
          Slack:
            $ref: '#/components/schemas/SlackDataSourceConfig'
          Snowflake:
            $ref: '#/components/schemas/SnowflakeDataSourceConfig'
    TaggingInformationAll:
      properties:
        type:
          type: string
          const: all
          title: Type
          default: all
        tags_to_apply:
          title: Tags To Apply
          additionalProperties: true
          type: object
      type: object
      title: TaggingInformationAll
    IdentifierTypeEnum:
      type: string
      enum:
        - user
        - service_account
      title: IdentifierTypeEnum
    S3DataSourceConfig:
      properties:
        source:
          type: string
          const: S3
          title: Source
        s3_bucket:
          type: string
          title: S3 Bucket
          description: Name of the S3 bucket where the data is stored.
        s3_prefix:
          type: string
          title: S3 Prefix
          description: >-
            Prefix of the S3 bucket where the data is stored. If not specified,
            the entire bucket will be used.
          default: ''
        aws_region:
          type: string
          title: Aws Region
          description: AWS region where the S3 bucket is located.
        aws_account_id:
          type: string
          pattern: ^\d{12}$
          title: Aws Account Id
          description: AWS account ID that owns the S3 bucket.
      type: object
      required:
        - source
        - s3_bucket
        - aws_region
        - aws_account_id
      title: S3 DataSource Config
    SharePointDataSourceConfig:
      properties:
        source:
          type: string
          const: SharePoint
          title: Source
        client_id:
          type: string
          title: Client Id
          description: Client ID associated with this SharePoint site
        tenant_id:
          type: string
          title: Tenant Id
          description: Tenant ID that the SharePoint site is within
        site_id:
          type: string
          title: Site Id
          description: >-
            Site ID for this SharePoint site, can be found at
            https://[hostname].sharepoint.com/sites/[site name]/_api/site/id
        folder_path:
          title: Folder Path
          description: >-
            Nested folder path to read files from the root of the site. Please
            omit the leading slash. Example: 'Documents/sub_directory'
          default: ''
          type: string
        recursive:
          title: Recursive
          description: Recurse through the folder contents, default is True.
          default: true
          type: boolean
      type: object
      required:
        - source
        - client_id
        - tenant_id
        - site_id
      title: SharePoint DataSource Config
    SharePointPageDataSourceConfig:
      properties:
        source:
          type: string
          const: SharePointPage
          title: Source
        client_id:
          type: string
          title: Client Id
          description: Client ID associated with this SharePoint site
        tenant_id:
          type: string
          title: Tenant Id
          description: Tenant ID that the SharePoint site is within
        site_id:
          type: string
          title: Site Id
          description: Site ID for this SharePoint site
      type: object
      required:
        - source
        - client_id
        - tenant_id
        - site_id
      title: SharePoint Page DataSource Config
    GoogleDriveDataSourceConfig:
      properties:
        source:
          type: string
          const: GoogleDrive
          title: Source
        drive_id:
          type: string
          title: Drive Id
          description: ID associated with the Google Drive to retrieve contents from
      type: object
      required:
        - source
        - drive_id
      title: Google Drive DataSource Config
    AzureBlobStorageDataSourceConfig:
      properties:
        source:
          type: string
          const: AzureBlobStorage
          title: Source
        container_url:
          type: string
          title: Container Url
          description: >-
            The full URL of the container such as
            'https://your-account-name.blob.core.windows.net/your-container-name'
      type: object
      required:
        - source
        - container_url
      title: Azure Blob Storage DataSource Config
    GoogleCloudStorageDataSourceConfig:
      properties:
        source:
          type: string
          const: GoogleCloudStorage
          title: Source
        bucket:
          type: string
          title: Bucket
          description: Name of the Google Cloud Storage bucket where the data is stored.
        prefix:
          title: Prefix
          description: >-
            Prefix path within the Google Cloud Storage bucket. If not
            specified, the entire bucket will be used.
          type: string
        project_id:
          title: Project Id
          description: >-
            GCP project ID that owns the Google Cloud Storage bucket. If not
            specified, uses the default project.
          type: string
      type: object
      required:
        - source
        - bucket
      title: Google Cloud Storage DataSource Config
    ConfluenceDataSourceConfig:
      properties:
        source:
          type: string
          const: Confluence
          title: Source
        space_key:
          type: string
          title: Space Key
          description: >-
            Confluence space key to retrieve contents from. See
            https://support.atlassian.com/confluence-cloud/docs/choose-a-space-key
      type: object
      required:
        - source
        - space_key
      title: Confluence DataSource Config
    SlackDataSourceConfig:
      properties:
        source:
          type: string
          const: Slack
          title: Source
        channel_id:
          type: string
          title: Channel Id
          description: >-
            Slack Channel or Conversation ID to retrieve history from. Open
            channel details and find the ID at bottom of 'About' section.
      type: object
      required:
        - source
        - channel_id
      title: Slack DataSource Config
    SnowflakeDataSourceConfig:
      properties:
        source:
          type: string
          const: Snowflake
          title: Source
        account:
          type: string
          title: Account
          description: Snowflake account identifier
        user:
          type: string
          title: User
          description: Snowflake user name
      type: object
      required:
        - source
        - account
        - user
      title: Snowflake DataSource Config
    DatabricksDataSourceConfig:
      properties:
        source:
          type: string
          const: Databricks
          title: Source
        server_hostname:
          type: string
          title: Server Hostname
          description: Databricks server hostname
        http_path:
          type: string
          title: Http Path
          description: HTTP path for the Databricks cluster or SQL warehouse
      type: object
      required:
        - source
        - server_hostname
        - http_path
      title: Databricks DataSource Config
    SQLDatabaseDataSourceConfig:
      properties:
        source:
          type: string
          const: SQLDatabase
          title: Source
        dialect:
          type: string
          enum:
            - postgresql
            - mssql
            - sqlite
            - snowflake
          title: Dialect
          description: SQL dialect to use for connection
        host:
          title: Host
          description: Database server hostname or IP address
          type: string
        port:
          title: Port
          description: Database server port
          type: integer
        database:
          type: string
          title: Database
          description: Name of the database to connect to.
        username:
          title: Username
          description: Username for authentication
          type: string
        driver:
          title: Driver
          description: >-
            ODBC driver name for MSSQL connections. Defaults to 'ODBC Driver 18
            for SQL Server' if not specified.
          type: string
        ssl_mode:
          title: Ssl Mode
          description: SSL mode for PostgreSQL connections (e.g., 'require', 'verify-full')
          type: string
        connect_timeout:
          title: Connect Timeout
          description: Connection timeout in seconds
          default: 30
          type: integer
        connection_options:
          title: Connection Options
          description: >-
            Additional connection parameters appended to the URL (e.g.,
            {'sslrootcert': '/path/to/ca.pem', 'application_name': 'myapp'})
          additionalProperties:
            type: string
          type: object
        account:
          title: Account
          description: >-
            Snowflake account identifier (e.g., 'xy12345' or
            'xy12345.us-east-2.azure'). Do NOT include the
            '.snowflakecomputing.com' suffix.
          type: string
        warehouse:
          title: Warehouse
          description: >-
            Snowflake warehouse name for query execution. Required for
            Snowflake.
          type: string
        schema_name:
          title: Schema Name
          description: Snowflake schema name. Defaults to 'PUBLIC' if not specified.
          type: string
        role:
          title: Role
          description: >-
            Snowflake role for authentication. Uses the default role for the
            user if not specified.
          type: string
      type: object
      required:
        - source
        - dialect
        - database
      title: SQL Database DataSource Config
    MongoDBDataSourceConfig:
      properties:
        source:
          type: string
          const: MongoDB
          title: Source
        database:
          type: string
          title: Database
          description: Database name to connect to
        connect_timeout:
          title: Connect Timeout
          description: Connection timeout in seconds
          default: 30
          type: integer
      type: object
      required:
        - source
        - database
      title: MongoDB DataSource Config
    BigQueryDataSourceConfig:
      properties:
        source:
          type: string
          const: BigQuery
          title: Source
        project_id:
          type: string
          title: Project Id
          description: GCP project ID containing the BigQuery dataset(s) to query.
        location:
          title: Location
          description: >-
            BigQuery dataset location (e.g. 'US', 'EU', 'us-central1'). When
            omitted the client uses the project's default location.
          type: string
        connect_timeout:
          title: Connect Timeout
          description: Connection timeout in seconds for BigQuery API calls.
          default: 30
          type: integer
      type: object
      required:
        - source
        - project_id
      title: BigQuery DataSource Config
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````