{
    "componentChunkName": "component---src-templates-article-page-template-js",
    "path": "/concepts/rate-limiting/",
    "result": {"data":{"markdownRemark":{"frontmatter":{"title":"Rate limiting in Marketplace API and Integration API","slug":"rate-limiting","updated":"2022-12-21T00:00:00.000Z","category":"concepts-api-sdk","ingress":"This article describes rate limiting in Marketplace API and Integration API, as well as suggests how to handle those limits gracefully.","skills":null},"htmlAst":{"type":"root","children":[{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Starting in January 2023, Marketplace API and Integration API feature\nnew rate limits in dev and test environments. In addition, Integration\nAPI features new concurrency limits in dev and test environments and,\neventually, in live environments."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"extrainfo","properties":{"title":"What are rate limits and concurrency limits?"},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Rate limit"}]},{"type":"text","value":" means a limit on the number of requests that the API can\nprocess within a time span, e.g. in one minute."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"Concurrency limit"}]},{"type":"text","value":" means a limit on the number of simultaneous\nrequests that the API can process at any given moment."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"The rate limits are different for queries (fetching data) and commands\n(modifying data). Queries are rate limited at 1 request per second (60\nrequests per minute) on average. Commands are rate limited at 1 request\nper 2 seconds (30 requests per minute) on average. The rate limit\napplies per client IP address. You can find more information on Flex\nrate limits in the API reference for\n"},{"type":"element","tagName":"a","properties":{"href":"https://www.sharetribe.com/api-reference/marketplace.html#rate-limits","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"Marketplace API"}]},{"type":"text","value":"\nand\n"},{"type":"element","tagName":"a","properties":{"href":"https://www.sharetribe.com/api-reference/integration.html#rate-limits","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"Integration API"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It is good to note that "},{"type":"element","tagName":"strong","properties":{},"children":[{"type":"text","value":"live environments are currently not rate\nlimited"}]},{"type":"text","value":", except for one endpoint in Integration API. Still, as you\nbuild your Flex marketplace implementation to take the rate and\nconcurrency limits into account in your development environment, we do\nappreciate it if you also transfer those behaviors into production."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"interaction-between-different-rate-limits","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#interaction-between-different-rate-limits","ariaLabel":"interaction between different rate limits permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Interaction between different rate limits"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"All query and command endpoints have rate limits in dev and test\nenvironments. In addition, the Integration API listing creation endpoint\nhas a separate rate limit in all environments. This means that in dev\nand test environments, both rate limits apply to listing creation in the\nfollowing way:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"If the command rate limit burst capacity has not yet been depleted,\nlisting creation is rate limited at 100 API calls per minute. This\ndepletes the command rate limit burst capacity accordingly."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"If the command rate limit burst capacity has been depleted, listing\ncreation is rate limited at the regular command rate limit of 30\nrequests per minute."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"If other commands are taking place while listings are being created,\nall those calls count towards the command rate limit."}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"handling-rate-limits-in-marketplace-api","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#handling-rate-limits-in-marketplace-api","ariaLabel":"handling rate limits in marketplace api permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Handling rate limits in Marketplace API"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"In standard usage, the rate limit will largely be undetectable in\nMarketplace API. The API calls happen, for the most part, as a\nconsequence of user actions, so there is a natural delay between calls.\nThis means that encountering rate limit errors while developing with\nMarketplace API can point you towards finding loops and other buggy\nbehavior in your code."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If your test environment is exposed to the public web, a traffic spike\ncaused by bots or crawlers can trigger rate-limiting, preventing\nserver-side rendering from functioning. This may temporarily prevent\naccess to your test environment. Therefore, we strongly recommend using\n"},{"type":"element","tagName":"a","properties":{"href":"/docs/legacy/tutorial/deploy-to-render/#enable-http-basic-access-authentication"},"children":[{"type":"text","value":"basic HTTP authentication"}]},{"type":"text","value":"\non all deployed test marketplace applications."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h2","properties":{"id":"handling-rate-and-concurrency-limits-in-integration-api","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#handling-rate-and-concurrency-limits-in-integration-api","ariaLabel":"handling rate and concurrency limits in integration api permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Handling rate and concurrency limits in Integration API"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Rate limits will likely be more visible to you when developing with the\nIntegration API. In addition, Integration API also features concurrency\nlimiting, which needs to be handled."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"integration-sdk","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#integration-sdk","ariaLabel":"integration sdk permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Integration SDK"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"Flex Integration SDK is configured to handle concurrency limits by\ndefault starting from version 1.9.0. To take this built-in concurrency\nlimiting to use, you need to make sure your SDK is updated to at least\nthis version."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"To handle the general rate limits in dev and test environments, you can\npass configurations for query and command rate limiters. You can see the\ndetails of passing those configurations in our\n"},{"type":"element","tagName":"a","properties":{"href":"https://sharetribe.github.io/flex-integration-sdk-js/rate-limits.html","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"SDK documentation"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"For listing creation rate limits, you will need to implement your own\nrate limit handling logic. We have an example of this in our\n"},{"type":"element","tagName":"a","properties":{"href":"https://github.com/sharetribe/integration-api-examples/blob/master/scripts/create-listings.js","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"Integration API example scripts repository"}]},{"type":"text","value":"."}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"It is good to note that rate limits apply by client IP address. If you\nhave more than one instance of the SDK running on the same server or\ncomputer, then each SDK instance will rate-limit itself, but combined\nthey might still go over the total limits. Read more in our\n"},{"type":"element","tagName":"a","properties":{"href":"https://sharetribe.github.io/flex-integration-sdk-js/rate-limits.html","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"SDK documentation"}]},{"type":"text","value":".\nIf that is the case, you can:"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"ul","properties":{},"children":[{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"customize the rate limits to lower values than the suggested ones,"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"customize "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"httpsAgent"}]},{"type":"text","value":" to use "},{"type":"element","tagName":"code","properties":{},"children":[{"type":"text","value":"maxSockets"}]},{"type":"text","value":" set to much lower than 10\n(e.g. 3 to 5), so that the total number of concurrent requests has a\nlower chance of being over the limit"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"implement your own retry with random exponential backoff in case some\nrequests still get a 429 response"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"li","properties":{},"children":[{"type":"text","value":"or some combination of the above"}]},{"type":"text","value":"\n"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"h3","properties":{"id":"integration-api","style":"position:relative;"},"children":[{"type":"element","tagName":"a","properties":{"href":"#integration-api","ariaLabel":"integration api permalink","className":["anchor","before"]},"children":[{"type":"element","tagName":"svg","properties":{"ariaHidden":"true","focusable":"false","height":"16","version":"1.1","viewBox":"0 0 16 16","width":"16"},"children":[{"type":"element","tagName":"path","properties":{"fillRule":"evenodd","d":"M4 9h1v1H4c-1.5 0-3-1.69-3-3.5S2.55 3 4 3h4c1.45 0 3 1.69 3 3.5 0 1.41-.91 2.72-2 3.25V8.59c.58-.45 1-1.27 1-2.09C10 5.22 8.98 4 8 4H4c-.98 0-2 1.22-2 2.5S3 9 4 9zm9-3h-1v1h1c1 0 2 1.22 2 2.5S13.98 12 13 12H9c-.98 0-2-1.22-2-2.5 0-.83.42-1.64 1-2.09V6.25c-1.09.53-2 1.84-2 3.25C6 11.31 7.55 13 9 13h4c1.45 0 3-1.69 3-3.5S14.5 6 13 6z"},"children":[]}]}]},{"type":"text","value":"Integration API"}]},{"type":"text","value":"\n"},{"type":"element","tagName":"p","properties":{},"children":[{"type":"text","value":"If you are not using the Integration SDK, we strongly recommend you to\nuse your own rate and concurrency limit handling, by using e.g. a\nlibrary such as "},{"type":"element","tagName":"a","properties":{"href":"https://www.npmjs.com/package/bottleneck","target":"_blank","rel":["noopener","noreferrer"]},"children":[{"type":"text","value":"bottleneck"}]},{"type":"text","value":"\nfor Node.js, or a similar existing implementation for your stack."}]}],"data":{"quirksMode":false}},"headings":[{"value":"Interaction between different rate limits","depth":2},{"value":"Handling rate limits in Marketplace API","depth":2},{"value":"Handling rate and concurrency limits in Integration API","depth":2},{"value":"Integration SDK","depth":3},{"value":"Integration API","depth":3}]}},"pageContext":{"slug":"rate-limiting","category":"concepts-api-sdk"}},
    "staticQueryHashes": ["3794076007","439097193","717698143"]}