0

Delete an attachment

by
Published Oct 17, 2025

Deletes an attachment and all files that it contains. You must first remove the attachment from any objects or transactions. Permissions and other requirements SubscriptionCompany User typeBusiness, Employee, Project Manager, Platform, and Warehouse PermissionsList Attachments

Script sage_intacct Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
type SageIntacct = {
3
	token: string
4
}
5
/**
6
 * Delete an attachment
7
 * Deletes an attachment and all files that it contains. You must first remove the attachment from any objects or transactions.
8

9

10
Permissions and other requirements
11

12
SubscriptionCompany
13
User typeBusiness, Employee, Project Manager, Platform, and Warehouse
14
PermissionsList Attachments
15

16

17

18

19
 */
20
export async function main(auth: SageIntacct, key: string) {
21
	const url = new URL(`https://api.intacct.com/ia/api/v1/objects/company-config/attachment/${key}`)
22

23
	const response = await fetch(url, {
24
		method: 'DELETE',
25
		headers: {
26
			Authorization: 'Bearer ' + auth.token
27
		},
28
		body: undefined
29
	})
30
	if (!response.ok) {
31
		const text = await response.text()
32
		throw new Error(`${response.status} ${text}`)
33
	}
34
	return await response.text()
35
}
36