See api-docs Menu

Get Groups

Use to get a list of groups that are available in your account. The call returns up to 50 groups per page.

To find out which group a user belongs to, use the Get User by ID API.

To add a user to or remove a user from a group, use the Update User by ID API.

For details about groups in OneLogin, see Groups.

Resource URL

https://<subdomain>/api/1/groups

Header Parameter

Authorization

required

string

Set to bearer:<access_token>.

Set <access_token> to the access token you generated using the Generate Token API.

The access token must have been generated using an API credential pair created using the scope required to call this API. This API can be called using either of the following scopes: Read Users, Manage users, Read All, or Manage All.

Query Parameter

  • id

Sample Response

{
    "status": {
        "error": false,
        "code": 200,
        "type": "success",
        "message": "Success"
    },
    "pagination": {
        "before_cursor": null,
        "after_cursor": null,
        "previous_link": null,
        "next_link": null
    },
    "data": [
        {
            "id": 417333,
            "name": "employees",
            "reference": null
        },
        {
            "id": 419333,
            "name": "contractors",
            "reference": null
        },
        {
            "id": 419888,
            "name": "managers",
            "reference": null
        },
        {
            "id": 419999,
            "name": "admins",
            "reference": null
        }
    ]
}

Typically, the following error means that your Authorization header value is missing or incorrectly formatted. The Authorization header value should use this format: bearer:<access_token>.

{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": "Authorization Information is incorrect"
    }
}

Typically, this error means that your access token value is invalid.

{
    "status": {
        "error": true,
        "code": 401,
        "type": "Unauthorized",
        "message": "Authentication Failure"
    }
}

Response Elements

id Group’s unique ID in OneLogin.
name Group name.
reference Deprecated. Will always display the attribute null.

Postman Collection

Be sure to set Postman-specific environment variables indicated by {{ }}.

Run in Postman

    Clicking Run in Postman button navigates to the page where you can fork the collection to your workspace. Forking the collection into your workspace will enable you to contribute to the source collection using pull requests. You can also view the collection in a public workspace if you like and even import a copy of the collection using the links present on the screen.

Sample cURL Request

Replace sample values indicated by < > with your actual values.

curl "https://<subdomain>/api/1/groups" \
-X GET \
-H "Authorization: bearer:<access_token>" 

Have a Question?

Found a problem or a bug? Submit a support ticket.

Looking for walkthroughs or how-to guides on OneLogin's user and admin features? Check out the documentation in our Knowledge Base.

Have a product idea or request? Share it with us in our Ideas Portal.