//native
type Brevo = {
apiKey: string;
};
/**
* Update sub-accounts plan
* This endpoint will update multiple sub-accounts plan. On the Corporate solution new version v2, you can set an unlimited number of credits in your sub-organization. Please pass the value “-1" to set the consumable in unlimited mode.
*/
export async function main(
auth: Brevo,
body: {
subAccountIds?: number[];
credits?: {
email?: number;
sms?: number;
wpSubscribers?: number;
externalFeeds?: number;
whatsapp?: number;
};
features?: { users?: number; landingPage?: number; salesUsers?: number };
},
) {
const url = new URL(`https://api.brevo.com/v3/corporate/subAccounts/plan`);
const response = await fetch(url, {
method: "PUT",
headers: {
"Content-Type": "application/json",
"api-key": auth.apiKey,
},
body: JSON.stringify(body),
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.text();
}
Submitted by hugo697 428 days ago