diff --git a/lib/shelly/client.rb b/lib/shelly/client.rb
index <HASH>..<HASH> 100644
--- a/lib/shelly/client.rb
+++ b/lib/shelly/client.rb
@@ -104,11 +104,11 @@ module Shelly
     end
 
     def add_ssh_key(ssh_key)
-      post("/ssh_key", :ssh_key => ssh_key)
+      post("/ssh_keys", :ssh_key => ssh_key)
     end
 
     def logout(ssh_key)
-      delete("/ssh_key", :ssh_key => ssh_key)
+      delete("/ssh_keys", :ssh_key => ssh_key)
     end
 
     def start_cloud(cloud)
diff --git a/lib/shelly/user.rb b/lib/shelly/user.rb
index <HASH>..<HASH> 100644
--- a/lib/shelly/user.rb
+++ b/lib/shelly/user.rb
@@ -26,9 +26,9 @@ module Shelly
     end
 
     def logout
-      delete_credentials
       ssh_key = File.read(ssh_key_path)
       shelly.logout(ssh_key)
+      delete_credentials
     end
 
     def token
New url to ssh_keys, delete credentials after delete ssh_key from API [#<I>]