How to delete a user (Basic Auth) via API Call?

Hi ,

I have successfully created a user which uses Basic-Auth using the Documentation.

My Request:

POST {{base-url}}/tyk/keys/my-user
x-tyk-authorization: {{token}}

HTTP/2 200 OK

{
  "key": "",
  "status": "ok",
  "action": "added",
  "key_hash": "<KEY_HASH>"
}

When trying to delete a User I get :

{
  "status": "error",
  "message": "There is no such key found"
}

Request sent to delete a user:

DELETE {{base-url}}/tyk/keys/<KEY_HASH>
x-tyk-authorization: {{token}}

I have also tried using the username instead of using the key-hask but I get the same error message as above.

What is is correct way to delete a user via API?

Thank you !

You may want to try using either of the following query params

hashed=true (Use hash explicitely: let the key definition be hased and use that as a key during lookup)
auto_guess=true (Auto guess hash state of the key_id: implicitly guess the hash state of the key_id supplied during lookup or modification)

One or the other should work depending on the value of your gateway hash property

For example
DELETE {{base-url}}/tyk/keys/?hashed=true HTTP/1.1
x-tyk-authorization: {{token}}

Result
{
  "key": "<HASH>",
  "status": "ok",
  "action": "deleted"
}

I have tried and it works!
Thanks!