Admission and limits
How many keys, rooms and requests an account may use, and what happens at a limit.
The Ball2D service enforces these limits when your server asks to open a room. They protect the service, not your process: they are checked on Ball2D's side and apply to every host that uses your keys.
Keys and rooms
| Limit | Value |
|---|---|
| Active API keys per account | 2 |
| Active rooms per key | 1 |
| Active rooms per account | 2 |
| Key lifetime | 1–365 days (7, 30, 90 or 365 in the account page) |
A room counts against these limits from the moment the service admits it until it closes. Close rooms with close() so their place is released immediately.
Request budgets
| Budget | Value |
|---|---|
| New room requests per key | 3 per minute |
| New room requests per account | 5 per minute |
| Requests made with one key | 10 per minute |
| Room requests per account | 20 per minute |
Requests refused because a room limit is full still count against the per-minute budgets.
When you reach a limit
createRoom() rejects with a RoomAdmissionError with status 429:
| Message | Meaning |
|---|---|
This API key already has an active room. | Close that room or use another key. |
Your account already has two active rooms. | Close one of your rooms. |
Room request budget exhausted. Try again later. | Wait before requesting another room. |
Too many requests. Please try again later. | Wait before requesting another room. |
retryAfterSeconds tells you how long to wait; today it is always 60. Never retry in a tight loop: every refused request still uses your per-minute budget.
Startup and lifetime
The service holds a room's place for 30 seconds while your host starts. Once the room is open, it stays authorized until it closes, its key is revoked, or its key expires, up to one year. The SDK doesn't need to renew anything while the room runs.
Players
maxPlayers sets how many players a room admits, from 2 to 30, counting the host player when there is one. There is no account limit on players.