0

Get brands

by
Published Oct 17, 2025

Retrieves a paginated list of all brands belonging to your organization. Any one of the following roles is required for this endpoint: |Legacy Role|Equivalent Permission Set Role| |-----|--------| |org.admin.brand.read|org.permission.brand.read| |org.user.brand.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 brands
7
 * Retrieves a paginated list of all brands belonging to your organization.
8

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

11
|Legacy Role|Equivalent Permission Set Role|
12
|-----|--------|
13
|org.admin.brand.read|org.permission.brand.read|
14
|org.user.brand.read|
15
 */
16
export async function main(
17
  auth: Kustomer,
18
  page: string | undefined,
19
  pageSize: string | undefined,
20
) {
21
  const url = new URL(`https://api.kustomerapp.com/v1/brands`);
22
  for (const [k, v] of [
23
    ["page", page],
24
    ["pageSize", pageSize],
25
  ]) {
26
    if (v !== undefined && v !== "" && k !== undefined) {
27
      url.searchParams.append(k, v);
28
    }
29
  }
30
  const response = await fetch(url, {
31
    method: "GET",
32
    headers: {
33
      Authorization: "Bearer " + auth.apiKey,
34
    },
35
    body: undefined,
36
  });
37
  if (!response.ok) {
38
    const text = await response.text();
39
    throw new Error(`${response.status} ${text}`);
40
  }
41
  return await response.json();
42
}
43