PubNub API Limits

General API Limits

All API requests, made either by the SDK or directly through the REST interface, can be throttled if Requests Per Second (RPS) exceed 25. This limit is applicable for every PubNub API. Please contact PubNub Support if you have a need for greater than 25 requests per second.

Publish

FunctionSoft Limit (Best Practices)Hard LimitIf hard limited is exceeded
Publish Rate10-15 messages/sec per channel

NOTE: You should be able to publish as fast as your network/hardware allows and PubNub will absorb it, but the subscriber may miss out on messages if their subscribe rate is too slow. Hence, it's a good practice not to publish more than 10-15 messages/sec per channel. A slow subscribe rate may cause messages to overflow the server side channel message queue before the subscriber can receive them.

The queue only overflows if you have published over a certain number of messages during the reconnect time. This limit is configurable for your subkey and defaults to 100 messages. The queue can also overflow if the subscriber briefly disconnects from the internet..

If you have a multiplex connection, the total messages received can't exceed 100 (or your subkey configured value) over all the channels combined.

For example, if it takes 230 ms to reconnect, you can only get ~400 messages per second (4 reconnects per second, each 230 ms between, 100 messages per connect). That means if you publish 500 messages per second, the subscriber will miss some of them. Also consider this isn't taking into consideration the download time for the 100 messages (up to 32 KiB * 100).

Typically, reconnection is faster than that with the average reconnect time around 150 ms. If you're on AWS, your reconnection might be as low as 30-50 ms. With a 50 ms reconnection time, you can publish close to 2000 messages per second, and the subscriber won't miss messages due to overflow.

The most complicated part is multiplexed subscriber connections. By default, it's 100 messages in total across all the channels, and this value is configurable for your subkey. That means you can't publish more than 100 messages in the reconnect time across channels in the multiplex channel list. This also applies to channel group and wildcard subscriptions in addition to multiplexing.

Increasing the queue size for the sub-key (to 300 or 500, for example) will allow the subscribers to keep up with more messages.

Also, the queue time-to-live (TTL) must be considered in addition to the queue size. Refer to the Message Buffer Cache section of this document for more information.

If you wish to change the message queue limit, contact support@pubnub.com.
No throttling on keys in good standing (either any key with a paid plan present or keys on Free Tier at usage levels within the allowed limits).

Use HTTP Pipelining for higher throughput.
Free Tier keys exceeding usage quotas are subject to deactivation without warning. For the first overage though, we will attempt to get in contact before disabling the keys. All other keys, N/A

Error message (Channel quota exceeded)
# of users (publishers) per channel or keysetUnlimitedN/A
Message SizeLess than < 30 KiB to be safe.Length of GET request, including HTTP headers & URI encoding overhead (~32 KiB)HTTP 400 error
Channel Name Length64 characters92 Characters (97 characters including padding for base64 encoding)
User ID Length64 characters
# of API keys per PubNub account?An API is available if you need to manage an large number of keys (> 50). Contact us at support@pubnub.com if you need access to the Key Provisioning API.UnlimitedN/A

Subscribe

FunctionSoft LimitHard LimitIf hard limited is exceeded?
Subscribe RateMost of the considerations mentioned above in soft limits for publish rate are actually because of the limitations on the subscriber end (queue limit, round trips, etc).No limit

Use HTTP Streaming for maximum throughput N/A
# of ChannelsUnlimitedN/A
# of Subscribers per channel or keysetUnlimitedN/A
Message Buffer CacheSize: 100 message queue

TTL: 16 minutes maximum before cleared off the cache, but can be shorter (no guarantees).

If longer than 8 to 10 minutes disconnect, use Message Persistence

NOTE: Each socket connection has an in-memory message queue (FIFO) that holds onto recently published messages for the cache duration (12 to 16 minutes) and is limited to the most recent 100 messages. Consequently, publishing over 100 messages in the window of the subscribe reconnect time inevitably results in older messages overflowing the queue and getting discarded. For long term, reliable persistence and retrieval of missed messages, you should enable Message Persistence add-on with a duration up to 6 months or even unlimited and use the Message Persistence API to retrieve those messages.
Size: Configurable on our end, may be added costs

TTL: Currently defined with a hard limit of 20 minutes and a configurable effective percentage that controls the behavior of the network. A percentage of 90 would mean the effective TTL is 18 minutes. Currently it's set to 80% or 16 minutes.
Catch-Up100 messages (or size of buffer cache)N/A
Channel Name Length64 characters92 Characters (97 characters including padding for base64 encoding)
# of Sockets/Instances per clientPubNub does not limit the number of sockets/instances you can create, but TCP connections are typically limited by the device/platform (for instance, some browsers only allow up to 40 TCP connections).

Keep in mind each PubNub client instance creates 2 TCP socket connections: one for subscribes and the other for non-subscribe operations.
UnlimitedN/A
Multiplexing (available without Stream Controller)10 to 50 channels

When subscribing to many channels, channel groups allows for the persistence of channel lists.
No limit in client SDKs, but we advertise a hard limit of 100 channels.

No server side limit, only limited by URI length.
Channel GroupsUp to 10 channel groups, each with 100 channels for a total of 1,000 channels.

