diff --git a/openedx/core/djangoapps/content_libraries/views.py b/openedx/core/djangoapps/content_libraries/views.py
index d1ff9a237db5297678a188c8a86061b1e7c0d93c..bf94dc2dd18b73a1bd3c75ed21d63bd397eaa4b1 100644
--- a/openedx/core/djangoapps/content_libraries/views.py
+++ b/openedx/core/djangoapps/content_libraries/views.py
@@ -158,10 +158,11 @@ class LibraryRootView(APIView):
         # definitions elsewhere.
         data['library_type'] = data.pop('type')
         data['library_license'] = data.pop('license')
+        key_data = data.pop("key")
         # Move "slug" out of the "key.slug" pseudo-field that the serializer added:
-        data["slug"] = data.pop("key")["slug"]
+        data["slug"] = key_data["slug"]
         # Get the organization short_name out of the "key.org" pseudo-field that the serializer added:
-        org_name = data["key"]["org"]
+        org_name = key_data["org"]
         try:
             ensure_organization(org_name)
         except InvalidOrganizationException: