0

Destroy property

by
Published Oct 17, 2025

Destroy a custom metadata property of an account. This endpoint is only available to accounts with advanced plans or above.

Script phrase Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type Phrase = {
3
	token: string
4
	baseUrl: string
5
}
6
/**
7
 * Destroy property
8
 * Destroy a custom metadata property of an account.
9

10
This endpoint is only available to accounts with advanced plans or above.
11

12
 */
13
export async function main(auth: Phrase, account_id: string, id: string) {
14
	const url = new URL(`${auth.baseUrl}/accounts/${account_id}/custom_metadata/properties/${id}`)
15

16
	const response = await fetch(url, {
17
		method: 'DELETE',
18
		headers: {
19
			Authorization: 'ApiToken ' + auth.token
20
		},
21
		body: undefined
22
	})
23
	if (!response.ok) {
24
		const text = await response.text()
25
		throw new Error(`${response.status} ${text}`)
26
	}
27
	return await response.text()
28
}
29