I am using groups API described in the docs (<http...
# permit-saas
m
I am using groups API described in the docs (https://api.permit.io/v2/redoc#tag/Groups/operation/list_group) and I see a weird behavior - calling the simplest
/groups
endpoint returns an empty array while I can see all the groups I previously created in the UI. Am I doing anything wrong or is it maybe a bug?
a
Hi @Míla Votradovec, I'm an AI assistant for Permit.io. I'll analyze available sources and get back to you shortly.
p
Hey, thanks for reaching out ! It seems our team is a little busy right now, a human will be with you within the next hour or so. In the meantime, can I help you ?
a
This sounds like it could be an issue with the API key scope or environment context. Based on the API documentation, there are a few things to check: The Groups API endpoints follow the pattern
/v2/schema/{project_id}/{env_id}/groups
(1) . Make sure you're: 1. ​*Using the correct API key type*​: There are 3 types of API Keys - Organization, Project, and Environment API Keys (2) . For the Groups API, you need at least a Project or Environment level key. 2. ​*Including the project and environment IDs in your request*​: The endpoint requires both
{project_id}
and
{env_id}
in the path (1) . 3. ​*Specifying the correct tenant*​: Groups are tenant-specific. When creating a group, you need to specify the
group_tenant
parameter . Example API call to list groups:
Copy code
curl '<https://api.permit.io/v2/schema/{project_id}/{env_id}/groups>' \
 -H 'authorization: Bearer API_SECRET_KEY'
Since you're seeing the groups in the UI but not via the API, this could be a bug. To help our engineers investigate: 1. Which Workspace / Project / Env are you using? 2. What exact API calls are you performing (as SDK code or CURL) ? 3. Which PDP version are you running? 4. Can you share any relevant logs from your PDP?
To learn more, see the sources I considered: [[1] Groups API](https://docs.permit.io/api/rebac/groups) [[2] Using the API](https://docs.permit.io/api/api-with-cli)
m
1.
Copy code
org_id:     06c3bb2b-7585-4385-8046-6aabe04bc8a3
project_id: 9ffe989d-f025-4c40-81ba-7d9e5b8d15f9
env_id:     98f62543-8a05-4304-a9ec-de83ece8a811
2.
curl  <https://api.eu.permit.io/v2/schema/default/production/groups>
with authorization header 3. latest 4. Haven't found any
When I created new group through API, it started to return correct results.
OK, I can reproduce it: • I have couple of groups created • I call DELETE on one group • API starts returning empty list for all groups
a
Hey @Míla Votradovec ! 😁 Thanks for reaching out, we’ll be back to you
o
@Shuvy Ankor, @Omer Zuarets - Please take a look into this tomorrow
s
Hi @Míla Votradovec, we saw the bug. We are checking our fix to make sure it works. You will be notified when it is released.
m
@Shuvy Ankor Thank you very much for a fast response. I will be eagerly waiting 🙂
s
HI @Míla Votradovec I’m pleased to inform you that we’ve released a fix for the deletion issue. Based on our testing, everything is working smoothly now. Please try creating a new group to test the functionality, and let us know how it works for you – we’d love to hear your feedback! We’re also actively working on further improvements to the groups area, including additional APIs that will enhance group performance.
m
Hi @Shuvy Ankor, unfortunately, the result still looks the same
👀 1
s
Hi @Míla Votradovec Can you explain to me exactly what you did? Does creating 2 new groups work for you? What is the behavior you get? After creating new ones, does the list still return an empty array?
m
I created new group in UI. Then I am calling GET on
/groups
and I still get an empty array
s
Hi, @Míla Votradovec Our full UI support for groups isn’t quite ready yet - we’re still working on a dedicated groups page. For now, I’d suggest using the API for all group operations, as it provides complete functionality. You’ll still see groups displayed throughout the system (resource page, etc.), but the API is currently the most reliable way to manage them. Let me know if you need any help with the API integration!
m
OK, let me try adding it through the API. In the meantime, can I ask you if you are planning to add groups support to the SDK?
@Shuvy Ankor I can confirm the bug is gone and it looks like it's working as it should. Thank you for a swift response.
💪 1
🙌 1
💪🏼 1
🙌🏼 1
s
I’ll be happy to open a ticket regarding the SDK for you. To ensure I provide the most relevant solution, could you let me know which language/SDK you’re currently using? Are you working with Node.js, Python, or another language?
o
To add here, yes we plan to add the groups-API to the SDKs, but it will take a while longer to cover all of them; and first we’ll be adding this to the UI
👍 1
m
Thank you all for the help. I am the most interested in Python sdk.
💪 1