Products Manager APP

API Reference

Rate Limiting

The Products Manager API implements granular rate limiting to protect against abuse and ensure fair usage across all users.


Overview

Rate limiting controls how many API requests you can make within a specific time window. This protects the API from abuse, ensures fair resource allocation, and maintains system stability for all users.

Key features:

  • Tiered limits: Different endpoints have different limits based on resource intensity
  • Per-user tracking: Limits are tracked per authenticated user
  • Clear headers: Every response includes rate limit information
  • Graceful handling: 429 responses include retry timing information

Rate Limit Tiers

The API organizes rate limits into four tiers based on risk level and resource intensity:

Critical Tier

Operations that require the most restrictive limits due to security concerns or high resource cost.

TierLimitDescription
AUTH_LOGIN5/minuteLogin attempts (brute force protection)
AUTH_PASSWORD_RESET5/minutePassword reset requests
AUTH_REGISTER5/minuteNew account creation
AUTH_REFRESH30/minuteToken refresh operations
AUTH_LOGOUT30/minuteLogout operations
BULK_IMPORT500/minuteBulk data imports
BULK_EXPORT500/minuteBulk data exports
BULK_CREATE500/minuteBulk entity creation
BULK_UPDATE500/minuteBulk entity updates
BULK_DELETE500/minuteBulk entity deletion
AI_BATCH1/hourAI batch enrichment (cost control)
AI_SINGLE20/minuteAI single product enrichment

High Tier

Write operations and data export functions.

TierLimitDescription
WRITE_STANDARD100/minuteStandard POST/PUT/DELETE operations
WRITE_UPLOAD100/minuteFile uploads
WRITE_USER_MGMT100/minuteUser and role management
WRITE_CONFIG100/minuteConfiguration changes
EXPORT_STANDARD50/minuteCSV/Excel/JSON exports
EXPORT_STREAM50/minuteStreaming exports
EXPORT_DOWNLOAD50/minuteFile downloads
EXPORT_SCHEDULE50/minuteScheduled export operations

Medium Tier

Standard read operations with moderate limits.

TierLimitDescription
READ_SENSITIVE50/minuteUser data, audit logs
READ_STANDARD1000/minuteStandard GET operations
READ_ADMIN1000/minuteAdmin panel read operations

Low Tier

Public and health check endpoints with permissive limits.

TierLimitDescription
READ_PUBLIC1000/minutePublic data (categories, etc.)
HEALTH_CHECK1000/minuteHealth and status endpoints
PROGRESS_POLL1000/minuteProgress polling (high frequency)

Summary by Endpoint Category

CategoryLimitExamples
Read Endpoints1000/minuteProduct listings, search, details
Write Endpoints100/minuteCreate, update, delete operations
Analytics & Reports50/minuteDashboard metrics, exports
AI Operations20/minuteSingle enrichment, categorization
AI Batch1/hourBulk AI processing
Bulk Operations500/minuteLarge catalog imports/exports
Authentication5/minuteLogin, register, password reset

Response Headers

All API responses include rate limit information in the following headers:

HeaderDescription
X-RateLimit-LimitMaximum number of requests allowed in the current time window
X-RateLimit-RemainingNumber of requests remaining in the current time window
X-RateLimit-ResetUnix timestamp (seconds) when the rate limit window resets
Retry-AfterSeconds to wait before retrying (only present on 429 responses)

Example Response Headers

HTTP/1.1 200 OK
X-RateLimit-Limit: 1000
X-RateLimit-Remaining: 998
X-RateLimit-Reset: 1704067260
Content-Type: application/json

Error Handling (429 Too Many Requests)

When you exceed the rate limit, the API returns a 429 Too Many Requests response:

Response Body

{
  "error": "rate_limit_exceeded",
  "message": "Too many requests. Please try again later.",
  "retry_after": "Please wait before making more requests",
  "detail": "1 per 1 minute"
}

Response Headers

