//native
/**
* Delete a legal entity
* Archive a legal entity. This marks the entity as inactive but does not permanently remove it.
**Token scopes**: `legal-entity:read`, `legal-entity:write`
*/
export async function main(auth: RT.Deel, id: string) {
const url = new URL(`https://api.letsdeel.com/rest/v2/legal-entities/${id}`)
const response = await fetch(url, {
method: 'DELETE',
headers: {
Authorization: 'Bearer ' + auth.apiKey
},
body: undefined
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
Submitted by hugo697 235 days ago