Deleting user via REST API returns "OAuth 2.0 is not enabled for this method"

I am trying to delete specific user(s) via REST API according
to docs https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-users/#api-rest-api-3-user-delete but returns OAuth 2.0 is not enabled for this method. error. Here is my code:

await API.asUser().requestJira(
      route`/rest/api/3/user?accountId=${accountId}`,
      {
        method: "DELETE",
        headers: {
          Accept: "application/json",
          "Content-Type": "application/json",
        },
      },
    );

I made the same request with the Authorization header in Postman and it was successful. What am i doing wrong?

Unfortunately this Delete user API doesn’t support OAuth which is what asUser() and asApp() use for authentication

In the REST API only those that are marked with “OAuth scopes required” will work via that mechanism, e.g., Create issue API has

OAuth scopes required: write:jira-work

1 Like