group_by parameter aggregates entities into groups and counts how many are in each group.
Group properties
Each group object contains:key vs key_display_name
When grouping by an OpenAlex entity, key is the ID and key_display_name is the display name:
level), both key and key_display_name are the raw value.
Including unknowns
The “unknown” group (entities without a value) is hidden by default. Add:include_unknown to include it:
How “unknown” is keyed
The bucket’skey depends on the field type:
Numeric fields use the sentinel
-111 because the aggregation bucket can’t mix a string key like "unknown" into a numeric series. Treat any -111 (or -111.0) bucket key as “unknown.”
What counts as “unknown”
A work is counted in the unknown bucket when the underlying field is missing or empty. For fields nested inside an array — for exampleauthorships.institutions.type — the work is also counted as unknown when the array is present but empty (e.g. an authorship with no institutions). If you reproduce group_by counts in code by iterating the JSON, treat empty lists the same way to match the API’s totals.
Combining with filters
Group by and filter work together:Paging
A grouped response returns at most 200 groups per page. To page through more, use cursor paging: start withcursor=* and follow meta.next_cursor until it’s null, exactly as you would for a list of results.
Basic
page-based paging (page=2, …) is not supported with group_by — use cursor paging. When paging through groups, results are sorted by key (not by count).Meta properties
Due to technical limitations,
groups_count only reports groups in the current page, not the total number of groups.