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

# Delete a document

> Un-tags a document from the case (metadata only); the stored blob is left for history. Scoped to the case so a widget can only remove its own files.

While an information request is open this accepts ONLY a file the applicant uploaded during the round, into a document group that request asked to be re-uploaded. Any other group, every owner government ID, and the files the group already held when the request was sent are a 409 `not_requested`: those are what the checks ran on, and removing one would answer the request by emptying the group. So an upload can always be taken back here, and the document being replaced cannot be.

The upload endpoint (POST /api/v4/upload/kyb/{publicId}/documents, served by docver-upload) applies the group half of the rule with the same code, but NOT the per-file half: a single-file group replaces rather than accumulates, so uploading into one un-tags whatever it held, the requested document included.



## OpenAPI

````yaml https://api.dataspike.io/openapi/kyb/public.json delete /api/v4/kyb/widget/{publicId}/documents/{documentId}
openapi: 3.1.0
info:
  description: Know Your Business (KYB) — case creation and the embedded onboarding widget.
  title: Dataspike KYB API
  version: '1.0'
servers: []
security: []
paths:
  /api/v4/kyb/widget/{publicId}/documents/{documentId}:
    delete:
      tags:
        - KYB Widget
      summary: Delete a document
      description: >-
        Un-tags a document from the case (metadata only); the stored blob is
        left for history. Scoped to the case so a widget can only remove its own
        files.


        While an information request is open this accepts ONLY a file the
        applicant uploaded during the round, into a document group that request
        asked to be re-uploaded. Any other group, every owner government ID, and
        the files the group already held when the request was sent are a 409
        `not_requested`: those are what the checks ran on, and removing one
        would answer the request by emptying the group. So an upload can always
        be taken back here, and the document being replaced cannot be.


        The upload endpoint (POST /api/v4/upload/kyb/{publicId}/documents,
        served by docver-upload) applies the group half of the rule with the
        same code, but NOT the per-file half: a single-file group replaces
        rather than accumulates, so uploading into one un-tags whatever it held,
        the requested document included.
      operationId: DELETE_/api/v4/kyb/widget/:publicId/documents/:documentId
      parameters:
        - description: KYB case public id.
          in: path
          name: publicId
          required: true
          schema:
            type: string
        - description: Document id.
          in: path
          name: documentId
          required: true
          schema:
            type: string
      responses:
        '204':
          content:
            application/json:
              schema:
                $ref: d5293a33-1d10-4aa2-8ff9-4a2c9a2d1e19
            application/xml:
              schema:
                $ref: d5293a33-1d10-4aa2-8ff9-4a2c9a2d1e19
          description: No Content
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrCaseNotFound'
            application/xml:
              schema:
                $ref: '#/components/schemas/ErrCaseNotFound'
          description: Case or document not found.
        '409':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrNotRequested'
            application/xml:
              schema:
                $ref: '#/components/schemas/ErrNotRequested'
          description: >-
            `not_requested` while an information request is open, or
            `case_locked` when the case does not accept writes at all.
components:
  schemas:
    ErrCaseNotFound:
      description: ErrCaseNotFound schema
      example:
        code: case_not_found
        message: Case not found
      properties:
        code:
          example: email_otp_expired
          type: string
        message:
          example: OTP has expired
          type: string
        param:
          nullable: true
          type: string
      type: object
    ErrNotRequested:
      description: ErrNotRequested schema
      example:
        code: not_requested
        message: >-
          Only the requested items can be changed while an information request
          is open
      properties:
        code:
          example: email_otp_expired
          type: string
        message:
          example: OTP has expired
          type: string
        param:
          nullable: true
          type: string
      type: object

````