See api-docs Menu

v1-v3 APIs have been deprecated.

Although these APIs are not shut off yet, all new development with APIs should use the newest version of our API if available, and the version /1 in all other cases. These later versions are based on RESTful principles, secured by OAuth 2.0, and provide JSON messages, search, pagination, sorting, and filtering.

Get User by ID

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

Resource URL

Before calling this API, consider using its version /1 or version /2 equivalent.

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

Parameters

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.

include_custom_attributes

boolean

Include and 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>gwong@example.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>
</user>
<error>
  <title>Record Not Found</title>
  <message>No user found by id '14081945'</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/{user_id}.xml?include_custom_attributes=true

Postman Collection

Run In Postman

    Clicking Run in Postman button navigates to the page where you can fork the collection to your workspace. Forking the collection into your workspace will enable you to contribute to the source collection using pull requests. You can also view the collection in a public workspace if you like and even import a copy of the collection using the links present on the screen.

Have a Question?

Found a problem or a bug? Submit a support ticket.

Looking for walkthroughs or how-to guides on OneLogin's user and admin features? Check out the documentation in our Knowledge Base.

Have a product idea or request? Share it with us in our Ideas Portal.