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

# Cancel a mid-upload attachment, or permanently delete an unbound one

> Cancels a PENDING upload, or permanently deletes a READY/FAILED/CANCELLED unbound row otherwise — never a row already bound to a sent message. Returns the resulting attachment, not an empty body.



## OpenAPI

````yaml /openapi.json delete /api/v1/attachments/{attachmentId}
openapi: 3.1.0
info:
  title: VyomFlow API
  version: 1.0.0
  description: >-
    The versioned public REST surface (`/api/public/v1/*`, bearer API-key auth)
    plus the app's own internal `/api/v1/*` surface (Clerk session-token auth),
    generated directly from the same Zod contracts the Route Handlers validate
    against — never a hand-maintained duplicate. The MCP endpoint (`/api/mcp`)
    is a separate streamable-HTTP JSON-RPC transport, not expressible here — see
    the MCP guide.
servers:
  - url: https://api.vyomflow.co.in
    description: Production
  - url: http://localhost:3000
    description: Local development
security: []
paths:
  /api/v1/attachments/{attachmentId}:
    delete:
      tags:
        - Attachments
      summary: Cancel a mid-upload attachment, or permanently delete an unbound one
      description: >-
        Cancels a PENDING upload, or permanently deletes a
        READY/FAILED/CANCELLED unbound row otherwise — never a row already bound
        to a sent message. Returns the resulting attachment, not an empty body.
      parameters:
        - schema:
            type: string
            minLength: 1
          required: true
          name: attachmentId
          in: path
      responses:
        '200':
          description: The cancelled or deleted attachment.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Attachment'
        '401':
          description: Missing or invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Not found (non-leaking — see above).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
      security:
        - ClerkBearer: []
components:
  schemas:
    Attachment:
      type: object
      properties:
        id:
          type: string
        chatId:
          type:
            - string
            - 'null'
        messageId:
          type:
            - string
            - 'null'
        orderIndex:
          type: integer
          minimum: 0
        status:
          type: string
          enum:
            - PENDING
            - READY
            - FAILED
            - CANCELLED
        mimeType:
          type:
            - string
            - 'null'
        byteSize:
          type:
            - integer
            - 'null'
          minimum: 0
        fileName:
          type:
            - string
            - 'null'
        resultUrl:
          type:
            - string
            - 'null'
          format: uri
        errorCode:
          type:
            - string
            - 'null'
        errorMessage:
          type:
            - string
            - 'null'
        createdAt:
          type: string
        updatedAt:
          type: string
        source:
          type: string
          enum:
            - uploaded
            - generated
      required:
        - id
        - chatId
        - messageId
        - orderIndex
        - status
        - mimeType
        - byteSize
        - fileName
        - resultUrl
        - errorCode
        - errorMessage
        - createdAt
        - updatedAt
        - source
    ApiError:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
            message:
              type: string
            details: {}
          required:
            - code
            - message
      required:
        - error
  securitySchemes:
    ClerkBearer:
      type: http
      scheme: bearer
      description: >-
        Clerk session token, `Authorization: Bearer <token>` — the first-party
        browser app's own auth. Used only by this internal `/api/v1/*` surface,
        never by `/api/public/v1/*`.

````