Configure Rate Limits in the CLI
Rate Limit defines the maximum number of requests you can make using Contentstack's API within a specific time frame.
This guide provides step-by-step instructions on how to configure and manage rate limits in the Contentstack Command Line Interface (CLI).
By following these instructions, you can effectively control the number of requests made to the Contentstack API within a specified timeframe, ensuring optimal performance and preventing any disruptions due to exceeding rate limits.
Prerequisites
- Contentstack account
- CLI installed and configured (version 1.25.0 and above)
- CLI authenticated
Commands
Set Custom Rate Limit
The config:set:rate-limit command lets you set a Custom rate limit for your organization in the CLI.
- Open the terminal.
- Enter the following command:
csdx config:set:rate-limit
- Then, enter the organization UID.
With these steps, you have successfully set a rate limit in the CLI.
To set a Custom rate limit, you can pass the --limit-name and --utilize flags along with the --org flag in the command as given below:
csdx config:set:rate-limit --org blt***********bb8 --utilize 60,80 --limit-name bulkLimit,limit
Usage
csdx config:set:rate-limit
Options
- --default: (optional) Reset to default rate limit.
- --limit-name: (optional) Enter the limit names separated by commas <options: limit|getLimit|bulkLimit>.
- --org: Enter the organization UID.
- --utilize=utilize: [default: 50] Enter the utilization percentages for rate limit, separated by commas.
Examples
- To set a default rate limit for your organization:
csdx config:set:rate-limit --org blt***********bb8 --default
- To set a Custom rate limit for your organization:
csdx config:set:rate-limit --org blt***********bb8 --utilize 60 --limit-name bulkLimit
Get the Rate Limit of an Organization
The config:get:rate-limit command fetches the rate limit that you have set in an organization in the CLI.
- Open the terminal.
- Enter the following command:
csdx config:get:rate-limit
With these steps, you have successfully retrieved the rate limit you have set in the CLI.
Usage
csdx config:get:rate-limit
Remove the Rate Limit of an Organization
The config:remove:rate-limit command lets you remove an existing rate limit configuration from the CLI.
- Open the terminal.
- Enter the following command:
csdx config:remove:rate-limit
- Then, enter the organization UID.
With these steps, you have successfully removed the rate limit configuration of an organization.
Usage
csdx config:remove:rate-limit
Options
- --org: Enter the organization UID.
Examples
- To remove the configuration of the rate limit from the CLI by providing the organization UID:
csdx config:remove:rate-limit --org
Using Rate Limits for Enhanced Bulk Publishing Control
You can configure rate limits for various publishing operations, providing finer control over bulk publishing of assets or entries (bulkPublish).
By default, the rate limit is set to 1, letting you publish one asset or entry per second. To enable the bulk publish feature, you must configure the rate limit for your specific organization.
The config:set:rate-limit command lets you set the rate limit to utilize the bulk publish feature according to your plan.
Usage
config:set:rate-limit