Currently, in order to list group IDs, DNF must be run in verbose mode. Since using group IDs is arguably much more comfortable than having to always spell out the whole group names whenever operating on groups, forcing users to enable verbose mode to obtain the IDs seems plain wrong (and is a regression against YUM3 which knew the "ids" argument).
That said, we should probably add a new option called "--ids" (with the "ids" fallback for YUM3 compatibility).
Related docs bug:
I create a patch (https://github.com/rpm-software-management/dnf/pull/1513) that implements --ids.
Tests are available here: https://github.com/rpm-software-management/ci-dnf-stack/pull/665