---
title: ScriptableFilter
description: Processes requests and responses by using a Groovy script.
component: pinggateway
version: 7.2
page_id: pinggateway:reference:ScriptableFilter
canonical_url: https://docs.pingidentity.com/pinggateway/2026/reference/ScriptableFilter.html
llms_txt: https://docs.pingidentity.com/pinggateway/llms.txt
docs_for_agents: https://developer.pingidentity.com/build-with-ai/docs-for-agents.md
revdate: 2025-06-02T16:30:54Z
superseded_by: https://docs.pingidentity.com/pinggateway/2026/reference/ScriptableFilter.html
section_ids:
  ScriptableFilter-usage: Usage
  ScriptableFilter-properties: Properties
  ScriptableFilter-examples: Examples
  ScriptableFilter-moreinfo: More information
---

# ScriptableFilter

Processes requests and responses by using a Groovy script.

When a ScriptableFilter processes a request, it can execute `return next.handle(context, request)` to call the next filter or handler in the current chain and return the value from the call. Actions on the response must be performed in the Promise's callback methods.

Scripts must return a [Promise\<Response, NeverThrowsException>](../_attachments/apidocs/org/forgerock/util/promise/Promise.html) or a [Response](../_attachments/apidocs/org/forgerock/http/protocol/Response.html).

This section describes the usage of ScriptableFilter, and refers to the following sections of the documentation:

* For information about script properties, available global objects, and automatically imported classes, see [Scripts](Scripts.html).

* For information about creating scriptable objects in Studio, see [Scripts in Studio](../gateway-guide/extending.html#scripting-studio) and [Configure scriptable throttling](../gateway-guide/throttling.html#throttling-scriptable).

## Usage

```json
{
    "name": string,
    "type": "ScriptableFilter",
    "config": {
        "type": configuration expression<string>,
        "file": configuration expression<string>, // Use either "file"
        "source": [ string, ... ],                // or "source", but not both.
        "args": map,
        "clientHandler": Handler reference
    }
}
```

## Properties

For information about properties for ScriptableFilter, see [Scripts](Scripts.html).

## Examples

For an example scriptable filter that recovers policy advices from AM, see the `failureHandler` property of [PolicyEnforcementFilter](Filters.html#PolicyEnforcementFilter).

## More information

[Scripts](Scripts.html)

[org.forgerock.openig.filter.ScriptableFilter](../_attachments/apidocs/org/forgerock/openig/filter/ScriptableFilter.html)