100 channels can be added at a time.
If subscribing to more than 10 channel groups, receive 400 HTTP status code with description Maximum channel registry count exceeded
Wildcard SubscribeDepends on subscribe rate

NOTE: refer to the note for Publish Rate
3 levels (2 dots) of wildcards:

a.

a.b.


No limit to # of channels able to subscribe to in a wildcard subscribe.

Wildcard Channel Names aren't allowed in Channel Groups.
Channel Group Name Length92 Characters (97 characters including padding for base64 encoding)

File Sharing

FunctionSoft LimitIf hard limited is exceeded?
File Size5 MBContact us at support@pubnub.com to increase the file size limit.
File Retention1, 3, 7, 15, or 30 days, or Unlimited

Presence

FunctionSoft LimitHard Limit
HeartbeatMinimum: 1 minute heartbeat & 29 second intervalMinimum: heartbeat:10; interval: 4 (lowest common denominator across 3.x SDKs; each have different hard limits)

4.x SDKs do not currently have limitations.
Presence Announce Max100We can adjust this limit, but there are considerations
Webhook RetriesPresence webhooks will try to POST to your URL endpoint for a maximum of 4 times, each with a 5s timeout;

Ensure that the customer's server (REST endpoint) returns 200

NOTE: If a channel has reached the Presence Announce Max limit, we will not send webhook requests for that channel
If webhook has reached maximum number of retries, the request is lost.

Message Persistence

FunctionSoft LimitHard Limit
Data Retention1 day, 7 days, 30 days, 3 months, 6 months, 1 year, or Unlimited7 days for Free tier customers
Maximum # of channels with message count100 channels per a single API callN/A

App Context

ItemSoft LimitNotes
Size of a record32 KiBMaximum size of a user or channel metadata stored in the database, including custom fields.
Max user metadata records1 millionRecommended maximum number of user metadata records using App Context API.
Max channel metadata records1 millionRecommended maximum number of channel metadata records using App Context API.
Members added in a channel5,000Recommended maximum number of members per channel using App Context API.
Memberships per user50,000Recommended maximum number of memberships per user using App Context API.
Members per transaction request20Maximum number of members added or removed in a single call using App Context API.
EndpointItemHard LimitNotes
Set user metadataname2,048 charactersMaximum length of the name asigned to the User ID.
Set user metadataexternalId2,048 charactersMaximum length of the user's identifier in an external system that you want to refer to.
Set user metadataprofileUrl2,048 charactersMaximum length of the URL to an image that can be used to visually represent the user.
Set user metadataemail320 charactersMaximum length of the user' email address.
Set user metadatatype50 charactersMaximum length of the tag that lets you categorize a user by their functional role.
Set user metadatastatus50 charactersMaximum length of the tag that lets you categorize a user by their current state.
Set channel metadataname2,048 charactersMaximum length of the channel name.
Set channel metadatadescription2,048 charactersMaximum length of additional channel information.
Set channel metadatatype50 charactersMaximum length of the tag that lets you categorize a channel by its functional role.
Set channel metadatastatus50 charactersMaximum length of the tag that lets you categorize a channel by its current state.
Set channel membership metadatastatus50 charactersMaximum length of the tag that lets you categorize a membership by its current state.
Set channel members' metadatastatus50 charactersMaximum length of the tag that lets you categorize a channel member by their current state.

Mobile Push

FunctionSoft Limit
# of Push Certificates1 APNs certificate & 1 FCM key per PubNub Key Set
Push Notification Message SizeMaximum: 2 kB for APNs, 4 kB for FCM

Access Manager

FunctionSoft LimitHard Limit
# of TokensNo limitsN/A
Grant latencyServer to server (grant by server for server usage), give it 1 second between grant and usage

Separate process (server grant, client usage), wait for grant callback before returning to client
N/A
Channels per grant200N/A

Functions

ActivitySoft LimitHard Limit
Number of Modules/Functions10 modules per keyIf you'd like a larger limit, contact support.
Number of Outbound Calls10 requests per request type in a function execution (request types include PubNub API, xhr, and KVStore calls)If you'd like a larger limit, contact support.
Rate Limit for Outbound Calls100 total requests / second (include PubNub API, xhr and KVStore calls)If you'd like a larger limit, contact support.
Execution Recursion LimitDepth = 3, meaning how many recursions but also how many Function Types chainingIf you'd like a larger limit, contact support.
CPU Wall Time10 secondsIf you'd like a larger limit, contact support.
KV Store Get Keys Limit for single call100 KeysIf you'd like a larger limit, contact support.
KV Store Byte Size Limit for Keys1KB1KB
KV Store Byte Size Limit for Values32KB32KB
Max Interval for Interval Functions1 hourIf you'd like a larger limit, contact support.
Number of console debug/error messages250 messagesIf you'd like a larger limit, contact support.

Events & Actions

ItemFreeTier 1Tier 2Tier 3Tier 4Tier 5Tier 6
Max events ingested1M4M25M66M200M500MUnlimited
Listeners18122050100Unlimited
Actions per listener133333Unlimited
Last updated on