0

AML API for Whitelabel - Data retrieval

by
Published Oct 17, 2025

Get the latest screening for an entity. **Token scopes**: `screenings:read`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * AML API for Whitelabel - Data retrieval
4
 * Get the latest screening for an entity.
5
 **Token scopes**: `screenings:read`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	entity_type: 'profile' | 'hris_profile',
10
	entity_id: string
11
) {
12
	const url = new URL(`https://api.letsdeel.com/rest/v2/screenings/aml/${entity_type}/${entity_id}`)
13

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