---
source_url: https://www.pubnub.com/docs/sdks/rest-api/get-message-count
title: Get message count
---

# Get message count

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

Returns the number of messages sent after the given timetoken. You can specify up to 100 channels in a single call.

* Channels without messages have a count of 0.
* Channels with 10,000 messages or more have a count of 10000.

| Path Parameters |
| --- |
| `sub_key`string—**REQUIRED**Your app's subscribe key from Admin Portal.Example: sub-c-50264475-1902-558x-d213-7p19052012n2 |
| `channels`string—**REQUIRED**The channel names to perform the operation on.Example: ch1,ch2 |

| Query Parameters |
| --- |
| `timetoken`number—**REQUIRED**A single timetoken to cover all channels passed-in on the request path. Value must be greater than or equal to 0 (zero).Note: Required timetoken information To make a successful API call, you must provide either timetoken or channelsTimetoken, but you cannot use both. |
| `channelsTimetoken`stringA comma-delimited list of timetokens, in order of the channels list, in the request path. If the list of timetokens is not the same length as the list of channels, a 400 bad request error will result. Value must be greater than or equal to 0 (zero).Note: Required timetoken information To make a successful API call, you must provide either timetoken or channelsTimetoken, but you cannot use both.Example: 15210190573608384,15211140747622125 |
| `auth`stringString which is either the auth key (Access Manager legacy) or a valid token (Access Manager) used to authorize the operation if access control is enabled.Example: authKey / p0thisAkFl043rhDdHRsCkNyZXisRBjoERtZXRhoENzaWdYIGOAeTyWGJI |
| `uuid`stringA UTF-8 encoded string of up to 92 characters used to identify the client.Example: myUniqueUserId |
| `signature`stringSignature used to verify that the request was signed with the secret key associated with the subscriber key.If Access Manager is enabled, either a valid authorization token or a signature are required.See Access Manager documentation for details on how to compute the signature. |
| `timestamp`integerUnix epoch timestamp used as a nonce for signature computation. Must have no more than ± 60 second offset from NTP.Required if signature parameter is supplied. |

| Responses |
| --- |
| `200`OKSchema — OPTIONALstatus integer — OPTIONALerror boolean — OPTIONALchannels object — OPTIONALmore (circular) — OPTIONAL | Schema—**OPTIONAL** | `status`integer—**OPTIONAL** | `error`boolean—**OPTIONAL** | `channels`object—**OPTIONAL** | `more`(circular)—**OPTIONAL** |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL** |
| `error`boolean—**OPTIONAL** |
| `channels`object—**OPTIONAL** |
| `more`(circular)—**OPTIONAL** |
| `400`The request was invalid.Schema — OPTIONALstatus integer — OPTIONALerror boolean — OPTIONALerror_message string — OPTIONALchannels object — OPTIONAL | Schema—**OPTIONAL** | `status`integer—**OPTIONAL** | `error`boolean—**OPTIONAL** | `error_message`string—**OPTIONAL** | `channels`object—**OPTIONAL** |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL** |
| `error`boolean—**OPTIONAL** |
| `error_message`string—**OPTIONAL** |
| `channels`object—**OPTIONAL** |
| `403`Do not have permissionSchema — OPTIONALstatus integer — OPTIONALerror boolean — OPTIONALerror_message string — OPTIONAL | Schema—**OPTIONAL** | `status`integer—**OPTIONAL** | `error`boolean—**OPTIONAL** | `error_message`string—**OPTIONAL** |
| Schema—**OPTIONAL** |
| `status`integer—**OPTIONAL** |
| `error`boolean—**OPTIONAL** |
| `error_message`string—**OPTIONAL** |

sub_key
*
Type:
string
Your app's subscribe key from
[Admin Portal](https://admin.pubnub.com)
.
channels
*
Type:
string
The channel names to perform the operation on.
timetoken
*
Type:
number
A single timetoken to cover all channels passed-in on the request path. Value must be greater than or equal to 0 (zero).

Note:
Required timetoken information

To make a successful API call, you must provide either
timetoken
or
channelsTimetoken
, but you cannot use both.
channelsTimetoken
Type:
string
A comma-delimited list of timetokens, in order of the channels list, in the request path. If the list of timetokens is not the same length as the list of channels, a 400 bad request error will result. Value must be greater than or equal to 0 (zero).

Note:
Required timetoken information

To make a successful API call, you must provide either
timetoken
or
channelsTimetoken
, but you cannot use both.
auth
Type:
string
String which is either the auth key (Access Manager legacy) or a valid token (
[Access Manager](https://www.pubnub.com/docs/security/access-control/overview.md)
) used to authorize the operation if access control is enabled.
uuid
Type:
string
A UTF-8 encoded string of up to 92 characters used to
[identify the client](https://www.pubnub.com/docs/architecture/core-concepts.md)
.
signature
Type:
string
Signature used to verify that the request was signed with the secret key associated with the subscriber key.

If Access Manager is enabled, either a valid authorization token or a signature are required.

See Access Manager documentation for details on how to compute the signature.
timestamp
Type:
integer
Unix epoch timestamp used as a nonce for signature computation. Must have no more than ± 60 second offset from NTP.

Required if
signature
parameter is supplied.
status
Type:
integer
Example:
200
error
Type:
boolean
Example:
false
channels
Type:
object
more
Type:
any
Example Response

```
{
  "status": 200,
  "error": false,
  "error_message": "",
  "channels": {
    "myChannel1": 33,
    "myChannel2": 0
  },
  "more": {
    "myChannel1": {
      "url": "",
      "is_more": false
    },
    "myChannel2": {
      "url": "",
      "is_more": false
    }
  }
}
```

status
Type:
integer
Example:
400
error
Type:
boolean
Example:
true
error_message
Type:
string
Example:
"Invalid Arguments: start"
channels
Type:
object
Example:
{}
status
Type:
integer
Example:
403
error
Type:
boolean
Example:
true
error_message
Type:
string
Example:
"Do not have permission to delete"
