0

Delete Tag

by
Published Apr 8, 2025

Delete the tag with the given tag ID. Any associations between the tag and other resources will also be removed.*Rate limits*:Burst: `3/s`Steady: `60/m` **Scopes:** `tags:read` `tags:write`

Script klaviyo Verified

The script

Submitted by hugo697 Bun
Verified 428 days ago
1
//native
2
type Klaviyo = {
3
  apiKey: string;
4
};
5
/**
6
 * Delete Tag
7
 * Delete the tag with the given tag ID. Any associations between the tag and other resources will also be removed.*Rate limits*:Burst: `3/s`Steady: `60/m`
8

9
 */
10
export async function main(auth: Klaviyo, id: string, revision: string) {
11
  const url = new URL(`https://a.klaviyo.com/api/tags/${id}`);
12

13
  const response = await fetch(url, {
14
    method: "DELETE",
15
    headers: {
16
      revision: revision,
17
      "Accept": "application/vnd.api+json",
18
      Authorization: "Klaviyo-API-Key " + auth.apiKey,
19
    },
20
    body: undefined,
21
  });
22
  if (!response.ok) {
23
    const text = await response.text();
24
    throw new Error(`${response.status} ${text}`);
25
  }
26
  return await response.json();
27
}
28