---
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

**Signature:**

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

## Parameters

<table><thead><tr><th>

Parameter


</th><th>

Type


</th><th>

Description


</th></tr></thead>
<tbody><tr><td>

ctx


</td><td>

[Context](./context.context.md)


</td><td>

Context object


</td></tr>
<tr><td>

interceptor


</td><td>

[Interceptor](./context.interceptor.md) \| [Constructor](./context.constructor.md)<!-- -->&lt;[Provider](./context.provider.md)<!-- -->&lt;[Interceptor](./context.interceptor.md)<!-- -->&gt;&gt;


</td><td>

An interceptor function or provider class


</td></tr>
<tr><td>

options


</td><td>

[InterceptorBindingOptions](./context.interceptorbindingoptions.md)


</td><td>

_(Optional)_ Options for the interceptor binding


</td></tr>
</tbody></table>

**Returns:**

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


