DELETE

Delete Account

Use this API to delete one of your reseller account’s direct child accounts.

Deletion runs in the background. The API returns 202 Accepted once the deletion is scheduled, and the account is removed shortly afterwards. To confirm it’s gone, call Get Account, which returns 404 once deletion is complete.

Be careful. This deletes the child account and everything in it, including its users, apps, and settings. It can’t be undone.

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 Manage All.

The API credential must belong to a reseller account. The user it belongs to must also have the Manage accounts privilege in that account. The owner of a reseller account normally has it.

Resource Parameters

id

required

integer

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

Sample Responses

The account has been scheduled for deletion.

{
    "status": 202,
    "message": "Account 123456 scheduled for deletion"
}

The access token is missing, invalid, or expired, or it was generated from a credential without the Manage All scope. You also get this response if the user the API credential belongs to doesn’t have the Manage accounts privilege.

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

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

{
    "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 (Insufficient privileges), or the child account has no owner, so it can’t be deleted through the API (Unprocessable). For an account without an owner, contact OneLogin support.

{
    "status": 422,
    "name": "Unprocessable",
    "message": "The account has no resolvable owner and cannot be torn down"
}

Sample Code

cURL

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

Delete Account

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