loop91 Header logo
Experiments

API Security Policy - Setting Rate limits

Kunal Khatri
#servicenow#API#Rate limit#security

ServiceNow REST Api Rate Limit

In ServiceNow, rate limits help manage the volume of incoming REST API requests and protect system performance by preventing excessive API traffic. Setting up rate limits ensures that your instance stays responsive and stable, even when external systems are making frequent calls. Let’s go through how to create and manage rate limits in ServiceNow.

1. Where to Create Rate Limits:
You define rate limits in the “System Web Services > REST > Rate Limit Rules” module.

2. Steps to Create a Rate Limit:
Here’s a step-by-step guide:

3. Example:
Let’s say you want to limit requests to the Table API to 1000 requests per hour per user:

4. Handling Rate Limit Exceeding:
When an API client exceeds the rate limit, ServiceNow responds with an HTTP 429 Too Many Requests status code. You can customize error handling and response messages if needed.

5. Advanced Considerations:

An example with screenshots.

1. Create a new Record [ System Web Services > REST > Rate Limit Rules ] API Rate limit record

In image above, we have created a rate limite rule to limit POST calls to Case table to 3 calls per hour. We have applied this rule to All users for demo purpose, you should chose Single user or User with role with create a more granular rules.

2. Call this API four times We will now use curl to call this API 4 times. API Rate limit error in terminal

That’s it folks.

← Back to Blog