0

Request job scope validation

by
Published Oct 17, 2025

This endpoint allows client to validate job scope description. **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Request job scope validation
4
 * This endpoint allows client to validate job scope description.
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(auth: RT.Deel, body: Body) {
8
	const url = new URL(`https://api.letsdeel.com/rest/v2/eor/job-scopes/validate`)
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
	/**
34
	 * details of job scope
35
	 */
36
	data: {
37
		/**
38
		 * The ID of the team.
39
		 */
40
		team_id: string
41
		/**
42
		 * The scope of the job.
43
		 */
44
		job_scope: string
45
		/**
46
		 * The title of the job.
47
		 */
48
		job_title: string
49
		/**
50
		 * Indicates if a work visa is required.
51
		 */
52
		work_visa?: boolean
53
		/**
54
		 * Optional client name. The validation refuses a job scope if it includes the client name. If not provided, it will be inferred from the legal entity instead.
55
		 */
56
		client_name?: string
57
		/**
58
		 * The name of the employee.
59
		 */
60
		employee_name: string
61
		/**
62
		 * The ID of the special job.
63
		 */
64
		special_job_id?: string
65
		/**
66
		 * The state of employment.
67
		 */
68
		employment_state?: string
69
		/**
70
		 * The country of employment.
71
		 */
72
		employment_country: string
73
		/**
74
		 * The nationality of the employee.
75
		 */
76
		employee_nationality?: string
77
		/**
78
		 * The ID of the client's legal entity.
79
		 */
80
		client_legal_entity_id: string
81
		[k: string]: unknown
82
	}
83
	[k: string]: unknown
84
}
85