Automatically deleting customers from Jira Service Manager using API

I’m trying to write a script that can take a set of user emails and delete them as customers from our JSM service. I want to use the API to do this but I don’t know how. Alternatively, I could also set their status to inactive. I just don’t want members to have access that shouldn’t. Thanks

Hi @ThomasMarconi. Welcome to the developer community. You can use the Delete User API method. You just need to provide the accountId in the request. That being said, if there are any service requests made by that account, the API method won’t allow you to delete the user (I just tested this out myself). Additionally, per the docs, you won’t be able to call this method via a Connect app… so if you’re using a script with API token, perfect.

Thank you.

How can I get the accountIds of the JSM customers? I can add someone to JSM using the add customer API method but when I call the Get All User method it pulls other users and not the ones I’ve added via the API.

Essentially what I want to do is have a user’s email that I want to remove from JSM and I want to remove them using the API.

Would I take that email, look for a user with that email, then get that user’s accoundId and them use it in the delete method?

Yes, that’s exactly what you would do.