Deleting roles
You can delete any role you have created, if the role you are trying to delete does not exist then this has no effect
- NodeJS
- GoLang
- Python
- cURL
Important
For other backend frameworks, you can follow our guide on how to spin up a separate server configured with the SuperTokens backend SDK  to authenticate requests and issue session tokens.
import UserRoles from "supertokens-node/recipe/userroles";
async function deleteRole() {
    // Delete the user role
    const response = await UserRoles.deleteRole("user");
    if (!response.didRoleExist) {
        // There was no such role
    }
}
import (
    "github.com/supertokens/supertokens-golang/recipe/userroles"
)
func deleteRole() {
    // Delete the user role
    response, err := userroles.DeleteRole("user", nil)
    if err != nil {
        // TODO: Handle error
        return
    }
    if response.OK.DidRoleExist == false {
        // There was no such role
    }
}
- Asyncio
- Syncio
from supertokens_python.recipe.userroles.asyncio import delete_role
async def delete_role_function():
    res = await delete_role("user")
    if res.did_role_exist:
        # The role actually existed
        pass
from supertokens_python.recipe.userroles.syncio import delete_role
def delete_role_function():
    res = delete_role("user")
    if res.did_role_exist:
        # The role actually existed
        pass
curl --location --request POST '/recipe/role/remove' \
--header 'api-key: ' \
--header 'Content-Type: application/json; charset=utf-8' \
--data-raw '{
  "role": "admin"
}'