---
source_url: https://www.pubnub.com/docs/sdks/rest-api/delete-file
title: Delete file
---

# Delete file

> For AI agents: documentation index at https://www.pubnub.com/llms-full.txt

Delete a file.

| Path Parameters |
| --- |
| `sub_key`string—**REQUIRED**Your app's subscribe key from Admin Portal. |
| `channel`string—**REQUIRED**The channel ID to perform the operation on. |
| `id`string—**REQUIRED**PubNub-generated ID for uploaded file |
| `name`string—**REQUIRED**User-supplied filename |

| Responses |
| --- |
| `200`The operation was successfulSchema — OPTIONALstatus integer — OPTIONALStatus code | Schema—**OPTIONAL** | `status`integer—**OPTIONAL**Status code |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL**Status code |
| `400`One or more request parameters are invalidSchema — OPTIONALstatus integer — OPTIONALStatus codeerror object — OPTIONALsource string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | Schema—**OPTIONAL** | `status`integer—**OPTIONAL**Status code | `error`object—**OPTIONAL**source string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | `source`string—**OPTIONAL**The PubNub service from which the error originated | `message`string—**OPTIONAL**Response message | `code`integer—**OPTIONAL**Internal error code |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL**Status code |
| `error`object—**OPTIONAL**source string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | `source`string—**OPTIONAL**The PubNub service from which the error originated | `message`string—**OPTIONAL**Response message | `code`integer—**OPTIONAL**Internal error code |
| `source`string—**OPTIONAL**The PubNub service from which the error originated |
| `message`string—**OPTIONAL**Response message |
| `code`integer—**OPTIONAL**Internal error code |
| `402`The Files service is not enabled for the subkeySchema — OPTIONALstatus integer — OPTIONALStatus codeerror object — OPTIONALsource string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | Schema—**OPTIONAL** | `status`integer—**OPTIONAL**Status code | `error`object—**OPTIONAL**source string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | `source`string—**OPTIONAL**The PubNub service from which the error originated | `message`string—**OPTIONAL**Response message | `code`integer—**OPTIONAL**Internal error code |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL**Status code |
| `error`object—**OPTIONAL**source string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | `source`string—**OPTIONAL**The PubNub service from which the error originated | `message`string—**OPTIONAL**Response message | `code`integer—**OPTIONAL**Internal error code |
| `source`string—**OPTIONAL**The PubNub service from which the error originated |
| `message`string—**OPTIONAL**Response message |
| `code`integer—**OPTIONAL**Internal error code |
| `500`Internal Server ErrorSchema — OPTIONALstatus integer — OPTIONALStatus codeerror object — OPTIONALsource string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | Schema—**OPTIONAL** | `status`integer—**OPTIONAL**Status code | `error`object—**OPTIONAL**source string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | `source`string—**OPTIONAL**The PubNub service from which the error originated | `message`string—**OPTIONAL**Response message | `code`integer—**OPTIONAL**Internal error code |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL**Status code |
| `error`object—**OPTIONAL**source string — OPTIONALThe PubNub service from which the error originatedmessage string — OPTIONALResponse messagecode integer — OPTIONALInternal error code | `source`string—**OPTIONAL**The PubNub service from which the error originated | `message`string—**OPTIONAL**Response message | `code`integer—**OPTIONAL**Internal error code |
| `source`string—**OPTIONAL**The PubNub service from which the error originated |
| `message`string—**OPTIONAL**Response message |
| `code`integer—**OPTIONAL**Internal error code |

sub_key
*
Type:
string
Your app's subscribe key from
[Admin Portal](https://admin.pubnub.com)
.
channel
*
Type:
string
The channel ID to perform the operation on.
id
*
Type:
string
PubNub-generated ID for uploaded file
name
*
Type:
string
User-supplied filename
status
Type:
integer
Status code
Example:
200
status
Type:
integer
Status code
Example:
400
error
Type:
object
status
Type:
integer
Status code
Example:
402
error
Type:
object
status
Type:
integer
Status code
Example:
500
error
Type:
object
