Scriptrunner Intermittent 403 Forbidden Response from GET Issue API

I currently have a groovy script running in Scriptrunner when a new JSD ticket is created to populate a field from an API response.

A header I need for the API is one of the fields the customer puts in the ticket so in my script I use GET

rest/api/3/issue/${issueKey}?fields=${fieldName}

to get that field value. However I’ve been intermittently getting the following error when calling this API.

WARN - GET request to /rest/api/3/issue/${issueKey}?fields=customfield_11860 returned an error code: status: 403 - Forbidden

The API will be successful majority of the time but I keep on getting instances of it returning 403 which the stops the rest of my script from running.

Does anyone know why this is happening or how to fix this?

That’s a common problem, which happens if you overload your Jira Cloud instance with too many REST API calls. See [JRACLOUD-70909] HTTP Status 403 returned for DB connection error when calling REST APIs - Create and track feature requests for Atlassian products.