Which API does each REST API endpoint return a 401 for you? Or only specific endpoint? If so, what's the full cURL call being made?
I couldn't quite figure out what happened, but I try to describe my activity on the server with the Plesk RESTful API:
In practice, with Plesk RESTful API I automatically create 'user + domain' on the plesk and it went perfectly on server No. 1
Today I encountered the problem and my curl script no longer created the domain but only the user
I did a switch on server no.2 to see if the curl script had any bugs but on server no.2 it worked perfectly so it is not a php curl script error
Then I copied the API-Key to test it directly on plesk in the Plesk RESTful API v2 page and that's where I discovered the 401 error on all entry points
Thinking that API-Key had expired (although I know it never expires) I regenerated more API-Key with the script anyway:
plesk bin secret_key -c -ip-address xxx.xx.xxx.xxx -description "token"
but even so I got a 401 error.
So I tried regenerating API-KEY with the following script:
plesk bin secret_key –c
In this case, the generated key worked perfectly on both curl and plesk page Remote Api
I don't understand what happened but after the 401 error and the KEY no longer working in my vhosts and System file was occupied by folders from domains I had created with Curl and then deleted from plesk.
To delete them from vhosts I had to recreate the deleted domains and then delete them again, and this solved the vhosts problem
But all this has created a problem for me on Service Plans and Subscriptions.
Now on Service Plans I have five domains that I had deleted, but in fact the domains no longer exist inside the Service Plans.
I have tried sending the Plesk repair command but have not solved it However apart from the Service Plans and Subscriptions which say they contain domains now with the regeneration of the KEY-API everything seems to work.
If there is a solution to empty the Service Plans and Subscriptions I thank you.
I apologise for my lengthy explanation