//native
type Clerk = {
apiKey: string;
};
/**
* Update instance organization settings
* Updates the organization settings of the instance
*/
export async function main(
auth: Clerk,
body: {
enabled?: false | true;
max_allowed_memberships?: number;
admin_delete_enabled?: false | true;
domains_enabled?: false | true;
domains_enrollment_modes?: string[];
creator_role_id?: string;
domains_default_role_id?: string;
},
) {
const url = new URL(
`https://api.clerk.com/v1/instance/organization_settings`,
);
const response = await fetch(url, {
method: "PATCH",
headers: {
"Content-Type": "application/json",
Authorization: "Bearer " + auth.apiKey,
},
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 428 days ago