See api-docs Menu

Get Group by ID

Think of groups as departments. Groups enable you to split your user base into smaller pieces that can be more easily managed.

For more info, see Groups.

Resource URL

https://api.<us_or_eu>.onelogin.com/api/1/groups/:id

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.

Resource Parameter

id

required

integer

Set to the id of the group that you want to return. If you don’t know the group’s id, use the Get Groups API call to return all groups and their id values.

Sample Response

{
    "status": {
        "error": false,
        "code": 200,
        "type": "success",
        "message": "Success"
    },
    "data": [
        {
            "id": 425741,
            "name": "group.security.policy.default",
            "reference": null
        }
    ]
}
{
    "status": {
        "error": true,
        "code": 400,
        "type": "bad request",
        "message": {
            "attribute": "id",
            "description": "ID is incorrect"
        }
    }
}

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"
    }
}

The API credentials used do not have a sufficient level of privilege to make this call

{
    "status": {
        "error": true,
        "code": 401,
        "type": "Unauthorized",
        "message": "Insufficient Permission"
    }
}
{
    "status": {
        "error": true,
        "code": 404,
        "type": "not found",
        "message": "Group for id 9999999 was not found"
    }
}

Response Elements

id

Group’s unique ID in OneLogin.

name

Group name.

reference

Deprecated. Will always show the attribute nil="true".

Sample cURL Request

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

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

Postman Collection

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

Download for the Groups API