GET

Get Account

Use this API to return one of your reseller account’s direct child accounts, including its roles.

Resource URL

https://<subdomain>.onelogin.com/api/2/accounts/:id

Header Parameters

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 any one of the following scopes: Manage All, Read All.

The API credential must belong to a reseller account.

Resource Parameters

id

required

integer

Set to the id of the child account you want to return.

Sample Responses

Returns the account object with its roles.

{
    "id": 123456,
    "name": "Acme Inc.",
    "address1": "100 Main Street",
    "address2": "Suite 200",
    "city": "Springfield",
    "state": "CA",
    "zip": "90210",
    "country": "US",
    "phone": "555-555-0100",
    "homepage": "https://www.example.com",
    "notes": null,
    "remotetoken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "created_at": "2024-05-01T17:20:31.000Z",
    "updated_at": "2024-05-01T17:20:33.000Z",
    "roles": [
        {
            "id": 345678,
            "name": "Default"
        }
    ]
}

The access token is missing, invalid, or expired, or it was generated from a credential without the required scope. The Authorization header value should use this format: bearer <access_token>.

{
    "name": "UnauthorizedError",
    "message": "Unauthorized",
    "statusCode": 401
}

No account with this id exists, or it isn’t a direct child of your account.

{
    "status": 404,
    "name": "NotFound",
    "message": "The resource with the given id could not be found"
}

The API credential doesn’t belong to a reseller account.

{
    "status": 422,
    "name": "Insufficient privileges",
    "message": "Only resellers are allowed to use the Accounts API"
}

Sample Code

cURL

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

Get Account

curl 'https://<subdomain>.onelogin.com/api/2/accounts/<id>' \
-X GET \
-H "Authorization: bearer <access_token>"