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

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

[Home](./index.md) &gt; [@loopback/metadata](./metadata.md) &gt; [MetadataInspector](./metadata.metadatainspector.md) &gt; [getClassMetadata](./metadata.metadatainspector.getclassmetadata.md)

## MetadataInspector.getClassMetadata() method

Get the metadata associated with the given key for a given class

**Signature:**

```typescript
static getClassMetadata<T>(key: MetadataKey<T, ClassDecorator>, target: Function, options?: InspectionOptions): T | undefined;
```

## Parameters

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

Parameter


</th><th>

Type


</th><th>

Description


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

key


</td><td>

[MetadataKey](./metadata.metadatakey.md)<!-- -->&lt;T, ClassDecorator&gt;


</td><td>

Metadata key


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

target


</td><td>

Function


</td><td>

Class that contains the metadata


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

options


</td><td>

[InspectionOptions](./metadata.inspectionoptions.md)


</td><td>

_(Optional)_ Options for inspection


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

**Returns:**

T \| undefined


