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

# Delete an uploaded file that no document uses

> Deletes a file uploaded to the storage workspace, for example one whose
attachment to a knowledge base failed. Only the user who uploaded it
may delete it, whatever their organization role (platform
administrators may delete anyone's upload). A file still used by a
document answers `409 FILE_IN_USE`: delete the document instead
(`DELETE /v1/knowledge_bases/{knowledgeBaseId}/documents/{documentId}`),
which also releases the file.




## OpenAPI

````yaml /api-reference/storage/swagger.yml delete /v1/files/{fileId}
openapi: 3.0.3
info:
  version: 1.0.0
  title: Knowledges API
  description: >
    Public REST API for the Prisme.ai Knowledges (storage) workspace: knowledge
    bases, documents (uploaded files, web pages, remote files, connector
    documents), recurring web-crawl sources, semantic search, access control,
    per-knowledge-base API keys, and skills.


    Resource identifiers use the physical prefixes emitted by the implementation
    (`vs_` knowledge base, `vsf_` document, `seed_` web source, `kb-` API-key
    slug).


    This spec documents the public REST surface only. Internal helpers (private
    automations prefixed with `_`) and admin/GDPR lifecycle operations are not
    part of the public contract, except the platform health probe listed under
    the Admin tag.


    Each knowledge base also exposes a Model Context Protocol endpoint (`POST
    /v1/knowledge_bases/{knowledgeBaseId}/mcp`, JSON-RPC 2.0) giving agents
    filesystem-style read access to its content. It is listed under the MCP tag
    for its URL and auth only; use an MCP client rather than calling it as a
    REST resource.
  contact:
    name: Prisme.ai
    url: https://prisme.ai
servers:
  - url: https://{host}/v2/workspaces/slug:storage/webhooks
    description: Prisme.ai workspace webhooks
    variables:
      host:
        default: api.studio.prisme.ai
        description: API host (override for self-hosted or sandbox)
security:
  - BearerAuth: []
  - WorkspaceApiKeyAuth: []
tags:
  - name: Knowledge Bases
    description: >-
      Create, list, read, update, and delete knowledge bases (vector-backed
      document stores).
  - name: Documents
    description: >-
      Ingest and manage documents (uploaded files, web pages, remote files,
      connector documents) and their indexing.
  - name: Web Sources
    description: >-
      Recurring web crawl seeds that discover and index pages into a knowledge
      base.
  - name: Search
    description: Semantic search over a knowledge base.
  - name: MCP
    description: >-
      Per-knowledge-base Model Context Protocol endpoint for deterministic,
      filesystem-style access to content (kb_search, kb_ls, kb_find, kb_cat,
      kb_grep, kb_head, kb_tail, kb_sed, kb_source_url).
  - name: Access
    description: Per-knowledge-base access bindings (user, group, org, agent principals).
  - name: API Keys
    description: Per-knowledge-base API keys for connector authentication.
  - name: Files
    description: >-
      Files uploaded to the storage workspace, before or after they are attached
      to a knowledge base.
  - name: Stats
    description: Aggregate dashboard statistics.
  - name: Skills
    description: Prompt/instruction registry entries.
  - name: Admin
    description: >-
      Platform health probe called by the AI Governance Infrastructure page.
      Requires elevated permissions, a platform administrator session
      (`platformRole` `superadmin` or `root`).
paths:
  /v1/files/{fileId}:
    parameters:
      - name: fileId
        in: path
        required: true
        schema:
          type: string
          maxLength: 128
        description: >-
          Id of the file uploaded to the storage workspace (`POST
          /v2/workspaces/slug:storage/files`).
    delete:
      tags:
        - Files
      summary: Delete an uploaded file that no document uses
      description: |
        Deletes a file uploaded to the storage workspace, for example one whose
        attachment to a knowledge base failed. Only the user who uploaded it
        may delete it, whatever their organization role (platform
        administrators may delete anyone's upload). A file still used by a
        document answers `409 FILE_IN_USE`: delete the document instead
        (`DELETE /v1/knowledge_bases/{knowledgeBaseId}/documents/{documentId}`),
        which also releases the file.
      operationId: deleteUploadedFile
      responses:
        '200':
          description: File deleted.
          content:
            application/json:
              schema:
                type: object
                required:
                  - deleted
                properties:
                  deleted:
                    type: boolean
                  file_purged:
                    type: boolean
                  purge_reason:
                    type: string
                    enum:
                      - DELETED
                      - ALREADY_GONE
        '400':
          $ref: '#/components/responses/LegacyError400'
        '401':
          $ref: '#/components/responses/LegacyError401'
        '403':
          $ref: '#/components/responses/LegacyError403'
        '404':
          $ref: '#/components/responses/LegacyError404'
        '409':
          description: The file is still used by a document (`FILE_IN_USE`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
        '502':
          description: >-
            The file could not be read or deleted, retry later
            (`RESOLVE_FAILED`, `DELETE_FAILED`).
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                  code:
                    type: string
      security:
        - BearerAuth: []
components:
  responses:
    LegacyError400:
      description: Caller validation failure (legacy flat envelope).
      content:
        application/json:
          schema:
            type: object
            description: |
              Legacy **flat** error envelope emitted by the not-yet-migrated
              `/v1/skills*`, `/v1/stats`, `DELETE /v1/files/{fileId}`,
              `/v1/cleanup/*` and `/v1/export/by-user` routes (all other routes
              use the nested `Error` envelope). The shape varies by route:
              `skills`/`stats`/`files`
              return `{ error: <message>, code: <CODE> }`; `cleanup`/`export`
              return `{ error: <CODE>, message: <message> }`. Same information,
              different field placement. These routes will migrate to the
              nested `Error` envelope.
            additionalProperties: true
            properties:
              error:
                type: string
              code:
                type: string
              message:
                type: string
    LegacyError401:
      description: Authentication missing or invalid (legacy flat envelope).
      content:
        application/json:
          schema:
            type: object
            description: |
              Legacy **flat** error envelope emitted by the not-yet-migrated
              `/v1/skills*`, `/v1/stats`, `DELETE /v1/files/{fileId}`,
              `/v1/cleanup/*` and `/v1/export/by-user` routes (all other routes
              use the nested `Error` envelope). The shape varies by route:
              `skills`/`stats`/`files`
              return `{ error: <message>, code: <CODE> }`; `cleanup`/`export`
              return `{ error: <CODE>, message: <message> }`. Same information,
              different field placement. These routes will migrate to the
              nested `Error` envelope.
            additionalProperties: true
            properties:
              error:
                type: string
              code:
                type: string
              message:
                type: string
    LegacyError403:
      description: Authorization denied (legacy flat envelope).
      content:
        application/json:
          schema:
            type: object
            description: |
              Legacy **flat** error envelope emitted by the not-yet-migrated
              `/v1/skills*`, `/v1/stats`, `DELETE /v1/files/{fileId}`,
              `/v1/cleanup/*` and `/v1/export/by-user` routes (all other routes
              use the nested `Error` envelope). The shape varies by route:
              `skills`/`stats`/`files`
              return `{ error: <message>, code: <CODE> }`; `cleanup`/`export`
              return `{ error: <CODE>, message: <message> }`. Same information,
              different field placement. These routes will migrate to the
              nested `Error` envelope.
            additionalProperties: true
            properties:
              error:
                type: string
              code:
                type: string
              message:
                type: string
    LegacyError404:
      description: Resource not found (legacy flat envelope).
      content:
        application/json:
          schema:
            type: object
            description: |
              Legacy **flat** error envelope emitted by the not-yet-migrated
              `/v1/skills*`, `/v1/stats`, `DELETE /v1/files/{fileId}`,
              `/v1/cleanup/*` and `/v1/export/by-user` routes (all other routes
              use the nested `Error` envelope). The shape varies by route:
              `skills`/`stats`/`files`
              return `{ error: <message>, code: <CODE> }`; `cleanup`/`export`
              return `{ error: <CODE>, message: <message> }`. Same information,
              different field placement. These routes will migrate to the
              nested `Error` envelope.
            additionalProperties: true
            properties:
              error:
                type: string
              code:
                type: string
              message:
                type: string
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        User session JWT or instance API key (`iak_*`). Send as `Authorization:
        Bearer <token>`.
    WorkspaceApiKeyAuth:
      type: apiKey
      in: header
      name: x-prismeai-api-key
      description: Workspace- or knowledge-base-scoped API key.

````

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