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.

Get User by Username

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

Resource URL

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

Parameters

username

required

string

Set to the user’s username. If you don’t know the user’s username, use the Get Users API call to return all users and their username values.

include_custom_attributes

boolean

Set to true if you want the response to include any custom attributes that have been defined for the user.

Sample Response

<user>
    <activated-at>2015-01-21T09:20:15-08:00</activated-at>
    <created-at>2015-01-21T09:19:40-08:00</created-at>
    <directory-id nil="true"></directory-id>
    <distinguished-name nil="true"></distinguished-name>
    <email>user@company.com</email>
    <external-id nil="true"></external-id>
    <firstname>Genoveva</firstname>
    <group-id>111</group-id>
    <id>123456</id>
    <invalid-login-attempts>0</invalid-login-attempts>
    <invitation-sent-at nil="true"></invitation-sent-at>
    <last-login>2015-02-23T09:36:14-08:00</last-login>
    <lastname>Wong</lastname>
    <locale-code nil="true"></locale-code>
    <locked-until nil="true"></locked-until>
    <member-of nil="true"></member-of>
    <openid-name>gwong123</openid-name>
    <password-changed-at>2015-02-01T16:00:00-08:00</password-changed-at>
    <phone>415-555-1212</phone>
    <status>1</status>
    <updated-at>2015-02-23T09:36:14-08:00</updated-at>
    <roles>
        <role>
           <id>1</id>
           <name>Employee</name>
        </role>
        <role>
           <id>2</id>
           <name>SF Office</name>
        </role>
        <role>
           <id>3</id>
           <name>Product</name>
        </role>
        <role>
           <id>111</id>
           <name>Tech Writer</name>
        </role>
    </roles>
    <username>genwong</username>
    <custom_attribute_skype>genoveva</custom_attribute_skype>
    <custom_attribute_ext>123</custom_attribute_ext>
    <custom_attribute_personalemail></custom_attribute_personalemail>
    <custom_attribute_photo_thumbnail></custom_attribute_photo_thumbnail>
</user>
<error>
   <message>API key is invalid or missing</message>
   <code>invalid_or_missing_api_key</code>
</error>
<error>
   <title>Record Not Found</title>
   <message>No user found by username 'jeniffer'</message>
</error>

Sample cURL Request

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

curl -u {api_key}:x \
-X GET https://api.onelogin.com/api/v3/users/username/{username}? \
include_custom_attributes=true

Postman Collection

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

Download for the Users API