> For the complete documentation index, see [llms.txt](https://doc.wearepatchworks.com/product-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.wearepatchworks.com/product-documentation/api-reference/miscellaneous/filters.md).

# Filters

## List Filters

> Retrieves a paginated list of filters.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Filters"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FiltersListResponse":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Filters"}},"meta":{"$ref":"#/components/schemas/PaginationMeta"},"links":{"$ref":"#/components/schemas/PaginationLinks"}}},"Filters":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"type":{"type":"string","enum":["string","string_length","number","absolute date","relative date","XPath","boolean","null","variable","array","array_length"]},"comparison":{"type":"string","enum":[">","<","==","<=",">=","!=","*","!*","NOT NULL","IS NULL","*[]","!*[]","regex"]},"value":{"type":"string"},"value_type":{"type":"string","enum":["string","integer","float","boolean","date"]},"keep_matching":{"type":"boolean"},"operator_logic":{"type":"string","enum":["and","or"]},"match_order":{"type":"boolean"},"is_default":{"type":"boolean"},"location":{"type":"string","enum":["header","body","url"]},"model_type":{"type":"string"},"model_id":{"type":"integer"},"date_format":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"field":{"type":"string"},"is_active":{"type":"boolean"}}},"PaginationMeta":{"type":"object","properties":{"current_page":{"type":"integer"},"from":{"type":"integer","nullable":true},"last_page":{"type":"integer"},"path":{"type":"string"},"per_page":{"type":"integer"},"to":{"type":"integer","nullable":true},"total":{"type":"integer"}}},"PaginationLinks":{"type":"object","properties":{"first":{"type":"string","format":"uri"},"last":{"type":"string","format":"uri"},"prev":{"type":"string","format":"uri","nullable":true},"next":{"type":"string","format":"uri","nullable":true}}},"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/filters":{"get":{"summary":"List Filters","description":"Retrieves a paginated list of filters.","parameters":[{"name":"filter[type]","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["string","string_length","number","absolute date","relative date","XPath","boolean","null","variable","array","array_length"]}},"description":"Filter results by type.","style":"form","explode":false},{"name":"filter[field]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by field."},{"name":"filter[comparison]","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":[">","<","==","<=",">=","!=","*","!*","NOT NULL","IS NULL","*[]","!*[]","regex"]}},"description":"Filter results by comparison.","style":"form","explode":false},{"name":"filter[model_type]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by model_type."},{"name":"filter[model_id]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by model_id."},{"name":"filter[location]","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["header","body","url"]}},"description":"Filter results by location.","style":"form","explode":false},{"name":"filter[is_default]","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter results by is_default."},{"name":"filter[keep_matching]","in":"query","required":false,"schema":{"type":"boolean"},"description":"Filter results by keep_matching."},{"name":"sort","in":"query","required":false,"schema":{"type":"array","items":{"type":"string","enum":["type","-type","field","-field","comparison","-comparison"]}},"description":"Sort field. Prefix with - for descending. Available: type, field, comparison","style":"form","explode":false},{"name":"page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"default":1},"description":"Page number for pagination."},{"name":"per_page","in":"query","required":false,"schema":{"type":"integer","minimum":1,"maximum":100},"description":"Number of results per page."},{"name":"filter[active]","in":"query","required":false,"schema":{"type":"string"},"description":"Filter results by active."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersListResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"429":{"description":"Too Many Requests. The rate limit for this user has been reached.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Requests allowed per minute.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in the current minute.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"tags":["Filters"],"operationId":"filtersIndex"}}}}
```

## Create Filter

> Creates a new filter.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Filters"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FiltersResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Filters"}}},"Filters":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"type":{"type":"string","enum":["string","string_length","number","absolute date","relative date","XPath","boolean","null","variable","array","array_length"]},"comparison":{"type":"string","enum":[">","<","==","<=",">=","!=","*","!*","NOT NULL","IS NULL","*[]","!*[]","regex"]},"value":{"type":"string"},"value_type":{"type":"string","enum":["string","integer","float","boolean","date"]},"keep_matching":{"type":"boolean"},"operator_logic":{"type":"string","enum":["and","or"]},"match_order":{"type":"boolean"},"is_default":{"type":"boolean"},"location":{"type":"string","enum":["header","body","url"]},"model_type":{"type":"string"},"model_id":{"type":"integer"},"date_format":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"field":{"type":"string"},"is_active":{"type":"boolean"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}},"FiltersStoreRequest":{"type":"object","properties":{"type":{"type":"string"},"comparison":{"type":"string"},"value":{"type":"string","maximum":1024,"nullable":true},"value_type":{"type":"string","nullable":true},"keep_matching":{"type":"string"},"operator_logic":{"type":"string","nullable":true},"match_order":{"type":"string"},"is_default":{"type":"string"},"location":{"type":"string","nullable":true},"model_type":{"type":"string"},"model_id":{"type":"integer"},"date_format":{"type":"string","nullable":true},"field":{"type":"string","minLength":1}},"required":["comparison","field","keep_matching","model_id","model_type","type"]}}},"paths":{"/api/v1/filters":{"post":{"summary":"Create Filter","description":"Creates a new filter.","responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests. The rate limit for this user has been reached.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Requests allowed per minute.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in the current minute.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersStoreRequest"}}}},"tags":["Filters"],"parameters":[],"operationId":"filtersStore"}}}}
```

## Get Filter

> Retrieves the details of a specific filter.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Filters"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FiltersResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Filters"}}},"Filters":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"type":{"type":"string","enum":["string","string_length","number","absolute date","relative date","XPath","boolean","null","variable","array","array_length"]},"comparison":{"type":"string","enum":[">","<","==","<=",">=","!=","*","!*","NOT NULL","IS NULL","*[]","!*[]","regex"]},"value":{"type":"string"},"value_type":{"type":"string","enum":["string","integer","float","boolean","date"]},"keep_matching":{"type":"boolean"},"operator_logic":{"type":"string","enum":["and","or"]},"match_order":{"type":"boolean"},"is_default":{"type":"boolean"},"location":{"type":"string","enum":["header","body","url"]},"model_type":{"type":"string"},"model_id":{"type":"integer"},"date_format":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"field":{"type":"string"},"is_active":{"type":"boolean"}}},"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/filters/{filter}":{"get":{"summary":"Get Filter","description":"Retrieves the details of a specific filter.","parameters":[{"name":"filter","in":"path","required":true,"schema":{"type":"string"},"description":"The filter identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"404":{"description":"Not Found. The record does not exist.","content":{"application/json":{"schema":{"type":"string"}}}},"429":{"description":"Too Many Requests. The rate limit for this user has been reached.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Requests allowed per minute.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in the current minute.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"tags":["Filters"],"operationId":"filtersShow"}}}}
```

## Update Filter

> Updates an existing filter.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Filters"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"FiltersResponse":{"type":"object","properties":{"data":{"$ref":"#/components/schemas/Filters"}}},"Filters":{"type":"object","properties":{"id":{"type":"integer","description":"Unique identifier"},"type":{"type":"string","enum":["string","string_length","number","absolute date","relative date","XPath","boolean","null","variable","array","array_length"]},"comparison":{"type":"string","enum":[">","<","==","<=",">=","!=","*","!*","NOT NULL","IS NULL","*[]","!*[]","regex"]},"value":{"type":"string"},"value_type":{"type":"string","enum":["string","integer","float","boolean","date"]},"keep_matching":{"type":"boolean"},"operator_logic":{"type":"string","enum":["and","or"]},"match_order":{"type":"boolean"},"is_default":{"type":"boolean"},"location":{"type":"string","enum":["header","body","url"]},"model_type":{"type":"string"},"model_id":{"type":"integer"},"date_format":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"},"field":{"type":"string"},"is_active":{"type":"boolean"}}},"ErrorResponse":{"type":"object","properties":{"message":{"type":"string"},"errors":{"type":"object","additionalProperties":{"type":"array","items":{"type":"string"}}}}},"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}},"FiltersUpdateRequest":{"type":"object","properties":{"type":{"type":"string"},"comparison":{"type":"string"},"value":{"type":"string","maximum":1024},"value_type":{"type":"string","nullable":true},"keep_matching":{"type":"string"},"operator_logic":{"type":"string","nullable":true},"match_order":{"type":"string"},"is_default":{"type":"string"},"location":{"type":"string","nullable":true},"date_format":{"type":"string","nullable":true},"field":{"type":"string","minLength":1}}}}},"paths":{"/api/v1/filters/{filter}":{"put":{"summary":"Update Filter","description":"Updates an existing filter.","parameters":[{"name":"filter","in":"path","required":true,"schema":{"type":"string"},"description":"The filter identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"404":{"description":"Not Found. The record does not exist.","content":{"application/json":{"schema":{"type":"string"}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}}},"429":{"description":"Too Many Requests. The rate limit for this user has been reached.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Requests allowed per minute.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in the current minute.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/FiltersUpdateRequest"}}}},"tags":["Filters"],"operationId":"filtersUpdate"}}}}
```

