KnowledgeOwl

How do I find a reader group's ID?

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.

  1. Use an API key that has Read permission on Reader group. Refer to API key permission-endpoint mapping for details.
  2. Make a GET call to the readerroles.json endpoint. Reader groups belong to your account, not to one knowledge base, so you don't need a project_id:
    curl -u <your-api-key>:X
      -X GET "https://app.knowledgeowl.com/api/head/readerroles.json?status=active"
  3. Find the group by its name in the response and copy its id.

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:

  1. Go to Account > Readers and open the Groups tab.
  2. Right-click the group's name and select Inspect.
  3. In the developer tools, find the table row (<tr>) that contains the name. Its id is role- followed by the group's ID. For example, in id="role-699762cfff297e497f051725", the group ID is 699762cfff297e497f051725.

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.