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://api.<us_or_eu>.onelogin.com/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 {{ }}.

Download for the Groups API

Sample cURL Request

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

curl "https://api.<us_or_eu>.onelogin.com/api/1/groups" \
-X GET \
-H "Authorization: bearer:<access_token>" 

Have a Question?

Have a how-to question? Seeing a weird error? Ask us about it on StackOverflow.

Found a bug? Submit a support ticket.

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