Skip to main content

Delete a Specific User

This endpoint deletes a specific user identified by {id}

info

Only the user identified by the {id} and the administrators can delete the user.

info

There are two ways of deleting a user: soft and hard.

Soft: the user is marked as deleted, it will not appear in the user lists, the user's posts will remain and it will not be possible to create a user with the same username and ext_id (status of the user will be set to deleted: 'd').

Hard: all user's content (profile, post, votes, etc...) will be removed (status of the user will be set to unregistered: 'u').

In particular:

  • If the deletion is soft and the user is already soft deleted you will get a 400 response (The user has already been soft deleted)
  • If the deletion is soft and the user is already hard deleted you will get a 404 response (User not found)
  • If the deletion is hard and the user is already soft deleted perform hard delete
  • If the deletion is hard and the user is already hard deleted you will get a 404 response (User not found)
info

This operation requires authentication.

HTTP Request

DELETE /api/v2/user/{id}/

Parameters

NameInTypeRequiredDescription
idpathstringtrueA unique integer value identifying this user
hardqueryboolfalseIf the value is set to 1, perform hard delete else execute a soft delete

Example Request

const headers = {
'Content-Type':'application/x-www-form-urlencoded',
'Accept':'application/json',
'Authorization: Bearer <token>'
};
fetch('/api/v2/user/{id}/',
{
method: 'DELETE',
headers: headers
})
.then(function(res) {
return res.json();
}).then(function(body) {
console.log(body);
});


Responses

StatusMeaningDescriptionSchema
204No ContentResponse status codeNone