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 new user, check if they already exist to avoid 404.

See: API Specification

GET /v2/organizations/{organizationCode}/users?pageNumber=1&pageSize=10&q=firstName.lastName@corp.com

Request body:

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

If the user exists, you'll receive a 200 response with the user's details including their UID. If not, the user probably doesn't exist.


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 /v2/organizations/{organizationCode}/users/{uid}

Path parameters:

  • organizationCode: Your client code (e.g., "STONAL")
  • uid: UID of user to delete (e.g., "019619df-4767-730f-8d31-143712a08141")

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
  • The user UID must be obtained from a previous search or stored as an external id on your side

Error Handling

Common error scenarios:

  • User UID not found
  • Invalid organization code
  • Invalid or expired access token

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