Delete user

Delete user gives {
“statusCode”: 404,
“error”: “Not Found”
}

please help me with this

Please provide more information in your posts for us to help you.

  • Can you see the user you are trying to delete, in the dashboard?
  • Does calling the GET user endpoint return any results?
  • What call did you make to the Delete User endpoint? Please provide the request body (feel free to fudge the user_id if you want).

Can you see the user you are trying to delete, in the dashboard?
Yes the user shows in the user list

Does calling the GET user endpoint return any results?
The GET method returns same result as the delete method returns.

What call did you make to the Delete User endpoint? Please provide the request body (feel free to fudge the user_id if you want).
I used the url as under:
https://url/api/v2/users/:58e4d885b5faf81852b7b290
and I passed bearer token in the request header

I tried this with postman.

It looks like you are not using the correct value for the user_id parameter. The user_id should be in the form similar to auth0|577c552f12a3...., hence your Delete call should be:

DELETE
https://your-tenant.auth0.com/api/v2/users/auth0|577c552f12a3....

You can find the user_id from the user profile in the dashboard.

Thankx for your response, I tried this and got the response { “statusCode”: 400, “error”: “Bad Request”, “message”: “Bad HTTP authentication header format”, “errorCode”: “Bearer” }

I used the same postman collection provided in the website

You need to ensure that you are passing a valid access_token in the Authorization header. You can get an access_token for the Management API explorer from:

Auth0 Dashboard > APIs > Auth0 Management API > API Explorer.

You can then set this as the API Token in the API Explorer:

If using postman, ensure that the Authorization header is in the following format:

Authorization: Bearer <API_TOKEN>

I used the api
https://myurl.auth0.com/oauth/token to get the token.

Is this API right to get the token?
I supplied necessary connection, client id etc

I used the api
https://myurl.auth0.com/oauth/token to get the token.

Is this API right to get the token?
I supplied necessary connection, client id etc

Please read through the following document that outlines how to obtain and use an API token for the Management API:

The token we get from the steps written in the document is not valid it returns
{
“statusCode”: 400,
“error”: “Bad Request”,
“message”: “Bad HTTP authentication header format”,
“errorCode”: “Bearer”
}

but if we use the token from the dashboard, this returns data.
The length of token returned from the api is too short while the token from the dashboard is too long.