Skip to main content

Deleting a user

This guide walks through the process of deleting an existing user from the Stonal platform using the API.

Prerequisites
  • A valid set of API credentials
  • A valid access token (see: Get a token)
  • An organization code

Step 1: Retrieving the user UID

Before deleting a user, verify that they exist to ensure the correct user will be deleted.

See: API Specification

POST /v1/organizations/{organizationCode}/users/search

Request body:

{
"email": "firstName.lastName@corp.com"
}

If the user exists, you'll receive a 200 response with the user's details including their ID. If not, you'll need to verify the user information.


Step 2: Delete the user

Once you have confirmed the user's existence and have their ID, you can proceed with deletion.

See: API Specification

DELETE /v1/organizations/{organizationCode}/users/{id}

Path parameters:

  • organizationCode: Code of client (e.g., "STONAL")
  • id: ID of user to delete (e.g., "123456789")

Possible responses:

  • 204: User has been successfully deleted
  • 404: User to delete does not exist

Notes

  • The deletion operation is permanent and cannot be undone
  • You must have appropriate authorization to delete users
  • The user ID must be obtained from a previous search or get user operation
  • All user permissions and authorizations will be removed upon deletion

Error Handling

Common error scenarios:

  • User UID not found
  • Invalid organization code
  • Insufficient permissions to delete users
  • Invalid or expired access token
  • Network connectivity issues

Always check the response status and handle errors appropriately in your implementation.