> ## 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.

# Delete Data Source Connection

> Removes a data source connection from a knowledge base, asynchronously deleting all artifacts and chunks that were ingested from that data source. Pass dry_run=true to preview the operation without deleting anything: the response's artifacts_to_delete map reports how many artifacts would be removed, and no workflow is started. When dry_run is false, the connection is marked as deleting, a Temporal deletion workflow is launched, and the response includes a deletion_workflow_id; deletion continues in the background after the call returns. The request is rejected if any upload is currently running for the knowledge base, or if the connection still has active (scheduled) upload schedules. The operation is idempotent — if a prior deletion workflow for this connection has already reached a terminal state it is safely restarted, but if one is still running the call fails.



## OpenAPI

````yaml https://api.sgp.scale.com/openapi-versions/v4/openapi.json post /v4/knowledge-bases/{knowledge_base_id}/data-source-connections/{knowledge_base_data_source_id}/delete
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}/data-source-connections/{knowledge_base_data_source_id}/delete:
    post:
      tags:
        - Knowledge Bases
      summary: Delete Data Source Connection
      description: >-
        Removes a data source connection from a knowledge base, asynchronously
        deleting all artifacts and chunks that were ingested from that data
        source. Pass dry_run=true to preview the operation without deleting
        anything: the response's artifacts_to_delete map reports how many
        artifacts would be removed, and no workflow is started. When dry_run is
        false, the connection is marked as deleting, a Temporal deletion
        workflow is launched, and the response includes a deletion_workflow_id;
        deletion continues in the background after the call returns. The request
        is rejected if any upload is currently running for the knowledge base,
        or if the connection still has active (scheduled) upload schedules. The
        operation is idempotent — if a prior deletion workflow for this
        connection has already reached a terminal state it is safely restarted,
        but if one is still running the call fails.
      operationId: >-
        POST-V4-/knowledge-bases/{knowledge_base_id}/data-source-connections/{knowledge_base_data_source_id}/delete
      parameters:
        - name: knowledge_base_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Base Id
        - name: knowledge_base_data_source_id
          in: path
          required: true
          schema:
            type: string
            title: Knowledge Base Data Source Id
        - name: dry_run
          in: query
          required: false
          schema:
            type: boolean
            description: >-
              Dryrun query parameter to determine first how many things will be
              deleted
            default: false
            title: Dry Run
          description: >-
            Dryrun query parameter to determine first how many things will be
            deleted
        - 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/DeleteKnowledgeBaseDataSourceConnectionResponse
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyHeader: []
components:
  schemas:
    DeleteKnowledgeBaseDataSourceConnectionResponse:
      properties:
        artifacts_to_delete:
          additionalProperties:
            type: integer
          type: object
          title: Artifacts To Delete
        deletion_workflow_id:
          title: Deletion Workflow Id
          type: string
      type: object
      required:
        - artifacts_to_delete
      title: DeleteKnowledgeBaseDataSourceConnectionResponse
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    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
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: x-api-key

````