See api-docs Menu

v1-v3 APIs have been deprecated

Don't worry, these APIs are deprecated, but they won't be shut off until 2017, at the earliest. Questions? Contact devsupport@onelogin.com.

All new development with APIs should use the newest version of our API: /1. API /1 is based on RESTful principles, is secured by OAuth 2.0, and provides JSON messages, search, pagination, sorting, and filtering.

Update User by ID

For a description of each element in the User resource, see User Resource.

Resource URL

https://api.onelogin.com/api/v3/users/:id

Parameters

Content-Type

required

string

Set to application/xml.

id

required

string

Set to the user’s id with .xml appended. For example, 123456.xml. If you don’t know the user’s id, use the Get Users API call to return all users and their id values.

company

string

*

department

string

*

directory-id

string

*

distinguished-name

string

*

email

string

*

external-id

string

*

firstname

string

*

group-id

string

The group ID must exist. To view a list of groups, use the Get All Groups API.

invalid-login-attempts

integer

*

lastname

string

*

member-of

string

*

openid-name

string

*

phone

string

*

samaccountname

string

*

status

integer

The status must exist. For a list of valid statuses, see User Resource.

title

string

*

username

string

*

userprincipalname

string

*

Sample Response

This request generates no response.
This request generates no response.
<!DOCTYPE html>
<html lang='en' xml:lang='en' xmlns='http://www.w3.org/1999/xhtml'>
    <head>
        <meta content='text/html; charset=utf-8' http-equiv='Content-Type'>
            <link href="/assets/application-0373b4078442527cc69b75ecc666d7b9.css" 
             media="screen" 
             rel="stylesheet" type="text/css" />
            <script src="/assets/login-92e9ee5d1d9afbcc0868943aee337938.js" 
             type="text/javascript"></script>
            <title>OneLogin</title>
    </head>
    <body class='error-layout'>
        <input id='app_revision' type='hidden' value='5bfacb24a1cbfeb3359282dc5b8d2b2a'>
        <div class='box'>
            <img alt="Onelogin_logo" src="/images/client/onelogin_logo.png" />
            <div>
                <error>
                    <title>Invalid Request</title>
                    <message>Validation failed: Group does not exist</message>
                </error>
            </div>
        </div>
    </body>
</html>

Assign Roles

You can include existing roles in the update request message. See the sample cURL request below for the required format. The role_id that you want to assign to a user must already exist.

To view a list of existing role IDs, use the Get All Roles API.

Assign Custom Attributes

You can include existing custom attributes in the update request message. See the sample cURL request below for the required format. The custom_attribute_{custom_attribute_name} and {custom_attribute_value} that you want to assign to a user must already exist.

To view a list of existing custom attributes, use the Get Custom Attributes API.

Sample cURL Request

Try it out with a test account first: Start off with using this cURL request with a test OneLogin account and API key. Once you’ve familiarized yourself with the API’s behavior, switch over to using your production OneLogin account and API key.

Be sure to replace placeholder values surrounded by { } with actual values.

curl -v -u {api_key}:x -X PUT -H "Content-Type: application/xml" \
-d '<user>
    <username>{username}</username>
    <company>{company}</company>
    <department>{department}</department>
    <directory-id>{directory_id}</directory-id>
    <distinguished-name>{distinguished_name}</distinguished-name>
    <email>{email}</email>
    <external-id>{external_id}</external-id>
    <firstname>{firstname}</firstname>
    <group-id>{group_id}</group-id>
    <invalid-login-attempts>{invalid_login_attempts}</invalid-login-attempts>
    <lastname>{lastname}</lastname>
    <member-of>{member_of}</member-of>
    <openid_name>{openid_name}</openid_name>
    <phone>{phone}</phone>
    <samaccountname>{samaccountname}</samaccountname>
    <status>{status}</status>
    <title>{title}</title>
    <userprincipalname>{userprincipalname}</userprincipalname>
    <roles type='array'>
      <role>{role_id}</role>
      <role>{role_id}</role>
    </roles>
    <custom_attribute_{custom_attribute_name}>{custom_attribute_value}
     </custom_attribute_{custom_attribute_name}>
</user>' \
https://api.onelogin.com/api/v3/users/{user_id}.xml

Postman Collection

Try it out with a test account first: Start off with using this Postman Collection with a test OneLogin account and API key. Once you’ve familiarized yourself with the API’s behavior, switch over to using your production OneLogin account and API key.

Replace sample variables indicated by { } in the sample request body with your actual values. Also, be sure to set Postman-specific environment variables indicated by {{ }}.

Download for the Users API