## Delete Filter

> Permanently deletes a specific filter.

```json
{"openapi":"3.0.0","info":{"title":"Patchworks Core API","version":"1.0.0"},"tags":[{"name":"Filters"}],"servers":[{"url":"https://core.wearepatchworks.com"}],"security":[{"ApiKeyAuth":[]},{"BearerAuth":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"API key passed in the Authorization header. Format: `<api-key>`"},"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"OAuth 2 Bearer token obtained from POST /fabric/api/login"}},"schemas":{"MessageResponse":{"type":"object","properties":{"message":{"type":"string"}}}}},"paths":{"/api/v1/filters/{filter}":{"delete":{"summary":"Delete Filter","description":"Permanently deletes a specific filter.","parameters":[{"name":"filter","in":"path","required":true,"schema":{"type":"string"},"description":"The filter identifier."}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}},"401":{"description":"Unauthenticated"},"403":{"description":"Unauthorized"},"404":{"description":"Not Found. The record does not exist.","content":{"application/json":{"schema":{"type":"string"}}}},"429":{"description":"Too Many Requests. The rate limit for this user has been reached.","headers":{"Retry-After":{"description":"Seconds to wait before retrying.","schema":{"type":"integer"}},"X-RateLimit-Limit":{"description":"Requests allowed per minute.","schema":{"type":"integer"}},"X-RateLimit-Remaining":{"description":"Requests left in the current minute.","schema":{"type":"integer"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/MessageResponse"}}}}},"tags":["Filters"],"operationId":"filtersDestroy"}}}}
```
