PageSourceSearch

https://beeceptor.com/docs/assets/js/8ad11f49.e640dda9.js

js beeceptor.com collected 2026-10-02 10:50:13 UTC 8,120 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunkbeeceptor_docs=self.webpackChunkbeeceptor_docs||[]).push([["712"],{26109(e,t,i){i.r(t),i.d(t,{metadata:()=>n,default:()=>u,frontMatter:()=>o,contentTitle:()=>a,toc:()=>d,assets:()=>l});var n=JSON.parse('{"id":"features/runtime-behavior/rate-limits","title":"Rate Limits For API Endpoints","description":"Explore Beeceptor\'s rate limits feature for enhanced API testing. Set maximum request limits per second, minute, or hour on your endpoint. Flexible configuration, fast updates.","source":"@site/docs/features/runtime-behavior/features-rate-limits.md","sourceDirName":"features/runtime-behavior","slug":"/rate-limits","permalink":"/docs/rate-limits","draft":false,"unlisted":false,"tags":[{"inline":true,"label":"Features","permalink":"/docs/tags/features"}],"version":"current","sidebarPosition":10,"frontMatter":{"id":"rate-limits","slug":"/rate-limits","title":"Rate Limits For API Endpoints","description":"Explore Beeceptor\'s rate limits feature for enhanced API testing. Set maximum request limits per second, minute, or hour on your endpoint. Flexible configuration, fast updates.","keywords":["rate-limits","api-limits","feature-gating","ip-restrictions"],"sidebar_label":"Rate Limits","sidebar_position":10,"tags":["Features"]},"sidebar":"tutorialSidebar","previous":{"title":"Latency Profiles","permalink":"/docs/default-latency"},"next":{"title":"Simulate CORS (Origin Whitelist)","permalink":"/docs/cors-origin"}}'),s=i(74848),r=i(28453);let o={id:"rate-limits",slug:"/rate-limits",title:"Rate Limits For API Endpoints",description:"Explore Beeceptor's rate limits feature for enhanced API testing. Set maximum request limits per second, minute, or hour on your endpoint. Flexible configuration, fast updates.",keywords:["rate-limits","api-limits","feature-gating","ip-restrictions"],sidebar_label:"Rate Limits",sidebar_position:10,tags:["Features"]},a,l={},d=[{value:"Use case",id:"use-case",level:2},{value:"Configure Rate Limits",id:"configure-rate-limits",level:2},{value:"Rate Limited Response",id:"rate-limited-response",level:2}];function c(e){let t={admonition:"admonition",code:"code",h2:"h2",img:"img",li:"li",p:"p",pre:"pre",strong:"strong",ul:"ul",...(0,r.R)(),...e.components},{Head:n}=t;return n||function(e,t){throw Error("Expected "+(t?"component":"object")+" `"+e+"` to be defined: you likely forgot to import, pass, or provide it.")}("Head",!0),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)(n,{children:[(0,s.jsx)("meta",{name:"twitter:card",content:"summary_large_image"}),(0,s.jsx)("meta",{name:"twitter:site",content:"@beeceptor"}),(0,s.jsx)("meta",{name:"twitter:creator",content:"@beeceptor"}),(0,s.jsx)("meta",{property:"og:type",content:"article"}),(0,s.jsx)("meta",{property:"og:title",content:"Simulate API Rate Limits With Beeceptor"}),(0,s.jsx)("meta",{property:"og:description",content:"Beeceptor accelerates webhook development and testing with its local tunnel and mock-api features. Seamlessly simulate and debug webhooks, ensuring a streamlined and efficient development process."}),(0,s.jsx)("meta",{property:"og:image",content:"https://beeceptor.com/docs/img/page-preview/simulate-api-rate-limits.gif"})]}),"\n",(0,s.jsx)(t.p,{children:"Beeceptor hosts a powerful tool in your testing toolkit: rate limited APIs. This functionality allows you to control and limit incoming requests, providing a granular control on APIs. This article delves into the use-cases, guide on how to enable rate limits and effectively utilize for your specific needs."}),"\n",(0,s.jsx)(t.admonition,{type:"info",children:(0,s.jsx)(t.p,{children:"This feature is available with paid plans."})}),"\n",(0,s.jsx)(t.h2,{id:"use-case",children:"Use case"}),"\n",(0,s.jsx)(t.p,{children:"Consider a scenario where you're building a queue consumer and pushing data to a third-party service. This third-party service has rate limits enabled. When a request is rate limited, your app is supposed to retry it."}),"\n",(0,s.jsx)(t.p,{children:"To simulate and test how your consumer code behaves under rate-limited conditions, Beeceptor proves to be an invaluable tool. You can easily configure rate limits on a Beeceptor endpoint. With rate limits enabled, you can set the maximum number of requests allowed per second, minute, or hour. The time window follows a fixed window, starting from the beginning of the time unit to the end."}),"\n",(0,s.jsx)(t.p,{children:"Besides, you should use Rate Limited mock APIs for testing retry logics. For example, if you are building an eCommerce app that communicates with a payment gateway, you can fine-tune the app's retry logic for times when the gateway is overwhelmed during big sales."}),"\n",(0,s.jsx)(t.h2,{id:"configure-rate-limits",children:"Configure Rate Limits"}),"\n",(0,s.jsx)(t.p,{children:"To enable rate limits, navigate to the endpoint's settings page. Refer to the following screenshot, indicating a rate limit of 100 requests per minute. You have the flexibility to select the time window for measuring the limit: a second, a minute, or an hour. The count of requests is calculated from the beginning to the end of the selected time unit, adhering to a fixed window approach for tracking the number of requests."}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.img,{alt:"rate-limits-setup-at-beeceptor-d
1omain",src:i(31623).A+"",width:"960",height:"453"})}),"\n",(0,s.jsx)(t.admonition,{type:"warning",children:(0,s.jsx)(t.p,{children:"It's important to note that these rate limits apply globally to the entire endpoint (sub-domain), not just specific IP addresses or HTTP routes. This means, all the request paths or source IP addresses are considered under one bucket."})}),"\n",(0,s.jsx)(t.admonition,{type:"warning",children:(0,s.jsx)(t.p,{children:"When you update the rate limit configurations, the quota resets immediately for that slot. The request count starts from zero for the selected period (second, minute, or hour)."})}),"\n",(0,s.jsx)(t.h2,{id:"rate-limited-response",children:"Rate Limited Response"}),"\n",(0,s.jsxs)(t.p,{children:["When a request exceeds the configured rate limit, the response carries a standard HTTP response code of ",(0,s.jsx)(t.code,{children:"429"}),". Notably, none of the mock rules are executed, as rate limits take precedence before rule execution."]}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.strong,{children:"Response Headers:"})}),"\n",(0,s.jsx)(t.p,{children:"The response includes three additional HTTP response headers:"}),"\n",(0,s.jsxs)(t.ul,{children:["\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"X-RateLimit-Limit"}),": The maximum number of requests allowed within the set timeframe."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"X-RateLimit-Remaining"}),": The number of requests remaining within the timeframe."]}),"\n",(0,s.jsxs)(t.li,{children:[(0,s.jsx)(t.code,{children:"X-RateLimit-Reset"}),": The timestamp indicating when the rate limit will reset. This is represented in seconds from EPOCH."]}),"\n"]}),"\n",(0,s.jsx)(t.p,{children:(0,s.jsx)(t.strong,{children:"Response Payload:"})}),"\n",(0,s.jsx)(t.pre,{children:(0,s.jsx)(t.code,{className:"language-json",children:'{\n  "error": {\n    "code": 429,\n    "message": "You have exceeded the rate limit for this API endpoint."\n  }\n}\n'})}),"\n",(0,s.jsx)(t.p,{children:"This JSON response ensures that it work for most of the integrations. In case the fixed response doesn't work for you, please reach out to the Support Team."})]})}function u(e={}){let{wrapper:t}={...(0,r.R)(),...e.components};return t?(0,s.jsx)(t,{...e,children:(0,s.jsx)(c,{...e})}):c(e)}},31623(e,t,i){i.d(t,{A:()=>n});let n=i.p+"assets/images/rate-limits-per-minute-ae87735d09cd172479138ff1b255193d.png"},28453(e,t,i){i.d(t,{R:()=>o,x:()=>a});var n=i(96540);let s={},r=n.createContext(s);function o(e){let t=n.useContext(r);return n.useMemo(function(){return"function"==typeof e?e(t):{...t,...e}},[t,e])}function a(e){let t;return t=e.disableParentContext?"function"==typeof e.components?e.components(s):e.components||s:o(e.components),n.createElement(r.Provider,{value:t},e.children)}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.