---
source_url: https://www.pubnub.com/docs/sdks/rest-api/list-files
title: List files
---

# List files

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

List all files uploaded to the channel.

| 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. |

| Query Parameters |
| --- |
| `limit`integerPossible values: 1 ≤ value ≤ 100The maximum number of file results to be returned in a response |
| `next`stringThe token to use to retrieve the next batch of files |

| Responses |
| --- |
| `200`Successfully retrieved the list of uploaded filesSchema — OPTIONALstatus integer — OPTIONALStatus codedata object[] — OPTIONALname string — OPTIONALUser defined name for a fileid string — OPTIONALPubNub-generated ID for a filesize integer — OPTIONALSize, in bytes, of the stored filecreated string — OPTIONALISO 8601 time string of the date and time the file was uploadednext string — OPTIONALURL-safe token to get the next batch of filescount integer — OPTIONALNumber of files returned | Schema—**OPTIONAL** | `status`integer—**OPTIONAL**Status code | `data`object[]—**OPTIONAL**name string — OPTIONALUser defined name for a fileid string — OPTIONALPubNub-generated ID for a filesize integer — OPTIONALSize, in bytes, of the stored filecreated string — OPTIONALISO 8601 time string of the date and time the file was uploaded | `name`string—**OPTIONAL**User defined name for a file | `id`string—**OPTIONAL**PubNub-generated ID for a file | `size`integer—**OPTIONAL**Size, in bytes, of the stored file | `created`string—**OPTIONAL**ISO 8601 time string of the date and time the file was uploaded | `next`string—**OPTIONAL**URL-safe token to get the next batch of files | `count`integer—**OPTIONAL**Number of files returned |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL**Status code |
| `data`object[]—**OPTIONAL**name string — OPTIONALUser defined name for a fileid string — OPTIONALPubNub-generated ID for a filesize integer — OPTIONALSize, in bytes, of the stored filecreated string — OPTIONALISO 8601 time string of the date and time the file was uploaded | `name`string—**OPTIONAL**User defined name for a file | `id`string—**OPTIONAL**PubNub-generated ID for a file | `size`integer—**OPTIONAL**Size, in bytes, of the stored file | `created`string—**OPTIONAL**ISO 8601 time string of the date and time the file was uploaded |
| `name`string—**OPTIONAL**User defined name for a file |
| `id`string—**OPTIONAL**PubNub-generated ID for a file |
| `size`integer—**OPTIONAL**Size, in bytes, of the stored file |
| `created`string—**OPTIONAL**ISO 8601 time string of the date and time the file was uploaded |
| `next`string—**OPTIONAL**URL-safe token to get the next batch of files |
| `count`integer—**OPTIONAL**Number of files returned |
| `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.

`limit`

Type: integer

The maximum number of file results to be returned in a response

`next`

Type: string

The token to use to retrieve the next batch of files

`status`

Type: integer

Status code

Example: `200`

`data`

Type: array

Array items:

`items`

Type: object

An object that contains file info

Example: `{"name":"cat_picture.jpg","id":"5a3eb38c-483a-4b25-ac01-c4e20deba6d6","size":203923,"created":"2020-04-22T22:48:31.000Z"}`

`next`

Type: string

URL-safe token to get the next batch of files

Example: `"1O_3Mhk6Ty3bW3doHhLbl-BniRpx-6N4Lzey4E32QGhNmPpkrSzk_6H9b6f6VbHNpwsrf8u7LTR9aP_yxbkq6ZbIV5Fb0Oar6Y27FZeRLWksA4E-anSlENf2GFTUNF-qvAwklLOvjDNXCuPW1ui-yncaFQPq0dBHjI3EEKJpOb14moWW67sk4EcyFKS4FLL5L0P_-Mjcd5ac"`

`count`

Type: integer

Number of files returned

Example: `100`

`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
