Is there a way to restrict access for an API Key t...
# ask-community
b
Is there a way to restrict access for an API Key to only one workspace?
1
k
Yes, at the organization level you can create a service account and then associate it to a single workspace. https://docs.prefect.io/ui/organizations/?query=service+account+#service-accounts
b
🙏
@Kalise Richmond - now that I have a service account with only access to one workspace - I need to set the
PREFECT_API_URL
env in my ECS environment. How do I find out the user id part of the url ?
<https://api.prefect.cloud/api/accounts/USER_ID/workspaces/WORKSPACE_ID>
r
A quick way to find the URL is running
prefect cloud login
locally and after login, run
prefect config view
to see the URL.
b
so I need to login to my service account?
k
Also I believe it's just the account ID, not the user Id that you need after the
/accounts
b
yeah but you cant login to a service account - so that is hard to obtain?
r
Sorry Ben - I missed where you mentioned it is a service account - my mistake.
b
or is an account the organisation?
misleading if we are talking about Orgs / Service accounts
k
Account is the organization. The URL at the top of the workspace on the flow runs dashboard should provide you with the account id and workspace id
b
gotcha