Memokit
Guides

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 TypeLimit
Read operations100 requests/minute
Write operations50 requests/minute
Search operations30 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
HeaderDescription
X-RateLimit-LimitMaximum requests allowed in the window
X-RateLimit-RemainingRemaining requests in the current window
X-RateLimit-ResetUnix 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

PlanMonthly QuotaPrice
Free1,000 operations$0
Hobby50,000 operations$19/month
EnterpriseUnlimitedCustom

What Counts as an Operation?

ActionOperations
Create memory1
Search memories1
Get memory1
Delete memory1
List memories1
Create/get/delete entity1
Create/get/delete relation1

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:00Z

Quota 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:

  1. Log in to the Memokit Console
  2. Go to Settings > Billing
  3. Select a higher plan
  4. Complete the upgrade

For Enterprise plans with custom limits, contact sales@memokit.dev.

On this page