0

Get custom attribute metadata

by
Published Oct 17, 2025

Retrieves the [metadata properties](https://developer.kustomer.com/kustomer-apps-platform/docs/klasses#metadataproperties) for the custom attributes of a specific resource (for example, Company, Conversation, Customer, Message, and KObject (custom Object)). Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.user.metadata.read|org.permission.metadata.read| |org.admin.metadata.read||

Script kustomer Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Kustomer = {
3
  apiKey: string;
4
};
5
/**
6
 * Get custom attribute metadata
7
 * Retrieves the [metadata properties](https://developer.kustomer.com/kustomer-apps-platform/docs/klasses#metadataproperties) for the custom attributes of a specific resource (for example, Company, Conversation, Customer, Message, and KObject (custom Object)).
8

9
Any one of the following roles is required for this endpoint:
10

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.user.metadata.read|org.permission.metadata.read|
14
|org.admin.metadata.read||
15

16
 */
17
export async function main(auth: Kustomer, resource: string) {
18
  const url = new URL(`https://api.kustomerapp.com/v1/metadata/${resource}`);
19

20
  const response = await fetch(url, {
21
    method: "GET",
22
    headers: {
23
      Authorization: "Bearer " + auth.apiKey,
24
    },
25
    body: undefined,
26
  });
27
  if (!response.ok) {
28
    const text = await response.text();
29
    throw new Error(`${response.status} ${text}`);
30
  }
31
  return await response.json();
32
}
33