Use this API to update one of your reseller account’s direct child accounts, or to add an API credential pair to it.
This API changes only the account’s details. It can’t change the account owner, the OneLogin subdomain, or the plan. Owner and subdomain fields (email, firstname, lastname, user_password, and brand_subdomain) are ignored if you send them.
Resource URL
https://<subdomain>.onelogin.com/api/2/accounts/:idHeader Parameters
Authorization required string | Set to Set 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 The API credential must belong to a reseller account. |
Content-Type required string | Set to application/json. |
Resource Parameters
id required integer | Set to the |
Request Parameters
account required object | The attributes to change. Attributes you leave out keep their current values. The object can't be empty, so if you only want to add an API credential, send the account's current |
account.name, account.address1, account.address2, account.city, account.state, account.zip, account.country, account.phone, account.homepage, account.notes string | The account details to change. See the account object. |
api_credential object | Adds an API credential pair to the child account, owned by the account owner. Existing credentials aren't changed. Send it at the top level of the body. It takes:
This works only if the child account has the Allow assuming users account setting turned on. Otherwise |
Request Body
{
"account": {
"name": "Acme Inc.",
"address1": "100 Main Street",
"city": "Springfield",
"state": "CA",
"zip": "90210"
},
"api_credential": {
"name": "Reporting",
"permission": "read_all"
}
}Sample Responses
- 200 OK
- 400 Bad Request
- 401 Unauthorized
- 404 Not Found
- 422 Unprocessable Entity
Returns the updated account object. If an API credential was added, the response also includes it. Store the client_secret securely.
{
"id": 123456,
"name": "Acme Inc.",
"address1": "100 Main Street",
"address2": null,
"city": "Springfield",
"state": "CA",
"zip": "90210",
"country": "US",
"phone": "555-555-0100",
"homepage": null,
"notes": null,
"remotetoken": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"created_at": "2024-05-01T17:20:31.000Z",
"updated_at": "2024-06-03T08:15:42.000Z",
"api_credential": {
"client_id": "<client_id>",
"client_secret": "<client_secret>",
"permission": "Read All",
"display_name": "Reporting"
}
}The account object contains an attribute that doesn’t exist.
{
"name": "BadRequestError",
"message": "unknown attribute: company",
"statusCode": 400
}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 request can’t be processed. The name tells you why:
ValidationError: the body has noaccountobject, or it’s empty.RecordInvalid: an account attribute failed validation, for example a blankname. Themessagelists the errors.Invalid parameters:api_credentialis missing itsnameor has an unknownpermission, and the child account has Allow assuming users turned on. The account isn’t updated.Insufficient privileges: the API credential doesn’t belong to a reseller account.
{
"status": 422,
"name": "ValidationError",
"message": "Missing required parameters: [Account]"
}Sample Code
cURL
Replace sample values indicated by < > with your actual values.
Update Account
curl 'https://<subdomain>.onelogin.com/api/2/accounts/<id>' \
-X PUT \
-H "Authorization: bearer <access_token>" \
-H "Content-Type: application/json" \
-d '{
"account": {
"name": "Acme Inc.",
"address1": "100 Main Street",
"city": "Springfield",
"state": "CA",
"zip": "90210"
}
}'Have a Question?
Found a problem or a bug? Submit a support ticket.
Looking for walkthroughs or how-to guides? Check out our Knowledge Base.
Have a product idea or request? Share it in our Ideas Portal.