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

# Delete File

> Remove a file and its content at /v1/files/{file_id}

## Overview

Deletes a file immediately. A batch that has already read an input file keeps running; deleting an output file makes its results unrecoverable. Files you leave alone are deleted on their own at `expires_at`.


## OpenAPI

````yaml DELETE /v1/files/{file_id}
openapi: 3.1.0
info:
  title: Morph API
  version: 1.2.0
  description: >-
    The Morph public API at api.morphllm.com: OpenAI- and Anthropic-compatible
    inference (chat completions, messages), the Batch API, Fast Apply code
    editing, Compact context compression, Reflex classification, and
    fine-tuning. Model ids, prices, and context windows are served live at
    https://www.morphllm.com/api/models/json.
  contact:
    name: Morph
    url: https://morphllm.com
    email: info@morphllm.com
  license:
    name: Proprietary
    url: https://morphllm.com/privacy/tos
servers:
  - url: https://api.morphllm.com
    description: Production
security: []
tags:
  - name: chat
    description: >-
      OpenAI- and Anthropic-compatible chat inference, including Fast Apply and
      WarpGrep models.
  - name: compact
    description: Context compression for long agent conversations.
  - name: reflex
    description: 'Per-turn classifiers: realtime prediction and batches.'
  - name: fine-tuning
    description: Reflex fine-tuning job lifecycle.
  - name: batch
    description: >-
      OpenAI-compatible Batch API: upload a JSONL file, run it at half price,
      download the results.
  - name: models
    description: Model listing and management.
  - name: telemetry
    description: Usage reporting hooks.
paths:
  /v1/files/{file_id}:
    delete:
      tags:
        - batch
      summary: Delete a file
      description: >-
        Delete a file and its content immediately. Deleting an input file does
        not stop a batch that already read it; deleting an output file makes its
        results unrecoverable.
      operationId: deleteFile
      parameters:
        - schema:
            type: string
            description: The `file_` prefixed id of the file to remove.
            example: file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f
          required: true
          description: Identifies the file to delete.
          name: file_id
          in: path
      responses:
        '200':
          description: The file was deleted.
          content:
            application/json:
              example:
                id: file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f
                object: file
                deleted: true
              schema:
                $ref: '#/components/schemas/FileDeleted'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimited'
        '500':
          $ref: '#/components/responses/InternalError'
      security:
        - bearerAuth: []
components:
  schemas:
    FileDeleted:
      type: object
      properties:
        id:
          type: string
          description: Id of the file that was deleted.
          example: file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f
        object:
          type: string
          description: Always `file`, even on a deletion receipt.
          example: file
        deleted:
          type: boolean
          description: Always `true` on success.
          example: true
      required:
        - id
        - object
        - deleted
      description: Confirmation that a file and its content are gone.
      example:
        id: file_9c2c1c3e-5b6a-4f0e-8d0f-2a1b3c4d5e6f
        object: file
        deleted: true
    Error:
      type: object
      properties:
        error:
          type: object
          properties:
            code:
              type: string
              example: invalid_request_error
              description: Machine-readable error code.
            message:
              type: string
              example: The request body is missing the `model` field.
              description: Human-readable explanation of the failure.
          required:
            - code
            - message
      required:
        - error
      description: Standard error envelope returned by every non-2xx response.
      example:
        error:
          code: invalid_request_error
          message: The request body is missing the `model` field.
  responses:
    BadRequest:
      description: Malformed request — missing or invalid fields.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: invalid_request_error
              message: The request body is missing the `model` field.
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: unauthorized
              message: Invalid API key provided.
    NotFound:
      description: The requested resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: not_found
              message: No fine-tuning job found with id ftjob-8f2k1.
    RateLimited:
      description: Rate limited — retry after the interval in the Retry-After header.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: rate_limited
              message: Too many requests. Retry in 12 seconds.
    InternalError:
      description: Internal error — safe to retry with backoff.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error:
              code: internal_error
              message: Something went wrong on our side.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: opaque
      description: >-
        Morph API key, passed as `Authorization: Bearer sk-...`. Create keys at
        https://www.morphllm.com/dashboard/api-keys.

````