---
lang: en
title: 'API docs: metadata.metadatainspector.definemetadata'
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.definemetadata.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; [defineMetadata](./metadata.metadatainspector.definemetadata.md)

## MetadataInspector.defineMetadata() method

Define metadata for the given target

**Signature:**

```typescript
static defineMetadata<T>(key: MetadataKey<T, DecoratorType>, value: T, target: Object, member?: string): void;
```

## 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, [DecoratorType](./metadata.decoratortype.md)<!-- -->&gt;


</td><td>

Metadata key


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

value


</td><td>

T


</td><td>

Metadata value


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

target


</td><td>

Object


</td><td>

Target for the metadata


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

member


</td><td>

string


</td><td>

_(Optional)_ Optional property or method name


</td></tr>
</tbody></table>
**Returns:**

void


