0

Sign EOR contract document

by
Published Oct 17, 2025

Signs a document with the provided signature and title **Token scopes**: `contracts:write`

Script deel Verified

The script

Submitted by hugo697 Bun
Verified 235 days ago
1
//native
2
/**
3
 * Sign EOR contract document
4
 * Signs a document with the provided signature and title
5
 **Token scopes**: `contracts:write`
6
 */
7
export async function main(
8
	auth: RT.Deel,
9
	contract_id: string,
10
	_type: 'FRAMEWORK_AGREEMENT',
11
	body: Body
12
) {
13
	const url = new URL(
14
		`https://api.letsdeel.com/rest/v2/eor/contracts/${contract_id}/documents/${_type}/sign`
15
	)
16

17
	const response = await fetch(url, {
18
		method: 'POST',
19
		headers: {
20
			'Content-Type': 'application/json',
21
			Authorization: 'Bearer ' + auth.apiKey
22
		},
23
		body: JSON.stringify(body)
24
	})
25
	if (!response.ok) {
26
		const text = await response.text()
27
		throw new Error(`${response.status} ${text}`)
28
	}
29
	return await response.json()
30
}
31

32
/* eslint-disable */
33
/**
34
 * This file was automatically generated by json-schema-to-typescript.
35
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
36
 * and run json-schema-to-typescript to regenerate this file.
37
 */
38

39
export interface Body {
40
	data?: {
41
		/**
42
		 * The signature of the client signing the document.
43
		 */
44
		signature: string
45
		/**
46
		 * The job title of the client signing the document.
47
		 */
48
		client_job_title: string
49
		[k: string]: unknown
50
	}
51
	[k: string]: unknown
52
}
53