//native
type Brex = {
token: string;
};
/**
* Create a new document upload
*
The `uri` will be a presigned S3 URL allowing you to upload the referral doc securely.
*/
export async function main(
auth: Brex,
id: string,
body: {
type:
| "ARTICLES_OF_INCORPORATION"
| "IRS_EIN_CONFIRMATION"
| "IRS_EIN_APPLICATION"
| "CERTIFICATE_GOOD_STANDING";
},
) {
const url = new URL(
`https://platform.brexapis.com/v1/referrals/${id}/document_upload`,
);
const response = await fetch(url, {
method: "POST",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.token,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 170 days ago