MoreLogin API enforces rate limits to ensure fair usage and system stability.
| API Type | Rate Limit | Window |
|---|---|---|
| Local API | 120 requests | per minute |
| Open API | 120 requests | per minute |
When you exceed the rate limit, the API returns:
HTTP Status: 429 Too Many Requests
{
"code": 429,
"msg": "Rate limit exceeded",
"data": null,
"requestId": "..."
}import time
import requests
def api_request_with_retry(url, payload, max_retries=3):
for attempt in range(max_retries):
response = requests.post(url, json=payload)
if response.status_code == 429:
wait_time = 2 ** attempt # 1s, 2s, 4s
print(f"Rate limited. Retrying in {wait_time}s...")
time.sleep(wait_time)
continue
return response
raise Exception("Max retries exceeded")Instead of making individual API calls, use batch endpoints when available:
# Bad: 100 individual calls
for env_id in env_ids:
requests.post(f"{BASE}/api/env/start", json={"envId": env_id})
# Good: Use batch endpoints
requests.post(f"{BASE}/api/env/updateGroup/batch", json={
"envIds": env_ids,
"groupId": "target-group"
})For data that doesn't change frequently (e.g., timezone lists, platform lists), cache the response locally:
# Cache timezone/language data — it rarely changes
timezone_data = requests.post(f"{BASE}/api/env/advanced/timezone").json()
# Reuse timezone_data for subsequent profile creationsKeep track of your API call frequency. If you consistently approach the limit, consider:
- Spreading requests evenly across the minute
- Using webhooks (coming soon) instead of polling
- Combining multiple operations into batch calls