Studio Snippet INVALID_FUNCTION on GetRESTProxy - Syntax check needed

Docs state: “GetRESTProxy is used to make HTTP requests from within a Studio script.”

We are trying to call an internal service from a CXone Studio script using the GetRESTProxy function. The goal is straightforward. We have a valid bearer token stored in a variable. We need to POST some JSON data to an endpoint. The script keeps failing at runtime with an INVALID_FUNCTION error. The function name looks correct. The arguments look correct. Yet it crashes.

Here is the snippet code we are using:

// Assign the proxy object
ASSIGN restProxy = GetRESTProxy("POST", "https://internal-api.example.com/data", "application/json")

// Set headers
ASSIGN restProxy.SetHeader("Authorization", "Bearer " + $user.accessToken)
ASSIGN restProxy.SetHeader("Content-Type", "application/json")

// Set body
ASSIGN restProxy.SetBody('{"id": "123", "status": "active"}')

// Execute
ASSIGN response = restProxy.Execute()

The error log shows:

Error: INVALID_FUNCTION
Message: Function GetRESTProxy is not valid in this context or arguments are malformed.
Line: 1

I’ve checked the syntax multiple times. The function signature in the docs is GetRESTProxy(method, url, contentType). We are passing a string for method, a string for URL, and a string for content type. It should work. Is there a specific scope required for the script to use this function? Or is the way we are handling the SetBody causing the parser to reject the function call entirely?

We tried removing the content type argument, just in case it defaults, but the error persists. We also tried using a different HTTP method like GET, same result. The INVALID_FUNCTION error is vague. It doesn’t tell us if the function itself is missing or if the args are wrong. Given our previous issues with SDK connection pools, I suspect this might be a configuration issue on the CXone side, but the docs don’t mention any prerequisites for GetRESTProxy other than having a valid proxy configuration.

Any ideas on what triggers this specific error? We need this to work for the integration. The script is blocking the flow.