---
lang: en
title: 'API docs: context.filterbykey'
keywords: LoopBack 4.0, LoopBack 4
sidebar: lb4_sidebar
permalink: /doc/en/lb4/apidocs.context.filterbykey.html
---

<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [filterByKey](./context.filterbykey.md)

## filterByKey() function

Create a binding filter from key pattern

<b>Signature:</b>

```typescript
export declare function filterByKey(keyPattern?: string | RegExp | BindingFilter): BindingFilter;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  keyPattern | <code>string &#124; RegExp &#124; BindingFilter</code> | Binding key/wildcard, regexp, or a filter function |

<b>Returns:</b>

`BindingFilter`


