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

> Deletes an uploaded file and all associated data from the knowledge base by its unique ID.  **Cleanup:** Removes the file, associated embeddings, and any agent references to this file.

# Delete Uploaded File

For the complete error reference, see [Error Guide](/rest-api/ai-agents-apis/error-codes).


## OpenAPI

````yaml delete /ai-agents/agent-builder/knowledge-base/uploads/{uniqueId}
openapi: 3.0.0
info:
  title: AI Agents APIs
  description: API reference for CometChat AI Agents service
  version: '1.0'
servers:
  - url: https://{appId}.api-{region}.cometchat.io/v3
    variables:
      appId:
        default: appId
        description: (Required) App ID
      region:
        enum:
          - us
          - eu
          - in
        default: us
        description: Select Region
security: []
tags:
  - name: ai-agent
    description: ''
paths:
  /ai-agents/agent-builder/knowledge-base/uploads/{uniqueId}:
    delete:
      tags:
        - knowledge-base
      summary: Delete Uploaded File
      description: >-
        Deletes an uploaded file and all associated data from the knowledge base
        by its unique ID.


        **Cleanup:** Removes the file, associated embeddings, and any agent
        references to this file.
      operationId: RagController_deleteUploadedFile
      parameters:
        - name: uniqueId
          required: true
          in: path
          description: Unique upload ID to delete
          schema:
            type: string
      responses:
        '200':
          description: Uploaded file deleted successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: boolean
                    example: true
                  message:
                    type: string
                    example: File and all associated data deleted successfully
                  data:
                    type: object
                    properties:
                      uploadId:
                        type: string
                      fileName:
                        type: string
                      deletedFromAgents:
                        type: boolean
                      vectorsDeleted:
                        type: boolean
              example:
                success: true
                message: File and all associated data deleted successfully
                data:
                  uploadId: 550e8400-e29b-41d4-a716-446655440000
                  fileName: document.pdf
                  deletedFromAgents: true
                  vectorsDeleted: true
                  s3FileDeleted: true
      security:
        - apiKey: []
components:
  securitySchemes:
    apiKey:
      type: apiKey
      description: API Key (i.e. Rest API Key from the Dashboard).
      name: apikey
      in: header

````