Rate Limits

LAST EDIT Feb 20 2021

Stream powers chat and activity feeds for a billion end users. The tech is based on Go, RocksDB & Raft and it scales well for some of the largest sites and apps. That being said, we have rate limits and they are useful since:

  • It prevents integration issues from using more capacity than is provisioned for your plan. (It's nicer to have a few API calls fail while most of your app is still up.)

  • The rate limits are set higher than our competitors, but still far below max capacity. The reason for this is that you typically want to capture integration issues early on. (so that it doesn't break later on when your app is growing quickly)

Every Application is rate limited at the API endpoint. These limits are set on 1-minute and 15-minute time windows, API requests have specific rate limits. For example, reading a channel has a different limit than sending a message.

What To Do When You've Hit a Rate LimitCopied!

If you've received a rate limited API calls here are a few things to check for first:

1. Slow down your scripts: This is the most common cause of rate limits. You're running a cronjob that runs many API calls at once. Adding a small timeout in between API calls typically solves the issue.

2. Batch endpoints: Batch update endpoints exist for most operations. So instead of doing 100 calls to update 1 user each, call the batch endpoint for updating users

3. (Re)rendering logic in your apps: Sometimes things like infinite pagination or other client side logic goes wrong and ends up sending an endless number of API calls.

4. Read/Write vs Update: Sometimes apps will call queryChannels to see if a channel exists before creating it. This isn't needed you can simply create the channel since that behaves like an upsert.

For Enterprise plans, Stream will review your architecture, and set higher rate limits for your production application. For other paid plans, you will need to review responses from Stream to watch for error conditions indicating that your API request was rate-limited and retry. We recommend implementing an exponential back-off retry mechanism.

On standard plans, please ensure to check the above, if you're sure your integration is optimal we also increase rate limits for standard plans.

User and App Base Rate LimitsCopied!

There are two kinds of rate limits for Chat: app rate limits and user rate limits. App rate limits are calculated per endpoint for your entire application. When the limit is hit, all calls from the same app and endpoint will result in an error. To avoid individual users to use your entire quota, every single user is limited to at most 60 requests per minute (per API endpoint). When the limit is exceeded, only requests from that user will be rejected.

What Happens When You Are Rate LimitedCopied!

If an API call exceeds a rate limit during the target time window, subsequent requests for the same API function will be rejected. The payload returned for that API call will indicate that rate-limiting has occurred.

If your application becomes rate-limited, it doesn't block other API calls from working. For example, hitting a rate limit on follows will still allow you to read feeds. Each "resource" is rate-limited separately.

Rate limits are reset at the end of each time window.

Rate Limit HeadersCopied!

Header

description

X-RateLimit-Limit

the total limit allowed for the resource requested (ie. 5000)

X-RateLimit-Remaining

the remaining limit (ie. 4999)

X-RateLimit-Reset

when the current limit will reset (unix timestamp)

Rate Limits by EndpointCopied!

Please reference the following table for basic plan rate limits by endpoint (on a per minute and per 15 minute basis):

API Request

Calls Per Minute

Calls Per 15 Minutes

Connect

10,000

100,000

Get or Create Channel

10,000

100,000

Mark All Read

10,000

100,000

Mark Read

10,000

100,000

Query Channels

10,000

100,000

Send Event

10,000

100,000

Delete Message

1,000

10,000

Get Message

1,000

10,000

Delete Reaction

1,000

10,000

Get Reactions

1,000

10,000

Get Replies

1,000

10,000

Query Users

1,000

10,000

Run Message Action

1,000

10,000

Send Message

1,000

10,000

Send Reaction

1,000

10,000

Stop Watching Channel

1,000

10,000

Update Message

1,000

10,000

Upload File

1,000

10,000

Upload Image

1,000

10,000

Create Guest

1,000

10,000

Ban

300

3,000

Edit Users

300

3,000

Flag

300

3,000

Mute

300

3,000

Search

300

3,000

Unban

300

3,000

Unflag

300

3,000

Unmute

300

3,000

Update Channel

300

3,000

Update Users

300

3,000

Create Device

300

3,000

Hide Channel

300

3,000

Show Channel

300

3,000

Update Users (Partial)

300

3,000

Create Channel Type

60

600

Deactivate User

60

600

Delete Channel

60

600

Delete Channel Type

60

600

Delete Device

60

600

Delete File

60

600

Delete User

60

600

Export User

60

600

Get App

60

600

Get Channel Type

60

600

List Channel Types

60

600

List Devices

60

600

Truncate Channel

60

600

Update App

60

600

Update Channel Type

60

600

Check Push

60

600

Activate User

60

600

The rate limits above are for general applications. Rate limits can be adjusted on a per need basis, depending on your use-case and plan.