0

Get a named inventory document

by
Published Oct 17, 2025

Returns detailed information for a specified Inventory Control document. For example, to return details about an inventory document that uses the Inventory Transfer In transaction definition as a template, specify `Inventory Transfer In` for the `documentName` in the request URL. Permissions and other requirements SubscriptionInventory User typeBusiness, Employee, Project Manager, Warehouse PermissionsList, View Inventory documents

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
 * Get a named inventory document
7
 * Returns detailed information for a specified Inventory Control document. For example, to return details about an inventory document that uses the Inventory Transfer In transaction definition as a template, specify `Inventory Transfer In` for the `documentName` in the request URL.   
8

9

10

11
Permissions and other requirements
12

13
SubscriptionInventory
14
User typeBusiness, Employee, Project Manager, Warehouse
15
PermissionsList, View Inventory documents
16

17

18

19

20
 */
21
export async function main(auth: SageIntacct, key: string, documentName: string) {
22
	const url = new URL(
23
		`https://api.intacct.com/ia/api/v1/objects/inventory-control/document::${documentName}/${key}`
24
	)
25

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