HTTP/1.1 429 Too Many Requests
Retry-After: 45
X-RateLimit-Limit: 5
X-RateLimit-Remaining: 0
X-RateLimit-Reset: 1704067305
Content-Type: application/json

Environment-Based Adjustments

Rate limits vary by environment to support different use cases:

Development Environment

More permissive limits for easier testing and development:

TierDevelopment LimitProduction Limit
AUTH_LOGIN20/minute5/minute
BULK_IMPORT1000/minute500/minute
BULK_DELETE1000/minute500/minute
AI_BATCH5/hour1/hour
AI_SINGLE50/minute20/minute
READ_STANDARD2000/minute1000/minute
WRITE_STANDARD200/minute100/minute

Testing Environment

Very permissive for automated test suites:

TierTesting LimitProduction Limit
AUTH_LOGIN100/minute5/minute
BULK_IMPORT1000/minute500/minute
AI_BATCH20/hour1/hour
AI_SINGLE100/minute20/minute
READ_STANDARD5000/minute1000/minute
WRITE_STANDARD500/minute100/minute
EXPORT_STANDARD100/minute50/minute

Staging Environment

Same limits as production for realistic testing.

Production Environment

The documented limits above represent production values.


Code Examples

Python (requests)

import requests
import time

def make_api_request(url, headers, max_retries=3):
    """Make an API request with rate limit handling."""
    for attempt in range(max_retries):
        response = requests.get(url, headers=headers)

        # Log rate limit info
        remaining = response.headers.get('X-RateLimit-Remaining')
        limit = response.headers.get('X-RateLimit-Limit')
        print(f"Rate limit: {remaining}/{limit} remaining")

        if response.status_code == 429:
            # Rate limited - wait and retry
            retry_after = int(response.headers.get('Retry-After', 60))
            print(f"Rate limited. Waiting {retry_after} seconds...")
            time.sleep(retry_after)
            continue

        return response

    raise Exception("Max retries exceeded")

# Usage
headers = {"Authorization": "Bearer your-token-here"}
response = make_api_request(
    "https://api.productsmanager.app/api/v1/products",
    headers
)

JavaScript (fetch)

async function makeApiRequest(url, options = {}, maxRetries = 3) {
  for (let attempt = 0; attempt < maxRetries; attempt++) {
    const response = await fetch(url, {
      ...options,
      headers: {
        'Authorization': 'Bearer your-token-here',
        ...options.headers,
      },
    });

    // Log rate limit info
    const remaining = response.headers.get('X-RateLimit-Remaining');
    const limit = response.headers.get('X-RateLimit-Limit');
    console.log(`Rate limit: ${remaining}/${limit} remaining`);

    if (response.status === 429) {
      // Rate limited - wait and retry
      const retryAfter = parseInt(response.headers.get('Retry-After') || '60');
      console.log(`Rate limited. Waiting ${retryAfter} seconds...`);
      await new Promise(resolve => setTimeout(resolve, retryAfter * 1000));
      continue;
    }

    return response;
  }

  throw new Error('Max retries exceeded');
}

// Usage
const response = await makeApiRequest(
  'https://api.productsmanager.app/api/v1/products'
);
const data = await response.json();

cURL

# Make a request and observe rate limit headers
curl -i -X GET \
  "https://api.productsmanager.app/api/v1/products" \
  -H "Authorization: Bearer your-token-here"

# Response will include:
# X-RateLimit-Limit: 1000
# X-RateLimit-Remaining: 999
# X-RateLimit-Reset: 1704067260

Best Practices

  1. Monitor headers: Always check X-RateLimit-Remaining to avoid hitting limits
  2. Implement backoff: Use exponential backoff when rate limited
  3. Batch requests: Use bulk endpoints instead of multiple single requests
  4. Cache responses: Reduce API calls by caching frequently accessed data
  5. Use webhooks: For event-driven updates instead of polling
  6. Plan for limits: Design your integration with rate limits in mind

Requesting Higher Limits

For applications requiring higher rate limits or custom quotas, please contact support with:

  • Your use case description
  • Expected request volumes
  • Specific endpoints affected