//native
/**
* Send Envelope
* Promote a draft envelope (status=created) to sent.
*/
export async function main(auth: RT.Docusign, envelope_id: string) {
const url = new URL(
`${auth.base_uri}/restapi/v2.1/accounts/${auth.account_id}/envelopes/${envelope_id}`,
)
const response = await fetch(url, {
method: "PUT",
headers: {
Authorization: `Bearer ${auth.token}`,
"Content-Type": "application/json",
Accept: "application/json",
},
body: JSON.stringify({ status: "sent" }),
})
if (!response.ok) {
throw new Error(`${response.status} ${await response.text()}`)
}
return await response.json()
}
Submitted by hugo989 22 days ago