---
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 markdown="1">

ctx


</td><td markdown="1">

[Context](./context.context.md)


</td><td markdown="1">

Context object


</td></tr>
<tr><td markdown="1">

interceptor


</td><td markdown="1">

[Interceptor](./context.interceptor.md) \| [Constructor](./context.constructor.md)<!-- -->&lt;[Provider](./context.provider.md)<!-- -->&lt;[Interceptor](./context.interceptor.md)<!-- -->&gt;&gt;


</td><td markdown="1">

An interceptor function or provider class


</td></tr>
<tr><td markdown="1">

options


</td><td markdown="1">

[InterceptorBindingOptions](./context.interceptorbindingoptions.md)


</td><td markdown="1">

_(Optional)_ Options for the interceptor binding


</td></tr>
</tbody></table>

**Returns:**

[Binding](./context.binding.md)<!-- -->&lt;[Interceptor](./context.interceptor.md)<!-- -->&gt;


