//native
type Clerk = {
apiKey: string;
};
/**
* Revoke a pending organization invitation
* Use this request to revoke a previously issued organization invitation.
Revoking an organization invitation makes it invalid; the invited user will no longer be able to join the organization with the revoked invitation.
Only organization invitations with "pending" status can be revoked.
The request accepts the `requesting_user_id` parameter to specify the user which revokes the invitation.
Only users with "admin" role can revoke invitations.
*/
export async function main(
auth: Clerk,
organization_id: string,
invitation_id: string,
body: { requesting_user_id?: string },
) {
const url = new URL(
`https://api.clerk.com/v1/organizations/${organization_id}/invitations/${invitation_id}/revoke`,
);
const response = await fetch(url, {
method: "POST",
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