Rate limiter

Overview

What is rate limiting?

Rate limiting in Shoptet API operates at the level of server overload protection (DDoS). It does not limit the total number of queries or data volume — instead, it controls the number of simultaneous active connections to ensure the API remains stable, secure, and performant for all users.

Connection Limits

Shoptet enforces limits on the number of concurrent active connections from a single source:

  • 50 connections max from a single IP address
  • 3 connections max for a single API token
  • HTTP 429 returned when limits are exceeded

Leaky Bucket Algorithm

In addition to connection limits, Shoptet uses a leaky bucket algorithm to measure the efficiency and complexity of your API calls over time:

  • Each app has a bucket of 200 drops capacity
  • API requests add drops based on complexity
  • 10 drops/second are automatically removed
  • Full bucket = error 429

Some URLs (e.g. for bulk operations) may have their own specific limits, which are documented individually for those endpoints.

Technical Configuration

Connection Limit Configuration

The connection-level rate limiting is implemented via Nginx. Here is the underlying configuration that enforces these limits:

Leaky Bucket Algorithm

How the Leaky Bucket Works

The leaky bucket algorithm is a token-based rate limiting system that measures not just the number of requests, but their complexity and resource impact. This is why we use “drops” as the unit — different requests have different weights.

How the bucket fills & empties

Request comes in

Every API request tosses a number of “drops” into the bucket. The number depends on the complexity (response size, filters, data volume).

Drops are calculated post-execution

Shoptet calculates the complexity of a query after execution. The actual cost is based on the query results — more data = more drops.

Bucket leaks continuously

Every second, 10 drops are automatically removed from the bucket (if there are any), restoring capacity for future requests.

Full bucket = 429 error

If the bucket is full and there’s no space for new drops from an incoming request, you receive an HTTP 429 and must wait.

Why “drops” instead of fixed units?

Every request has different demands on server resources:

  • A product list with many items and filters uses far more resources than a simple e-shop info request.
  • Complexity cannot be expressed in any fixed unit — that is why we use “drops”.
  • Calls from one add-on do not affect the rate limits of another add-on on the same project.
  • Calls to one project do not affect the rate limits of another project, even from the same add-on.

Isolation is key: Each (add-on × project) pair has its own independent bucket. This prevents one misbehaving integration from impacting others.

Response Headers

Every API response includes headers that give you real-time visibility into your rate limit status. Use these to monitor your integration proactively and avoid hitting the limits.

X-RateLimit-Bucket-Filling

Present in every response. Shows current bucket usage as current/max (e.g., 130/200).

Retry-After

Present only when bucket is full. Contains a date-time value indicating when you can start requesting again.

Example: Bucket filling up

Monitoring & Alerts

Email Notifications

Shoptet proactively monitors your integrations and sends automated email reports to help you identify efficiency issues before they cause problems.

When do emails get sent?

Shoptet sends emails twice daily — at 8 AM and 2 PM.

The emails retrospectively send aggregated data as a summary in a certain time box, which helps you in reverse investigation.

Email Indicators

Emails contain color-coded indicators showing the health of your bucket:

Orange — your bucket was almost full. Investigate the root causes of your high API usage.

Red — your bucket is overloaded. Your integration was suspended in certain time windows. Immediate action required.

Who receives the emails?

Add-on creators

Emails are sent to the contact email listed with the add-on.

Premium integrations

Emails go to the primary project contact. All premium e-shop owners are also informed with explanations and instructions.

Duplicate Request Protection

Locks

Write endpoints (DELETE, PATCH, POST, PUT methods) can take longer to process and may be prone to two concurrent matching requests being sent at the same time. To prevent this, Shoptet uses a locking mechanism.

How Locks Work

  • If you execute the same request twice in quick succession, the second request receives an error response with a 423 status code.
  • A lock is valid only for a specific URL, for the duration of request processing.
  • Locks last no longer than 5 seconds.
  • This prevents identical write operations from being duplicated.

Lock Behavior Summary

Affected methodsDELETEPATCHPOSTPUT
Error code423 Locked
Lock scopePer specific URL
Max duration5 seconds

Best Practices

Building Rate-Limit-Friendly Integrations

Following these practices will help you avoid rate limit issues, keep your integration efficient, and ensure stable operation for your e-shop clients.

Monitor Your Headers

Always read the X-RateLimit-Bucket-Filling header in every response. Track your bucket usage and slow down or pause requests when it approaches 200/200.

Respect Retry-After

When you receive a 429 response, always check the Retry-After header. Do not retry immediately — wait until the indicated timestamp before sending new requests.

Use Bulk Endpoints

Where available, prefer bulk endpoints over multiple individual requests. Fetching 100 products in one call is far more efficient than 100 separate calls, even if the bulk endpoint has its own per-request limits.

Minimize Query Complexity

Since drops are based on complexity, reduce unnecessary data fetching: use pagination efficiently, apply specific filters, request only the fields you need, and avoid broad queries on large datasets.

Cache Responses

Avoid repeating identical API calls for data that rarely changes (e.g. brand details, categories).

Use Webhooks

Instead of polling at a fixed interval, subscribe to webhook events and only fetch data when something changes.

Investigate Email Alerts

When you receive orange or red indicator emails, take them seriously. Analyze which endpoints are generating the most drops and optimize those integrations as a priority.

Error Reference

Rate Limit Error Codes

Here are the HTTP status codes related to rate limiting that your integration needs to handle:

Status CodeNameCauseAction
429Too Many RequestsConnection limit exceeded (per IP or per token), OR leaky bucket is full.Check Retry-After header and wait before retrying.
423LockedDuplicate write request sent while a matching request is still being processed.Wait and retry after a short delay (max 5 seconds for lock to expire).

Quick Reference

Summary

Connection Limits

  • Max 50 concurrent connections per IP
  • Max 3 concurrent connections per token
  • Exceeding returns HTTP 429

Leaky Bucket

  • Bucket capacity: 200 drops per app/project
  • Leak rate: −10 drops/second
  • Full bucket returns HTTP 429 with Retry-After
  • Header sent every response: X-RateLimit-Bucket-Filling

Have questions? If you have questions or concerns, please contact us at api@shoptet.cz or reach out to your partner manager. We are ready to help you as much as we can.