0

Create Veriff session

by
Published Oct 17, 2025

Create Veriff session **Token scopes**: `screenings:write`, `worker:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Create Veriff session
4
 * Create Veriff session
5
 **Token scopes**: `screenings:write`, `worker:write`
6
 */
7
export async function main(auth: RT.Deel, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/veriff/session`)
9

10
	const response = await fetch(url, {
11
		method: 'POST',
12
		headers: {
13
			'Content-Type': 'application/json',
14
			Authorization: 'Bearer ' + auth.apiKey
15
		},
16
		body: JSON.stringify(body)
17
	})
18
	if (!response.ok) {
19
		const text = await response.text()
20
		throw new Error(`${response.status} ${text}`)
21
	}
22
	return await response.json()
23
}
24

25
/* eslint-disable */
26
/**
27
 * This file was automatically generated by json-schema-to-typescript.
28
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
29
 * and run json-schema-to-typescript to regenerate this file.
30
 */
31

32
export interface Body {
33
	data: {
34
		/**
35
		 * Input data for the name change KYC operation
36
		 */
37
		user_input?: {
38
			/**
39
			 * The desired last name of the user
40
			 */
41
			last_name: string
42
			/**
43
			 * The desired first name of the user
44
			 */
45
			first_name: string
46
			/**
47
			 * The desired middle name of the user
48
			 */
49
			middle_name?: string
50
			[k: string]: unknown
51
		}
52
		/**
53
		 * The type of KYC operation to perform
54
		 */
55
		operation_type:
56
			| 'IDENTITY_RESUBMISSION_KYC'
57
			| 'IDENTITY_VERIFICATION_KYC'
58
			| 'NAME_CHANGE_KYC'
59
			| 'EMAIL_CHANGE_KYC'
60
		[k: string]: unknown
61
	}
62
	[k: string]: unknown
63
}
64