HTTP 429 Too Many Requests error when making API request

Options
Roger K
Roger K E mod
edited July 5, 2023 in Articles #1

Information Management Services notice

This error can be returned when making a request to the backend. Requests can be scoped to the Organization (e.g. when using the Developer Admin API) or globally (when using the Content Metadata Service (CMS) API). This error code is returned when there have been too many API requests of a certain type (e.g. POST) within a defined period, e.g. more than X per second.

For CMS there are limits on the number of POST, PUT and DELETE requests that can be performed on the platform within a second. For example, you could see a POST/PUT/DELETE request to the CMS API result in the following response:

{  
   "fault":{  
      "detail":{  
         "errorcode":"policies.ratelimit.SpikeArrestViolation"
      },
      "faultstring":"Spike arrest violation. Allowed rate : XXps"
   }
}

Since the limit is global, this could happen on any request to CMS. Therefore you should always catch the 429 error and retry your request after a delay of a second or two by which time the spike in requests to CMS of that type will hopefully have receded. If not, back off again and try again after another delay, repeating until success or until you decide to halt the process for special handling.