Rate Limits & Quotas
Understanding API rate limits and usage quotas
Rate Limits & Quotas
Memokit uses rate limits and quotas to ensure fair usage and maintain service quality for all users.
Rate Limits
Rate limits control how many requests you can make to the API within a time window.
Default Limits
| Endpoint Type | Limit |
|---|---|
| Read operations | 100 requests/minute |
| Write operations | 50 requests/minute |
| Search operations | 30 requests/minute |
Rate Limit Headers
Every API response includes headers showing your current rate limit status:
X-RateLimit-Limit: 100
X-RateLimit-Remaining: 95
X-RateLimit-Reset: 1705312800| Header | Description |
|---|---|
X-RateLimit-Limit | Maximum requests allowed in the window |
X-RateLimit-Remaining | Remaining requests in the current window |
X-RateLimit-Reset | Unix timestamp when the window resets |
Handling Rate Limits
When you exceed the rate limit, you'll receive a 429 Too Many Requests response:
{
"error": {
"code": "RATE_LIMIT_EXCEEDED",
"message": "Too many requests. Please wait before making more requests.",
"retryAfter": 30
}
}Best Practice: Implement exponential backoff when you receive a 429 response:
async function fetchWithRetry(url, options, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
const response = await fetch(url, options);
if (response.status === 429) {
const retryAfter = response.headers.get('Retry-After') || Math.pow(2, i);
await sleep(retryAfter * 1000);
continue;
}
return response;
}
throw new Error('Max retries exceeded');
}Usage Quotas
Quotas limit the total number of API operations you can perform per billing period.
Plans & Quotas
| Plan | Monthly Quota | Price |
|---|---|---|
| Free | 1,000 operations | $0 |
| Hobby | 50,000 operations | $19/month |
| Enterprise | Unlimited | Custom |
What Counts as an Operation?
| Action | Operations |
|---|---|
| Create memory | 1 |
| Search memories | 1 |
| Get memory | 1 |
| Delete memory | 1 |
| List memories | 1 |
| Create/get/delete entity | 1 |
| Create/get/delete relation | 1 |
Checking Your Usage
View your current usage in the Memokit Console under Usage.
The API also returns usage information in response headers:
X-Quota-Limit: 50000
X-Quota-Used: 12500
X-Quota-Reset: 2024-02-01T00:00:00ZQuota Exceeded
When you exceed your quota, you'll receive a 403 Forbidden response:
{
"error": {
"code": "QUOTA_EXCEEDED",
"message": "Monthly quota exceeded. Please upgrade your plan.",
"currentUsage": 50000,
"limit": 50000,
"resetAt": "2024-02-01T00:00:00Z"
}
}Optimizing Usage
Batch Where Possible
Instead of creating memories one at a time in a loop, consider batching related content:
// Less efficient: 10 operations
for (const item of items) {
await createMemory({ content: item.content });
}
// More efficient: 1 operation with combined content
await createMemory({
content: items.map(i => i.content).join('\n\n')
});Cache Search Results
Cache frequently-used search results to avoid repeated API calls:
const cache = new Map();
async function searchWithCache(query, userId) {
const cacheKey = `${userId}:${query}`;
if (cache.has(cacheKey)) {
return cache.get(cacheKey);
}
const results = await searchMemories({ query, userId });
cache.set(cacheKey, results);
// Expire cache after 5 minutes
setTimeout(() => cache.delete(cacheKey), 5 * 60 * 1000);
return results;
}Use Appropriate Limits
Only request the data you need:
# Instead of fetching all memories
curl "https://api.memokit.dev/v1/memories?userId=user_123"
# Fetch only what you need
curl "https://api.memokit.dev/v1/memories?userId=user_123&limit=5"Upgrading Your Plan
If you need higher limits:
- Log in to the Memokit Console
- Go to Settings > Billing
- Select a higher plan
- Complete the upgrade
For Enterprise plans with custom limits, contact sales@memokit.dev.