---
lang: en
title: 'API docs: context.registerinterceptor'
keywords: LoopBack 4.0, LoopBack 4, Node.js, TypeScript, OpenAPI
sidebar: lb4_sidebar
editurl: https://github.com/loopbackio/loopback-next/tree/master/packages/context
permalink: /doc/en/lb4/apidocs.context.registerinterceptor.html
---

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

[Home](./index.md) &gt; [@loopback/context](./context.md) &gt; [registerInterceptor](./context.registerinterceptor.md)

## registerInterceptor() function

Register an interceptor function or provider class to the given context

<b>Signature:</b>

```typescript
export declare function registerInterceptor(ctx: Context, interceptor: Interceptor | Constructor<Provider<Interceptor>>, options?: InterceptorBindingOptions): Binding<Interceptor>;
```

## Parameters

|  Parameter | Type | Description |
|  --- | --- | --- |
|  ctx | [Context](./context.context.md) | Context object |
|  interceptor | [Interceptor](./context.interceptor.md) \| [Constructor](./context.constructor.md)<!-- -->&lt;[Provider](./context.provider.md)<!-- -->&lt;[Interceptor](./context.interceptor.md)<!-- -->&gt;&gt; | An interceptor function or provider class |
|  options | [InterceptorBindingOptions](./context.interceptorbindingoptions.md) | Options for the interceptor binding |

<b>Returns:</b>

[Binding](./context.binding.md)<!-- -->&lt;[Interceptor](./context.interceptor.md)<!-- -->&gt;


