diff --git a/include/mtxclient/http/client.hpp b/include/mtxclient/http/client.hpp
index 6ee19bdc11d5c5e868ab1a489261ecbf5690507d..0ada81f15b97990a29e0bcb49238982a56ad8924 100644
--- a/include/mtxclient/http/client.hpp
+++ b/include/mtxclient/http/client.hpp
@@ -460,7 +460,7 @@ public:
 
         //! Sets the visibility of a given room in the server's public room directory.
         void put_room_visibility(const std::string &room_id,
-                                 const nlohmann::json &body,
+                                 const mtx::requests::RoomVisibility &req,
                                  ErrCallback cb);
 
         //! Lists the public rooms on the server. This API returns paginated responses.
diff --git a/lib/http/client.cpp b/lib/http/client.cpp
index 16b854625317bcddd629c7cc7f83682d381da030..237c5ed32a7ec3643a464391f9e2338a4562a8a2 100644
--- a/lib/http/client.cpp
+++ b/lib/http/client.cpp
@@ -979,13 +979,13 @@ Client::get_room_visibility(const std::string &room_id,
 
 void 
 Client::put_room_visibility(const std::string &room_id,
-                                 const nlohmann::json &body,
+                                 const mtx::requests::RoomVisibility &req,
                                  ErrCallback cb)
 {
         const auto api_path = "/client/r0/directory/list/room/"
                                 + mtx::client::utils::url_encode(room_id);
-        
-        put<nlohmann::json>(api_path, body, cb);
+        std::cout << api_path << "\n"; 
+        put<mtx::requests::RoomVisibility>(api_path, req, cb);
 }
 
 void