Delete User

There are two ways to delete users in OneAuxilia: through the OneAuxilia Dashboard or using the OneAuxilia API.

Delete users in the OneAuxilia Dashboard

To delete users in the OneAuxilia Dashboard:

  1. Navigate to the OneAuxilia Dashboard.

  2. In the navigation sidebar, select Users.

  3. You can either select the user and then in the side navigation menu, select Delete user, or select the menu icon on the right side of the user's row and select Delete user.

Delete users using the OneAuxilia API

To delete users using the OneAuxilia API, you can use the deleteUser() method from the users sub-api of the OneAuxiliaClient instance.

import { auth, oneAuxiliaClient } from "@oneauxilia/nextjs/server";
import { NextResponse } from 'next/server';

export async function DELETE() {
  const { userId } = auth();

  try {
    await oneAuxiliaClient.users.deleteUser(userId);
    return NextResponse.json({ message: 'User deleted' });
  }
  catch (error) {
    console.log(error);
    return NextResponse.json({ error: 'Error deleting user' });
  }
}

Last updated