Context
You need the ID of a reader group, usually to use it in an API call or an API call in a snippet. For example, the reader_roles field on articles, categories and readers stores reader group IDs, not group names.
The Groups tab in Account > Readers shows each group's name but not its ID.
Resolution
The quickest way to get reader group IDs is to list your groups with the API. Each group in the response has an id and a name.
- Use an API key that has Read permission on Reader group. Refer to API key permission-endpoint mapping for details.
- Make a GET call to the
readerroles.jsonendpoint. Reader groups belong to your account, not to one knowledge base, so you don't need aproject_id:curl -u <your-api-key>:X -X GET "https://app.knowledgeowl.com/api/head/readerroles.json?status=active" - Find the group by its
namein the response and copy itsid.
Leave status=active in the call: without it, the response also lists deleted groups, and a deleted group can have the same name as an active one.
If you'd rather not use the API, you can find a group's ID in your browser's developer tools:
- Go to Account > Readers and open the Groups tab.
- Right-click the group's name and select Inspect.
- In the developer tools, find the table row (
<tr>) that contains the name. Itsidisrole-followed by the group's ID. For example, inid="role-699762cfff297e497f051725", the group ID is699762cfff297e497f051725.
Refer to API endpoint reference for everything the reader group endpoints can do.
Background
KnowledgeOwl gives every reader group an ID when it's created, and the ID never changes, even if you rename the group. The API and API calls in snippets use these IDs.
Single sign-on (SSO) and remote authentication match reader groups by their names, so you don't need group IDs to set those up.