---
title: "Delete a file"
method: DELETE
path: "/repos/{owner}/{repo}/contents/{path}"
tags: ["repos"]
---

# Delete a file

`DELETE /repos/{owner}/{repo}/contents/{path}`

Deletes a file in a repository.

You can provide an additional `committer` parameter, which is an object containing information about the committer. Or, you can provide an `author` parameter, which is an object containing information about the author.

The `author` section is optional and is filled in with the `committer` information if omitted. If the `committer` information is omitted, the authenticated user's information is used.

You must provide values for both `name` and `email`, whether you choose to use `author` or `committer`. Otherwise, you'll receive a `422` status code.

**Note:** If you use this endpoint and the "[Create or update file contents](https://docs.github.com/enterprise-server@3.5/rest/reference/repos/#create-or-update-file-contents)" endpoint in parallel, the concurrent requests will conflict and you will receive errors. You must use these endpoints serially instead.

## Path parameters

- `owner` string, required
- `repo` string, required
- `path` string, required

## Request body

- object
  - `message` string, required — The commit message.
  - `sha` string, required — The blob SHA of the file being deleted.
  - `branch` string — The branch name. Default: the repository’s default branch
  - `committer` object — object containing information about the committer.
    - `name` string — The name of the author (or committer) of the commit
    - `email` string — The email of the author (or committer) of the commit
  - `author` object — object containing information about the author.
    - `name` string — The name of the author (or committer) of the commit
    - `email` string — The email of the author (or committer) of the commit

## Response `200`

Response

- FileCommit — File Commit
  - `content` object, nullable, required
    - `name` string
    - `path` string
    - `sha` string
    - `size` integer
    - `url` string
    - `html_url` string
    - `git_url` string
    - `download_url` string
    - `type` string
    - `_links` object
      - `self` string
      - `git` string
      - `html` string
  - `commit` object, required
    - `sha` string
    - `node_id` string
    - `url` string
    - `html_url` string
    - `author` object
      - `date` string
      - `name` string
      - `email` string
    - `committer` object
      - `date` string
      - `name` string
      - `email` string
    - `message` string
    - `tree` object
      - `url` string
      - `sha` string
    - `parents` object[]
      - `url` string
      - `html_url` string
      - `sha` string
    - `verification` object
      - `verified` boolean
      - `reason` string
      - `signature` string, nullable
      - `payload` string, nullable

## Other responses

- `404` — Resource not found
- `409` — Conflict
- `422` — Validation failed, or the endpoint has been spammed.
- `503` — Service unavailable

---

[API](https://skmtc.net/github/apis/github-v3-rest-api-4.md) · [All operations](https://skmtc.net/github/apis/github-v3-rest-api-4/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/github/github-v3-rest-api-4/versions/ee6c7a46328e/schema)
