List workspace groups
This endpoint retrieves an alphabetical list of all user groups in your workspace. You can use each group's ID to restrict app visibility when publishing projects to custom audiences.
Workspace members on a Business plan or higher who want to automate access management or publish apps visible only to specific internal teams.
Do this, in order
- 1
Create an API key with the workspaces:read scope in your Lovable settings under api-keys.
Requests made without this specific permission will be rejected with an insufficient scope error.
- 2
Send a GET request to https://api.lovable.dev/v1/workspaces/{workspace_id}/groups with your API key in the headers.
This fetches the workspace's groups sorted alphabetically by name.
- 3
Inspect the pagination object in the response and pass next_cursor into your next request if has_more is true.
The endpoint returns up to 50 groups per page by default, so paging is necessary to see the full list.
- 4
Save the relevant group ID from the returned list.
You need this ID if you want to publish a project restricted to that specific group.
Paste this into your project
Create an integration function to fetch workspace groups from GET https://api.lovable.dev/v1/workspaces/{workspace_id}/groups using a secret API key. Page through all results using the next_cursor token when has_more is true, and display the group names and their corresponding IDs in a selectable list.Words decoded
- scope
- A permission label that controls what an API key is allowed to view or change.
- cursor
- A text code returned by a list that acts as a bookmark to fetch the next batch of items.
- endpoint
- The specific web address used by an app to request data from Lovable.
Where people get stuck
- Your workspace must be on a Business plan or higher; lower tiers will receive a 402 payment required error.
- An API key created for one workspace cannot access another workspace's groups and will return a 404 error.
- Altering query parameters or sort settings between paginated cursor requests will cause requests to fail or return mismatched data.
The short version, steps, decoder and prompt on this page are written automatically from Lovable's own documentation and can lag or misread it. The official page is always the authority.