Okta Workflows Tips #67: Count Users in an Okta Group

Okta Workflows Tips are short and handy Okta Workflows tips and tricks. Read all the earlier tips.

Count Users in an Okta Group

The Okta List all groups API includes an optional expand parameter. This parameter returns the number of users in an Okta group when set to stats.

This Okta-Custom API Action card returns all the groups. Each group result includes the number of users in that group with the expand parameter.

Get all Okta groups.
Get all Okta groups.

API response includes the number of users in each group:

API response.
API response.

It is also possible to get the user count in just group when you add the group ID to the endpoint:

Return one Okta group.
Return one Okta group.

API response with the usersCount in the embed object:

{
    "id": "00g2emd7ymboJdfzc0h8",
    "created": "2025-05-27T16:32:39.000Z",
    "lastUpdated": "2025-10-29T19:47:34.000Z",
    "lastMembershipUpdated": "2025-07-16T20:15:00.000Z",
    "objectClass": [
        "okta:user_group"
    ],
    "type": "OKTA_GROUP",
    "profile": {
        "name": "Automation Learners",
        "description": "Folks who love to learn about automation."
    },
    "_embedded": {
        "stats": {
            "usersCount": 4,
            "appsCount": 1,
            "groupPushMappingsCount": 0,
            "hasAdminPrivilege": false,
            "_links": {}
        }
    }
}

This Okta Workflows tip is based on API to Return the Number of Users in a Group KB article.


Okta Workflows resources

πŸš€ New to Okta Workflows? The Getting Started with Okta Workflows page has all the resources to help you get started.

πŸ“Ί Like learning from videos? Watch Okta Workflows videos.

❓Have a question? Ask during community office hours, post on the community forum, or email me.

πŸ™‹πŸ»β€β™€οΈ Want to learn from the community? Join the #okta-workflows channel on the Mac Admins Slack.

πŸ“– Want to learn more about Okta and automation? Take the Okta Workflows training on Okta Learning.

Leave a comment