]> BookStack Code Mirror - bookstack/commitdiff
Added rate limit section to the API docs
authorDan Brown <redacted>
Mon, 9 May 2022 14:12:29 +0000 (15:12 +0100)
committerDan Brown <redacted>
Mon, 9 May 2022 14:12:29 +0000 (15:12 +0100)
Closes #3423

resources/views/api-docs/index.blade.php
resources/views/api-docs/parts/getting-started.blade.php

index 5bec265e82b9d4704839655f18a3f9db365c76fd..52ad9f8f4aa351d70acc8fabeaface4ca5ae83ef 100644 (file)
@@ -15,6 +15,7 @@
                         <div class="mb-xs"><a href="#request-format">Request Format</a></div>
                         <div class="mb-xs"><a href="#listing-endpoints">Listing Endpoints</a></div>
                         <div class="mb-xs"><a href="#error-handling">Error Handling</a></div>
+                        <div class="mb-xs"><a href="#rate-limits">Rate Limits</a></div>
                     </div>
 
                     @foreach($docs as $model => $endpoints)
index 3bcf29dd4e9e3552cb1368487df3ec9ce4de2d7f..edc526971e214e146321ddb188f185d0fa625518 100644 (file)
                "message": "No authorization token found on the request"
        }
 }
-</code></pre>
\ No newline at end of file
+</code></pre>
+
+<hr>
+
+<h5 id="rate-limits" class="text-mono mb-m">Rate Limits</h5>
+<p>
+    The API has built-in per-user rate-limiting to prevent potential abuse using the API.
+    By default, this is set to 180 requests per minute but this can be changed by an administrator
+    by setting an "API_REQUESTS_PER_MIN" .env option like so:
+</p>
+
+<pre><code class="language-bash"># The number of API requests that can be made per minute by a single user.
+API_REQUESTS_PER_MIN=180</code></pre>
+
+<p>
+    When the limit is reached you will receive a 429 "Too Many Attempts." error response.
+    It's generally good practice to limit requests made from your API client, where possible, to avoid
+    affecting normal use of the system caused by over-consuming system resources.
+    Keep in mind there may be other rate-limiting factors such as web-server & firewall controls.
+</p>
\ No newline at end of file