The API response can also work with a Groovy script. However, the objects which can be manipulated as the earlier diagram is shown are different. Rather than APIRequest, the entity will be APIResponse, correspondingly ServiceRequest is now ServiceResponse.
While the API platform offers a redaction policy it maybe more desirable to use Groovy to manipulate the response and mask values by replacing the specific with xxx for example. This is something commonly seen in websites handling credit cards. Using the same test framework for manipulating headers and the test tool, the response previously shown can be changed and have the x-b3-traceid masked out, using the following Groovy script:
// get ...