[role="xpack"]
[testenv="platinum"]
[[ml-get-filter]]
=== Get Filters API
++++
<titleabbrev>Get Filters</titleabbrev>
++++

Retrieves filters.


==== Request

`GET _xpack/ml/filters/<filter_id>` +

`GET _xpack/ml/filters/`


===== Description

You can get a single filter or all filters. For more information, see 
{stack-ov}/ml-rules.html[Machine learning custom rules].


==== Path Parameters

`filter_id`::
  (string) Identifier for the filter.


==== Request Body

`from`:::
    (integer) Skips the specified number of filters.

`size`:::
    (integer) Specifies the maximum number of filters to obtain.


==== Results

The API returns the following information:

`filters`::
  (array) An array of filter resources.
  For more information, see <<ml-filter-resource>>.


==== Authorization

You must have `monitor_ml`, `monitor`, `manage_ml`, or `manage` cluster
privileges to use this API. For more information, see
{xpack-ref}/security-privileges.html[Security Privileges].


==== Examples

The following example gets configuration information for the `safe_domains`
filter:

[source,js]
--------------------------------------------------
GET _xpack/ml/filters/safe_domains
--------------------------------------------------
// CONSOLE
// TEST[skip:setup:ml_filter_safe_domains]

The API returns the following results:
[source,js]
----
{
  "count": 1,
  "filters": [
    {
      "filter_id": "safe_domains",
      "description": "A list of safe domains",
      "items": [
        "*.google.com",
        "wikipedia.org"
      ]
    }
  ]
}
----
// TESTRESPONSE
