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

# Delete a file

> DELETE /v1/files/{fileId} — soft-delete in DB, hard-delete in GCS.

```bash theme={null}
curl -X DELETE https://api.infery.ai/v1/files/file_abc123... \
  -H "Authorization: Bearer $INFERY_API_KEY"
```

Delete is **soft in DB + hard in GCS** — bytes are unrecoverable immediately. The id remains in audit logs but `GET /v1/files/{fileId}` will return 404 afterwards.


## OpenAPI

````yaml openapi.json DELETE /v1/files/{fileId}
openapi: 3.0.0
info:
  title: Infery Gateway
  description: >-
    Infery Inference Gateway — OpenAI-compatible API for LLMs, embeddings,
    images, audio, and video
  version: '1.0'
  contact: {}
servers:
  - url: https://api.infery.ai
    description: Production
  - url: http://localhost:3001
    description: Local
security: []
tags: []
paths:
  /v1/files/{fileId}:
    delete:
      tags:
        - Files
      summary: Delete a file
      operationId: deleteFile
      parameters:
        - name: fileId
          required: true
          in: path
          schema:
            type: string
      responses:
        '200':
          description: >-
            Deletion result. Delete is soft in DB + hard in GCS — bytes are
            unrecoverable immediately.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    example: file_1hR9xTPZqK4mVLc2nJ7fY5wB
                  object:
                    type: string
                    example: file
                  deleted:
                    type: boolean
                    example: true
        '401':
          description: Unauthorized — invalid or missing API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
        '404':
          description: File not found (or not in this workspace)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseDto'
      security:
        - ApiKey: []
components:
  schemas:
    ErrorResponseDto:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/ErrorDetailDto'
      required:
        - error
    ErrorDetailDto:
      type: object
      properties:
        message:
          type: string
          example: Model not found
          description: Human-readable error message
        type:
          type: string
          example: invalid_request_error
          description: Error category
          enum:
            - invalid_request_error
            - authentication_error
            - permission_error
            - quota_exceeded
            - rate_limit_error
            - server_error
        code:
          type: object
          example: model_not_found
          nullable: true
          description: Stable machine-readable error code
        param:
          type: object
          example: model
          nullable: true
          description: >-
            Name of the request parameter that triggered the error, if
            applicable
      required:
        - message
        - type
        - code
        - param
  securitySchemes:
    ApiKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'API key in format: Bearer inf_***'

````