diff --git a/studio/src/pages/[organizationSlug]/apikeys.tsx b/studio/src/pages/[organizationSlug]/apikeys.tsx
index af5e0422e1..9662f203cb 100644
--- a/studio/src/pages/[organizationSlug]/apikeys.tsx
+++ b/studio/src/pages/[organizationSlug]/apikeys.tsx
@@ -144,7 +144,7 @@ const CreateAPIKeyDialog = ({
selectedFedGraphs.length === 0 &&
selectedSubgraphs.length === 0
) {
- setErrorMsg("Please select atleast one of the resource.");
+ setErrorMsg("Please select at least one of the resource.");
return;
}
@@ -197,6 +197,22 @@ const CreateAPIKeyDialog = ({
return result;
}, {});
+ // When rbac is enabled and this is the case for enterprise users
+ // you can only create an API key if you are an admin or have access to at least one federated graph or subgraph
+ if (
+ rbac &&
+ !(isAdmin || federatedGraphs.length > 0 || subgraphs.length > 0)
+ ) {
+ return (
+
+ );
+ }
+
const groupedFederatedGraphs = federatedGraphs.reduce<
Record
>((result, graph) => {