---
descriptions:
  directory_user:
    self: 'The [Directory User](/reference/directory-sync/directory-user) object'
    object: Distinguishes the Directory User object.
    id: Unique identifier for the Directory User.
    idp: >
      Unique identifier for the user, assigned by the Directory Provider.
      Different Directory Providers use different ID formats.


      One possible use case for `idp_id` is associating the Directory User with
      their SSO Profile.
    directory_id: The identifier of the Directory the Directory User belongs to.
    organization_id: The identifier for the Organization in which the Directory resides.
    first_name: The first name of the user.
    last_name: The last name of the user.
    email: The email address of the user.
    groups: The groups that the user is a member of.
    state: |
      The state of the user.
      - `active`
      - `inactive`
    dotnet_state: |
      The state of the user. Possible values:
      - `UserState.Active`
      - `UserState.Inactive`
    java_state: |
      The state of the user. Possible values:
      - `Active`
      - `Inactive`
    custom_attributes: >-
      An object containing the custom attribute mapping for the Directory
      Provider.
    role:
      slug: The unique role identifier
    created_at: The timestamp when the Directory User was created.
    updated_at: The timestamp when the Directory User was last updated.
reference:
  curl:
    - url: /reference/directory-sync/directory-user
      key: directory_user
      id: directory_user
      title: directory_user
      properties:
        - key: id
          type: string
          description: (directory_user.id)
        - key: idp_id
          type: string
          description: (directory_user.idp)
        - key: directory_id
          type: string
          description: (directory_user.directory_id)
        - key: organization_id
          optional: true
          type: string
          description: (directory_user.organization_id)
        - key: first_name
          optional: true
          type: string
          description: (directory_user.first_name)
        - key: last_name
          optional: true
          type: string
          description: (directory_user.last_name)
        - key: email
          optional: true
          type: string
          description: (directory_user.email)
        - key: groups
          type: array
          description: (directory_user.groups)
        - key: state
          type: enum
          description: (directory_user.state)
        - key: custom_attributes
          type: object
          description: (directory_user.custom_attributes)
        - key: role
          type: object
          optional: true
          description: (directory_user.role)
          properties:
            - key: slug
              type: string
              description: (directory_user.role.slug)
        - key: created_at
          type: string
          description: (directory_user.created_at)
        - key: updated_at
          type: string
          description: (directory_user.updated_at)
  dotnet:
    - url: /reference/directory-sync/directory-user
      key: User
      id: directory_user
      title: class DirectoryUser
      properties:
        - key: Object
          type: '"directory_user"'
          description: (directory_user.object)
        - key: Id
          type: string
          description: (directory_user.id)
        - key: IdpId
          type: string
          description: (directory_user.idp)
        - key: DirectoryId
          type: string
          description: (directory_user.directory_id)
        - key: OrganizationId
          optional: true
          type: string
          description: (directory_user.organization_id)
        - key: FirstName
          optional: true
          type: string
          description: (directory_user.first_name)
        - key: LastName
          optional: true
          type: string
          description: (directory_user.last_name)
        - key: Email
          optional: true
          type: string
          description: (directory_user.email)
        - key: Groups
          type: array
          description: (directory_user.groups)
        - key: State
          type: UserState
          description: (directory_user.state)
        - key: CustomAttributes
          type: 'Dictionary<string, object>'
          description: (directory_user.custom_attributes)
        - key: CreatedAt
          type: string
          description: (directory_user.created_at)
        - key: UpdatedAt
          type: string
          description: (directory_user.updated_at)
  ruby:
    - url: /reference/directory-sync/directory-user
      key: DirectoryUser
      id: directory_user
      title: class DirectoryUser
      properties:
        - key: id
          type: String
          description: (directory_user.id)
        - key: idp_id
          type: String
          description: (directory_user.idp)
        - key: directory_id
          type: String
          description: (directory_user.directory_id)
        - key: organization_id
          optional: true
          type: String
          description: (directory_user.organization_id)
        - key: first_name
          optional: true
          type: String
          description: (directory_user.first_name)
        - key: last_name
          optional: true
          type: String
          description: (directory_user.last_name)
        - key: email
          optional: true
          type: String
          description: (directory_user.email)
        - key: groups
          type: 'Array[DirectoryGroup]'
          description: (directory_user.groups)
        - key: state
          type: String
          description: (directory_user.state)
        - key: custom_attributes
          type: Hash
          description: (directory_user.custom_attributes)
  python:
    - url: /reference/directory-sync/directory-user
      key: DirectoryUser
      id: directory_user
      title: DirectoryUser
      properties:
        - key: id
          type: str
          description: (directory_user.id)
        - key: idp_id
          type: str
          description: (directory_user.idp)
        - key: directory_id
          type: str
          description: (directory_user.directory_id)
        - key: organization_id
          optional: true
          type: str
          description: (directory_user.organization_id)
        - key: first_name
          optional: true
          type: str
          description: (directory_user.first_name)
        - key: last_name
          optional: true
          type: str
          description: (directory_user.last_name)
        - key: email
          optional: true
          type: str
          description: (directory_user.email)
        - key: groups
          type: 'Sequence[DirectoryGroup]'
          description: (directory_user.groups)
        - key: state
          type: str
          description: (directory_user.state)
        - key: custom_attributes
          type: dict
          description: (directory_user.custom_attributes)
        - key: role
          type: InlineRole
          optional: true
          description: (directory_user.role)
          properties:
            - key: slug
              type: string
              description: (directory_user.role.slug)
        - key: created_at
          type: str
          description: (directory_user.created_at)
        - key: updated_at
          type: str
          description: (directory_user.updated_at)
  js:
    - url: /reference/directory-sync/directory-user
      key: DirectoryUser
      id: directory_user
      title: interface DirectoryUser
      properties:
        - key: id
          type: string
          description: (directory_user.id)
        - key: idpId
          type: string
          description: (directory_user.idp)
        - key: directoryId
          type: string
          description: (directory_user.directory_id)
        - key: organizationId
          optional: true
          type: string
          description: (directory_user.organization_id)
        - key: firstName
          optional: true
          type: string
          description: (directory_user.first_name)
        - key: lastName
          optional: true
          type: string
          description: (directory_user.last_name)
        - key: email
          optional: true
          type: string
          description: (directory_user.email)
        - key: groups
          type: 'DirectoryGroup[]'
          description: (directory_user.groups)
        - key: state
          type: string
          description: (directory_user.state)
        - key: customAttributes
          type: object
          description: (directory_user.custom_attributes)
        - key: role
          type: object
          optional: true
          description: (directory_user.role)
          properties:
            - key: slug
              type: string
              description: (directory_user.role.slug)
  go:
    - url: /reference/directory-sync/directory-user
      key: User
      id: directory_user
      title: directorysync.User
      properties:
        - key: ID
          type: string
          description: (directory_user.id)
        - key: IdpID
          type: string
          description: (directory_user.idp)
        - key: DirectoryID
          type: string
          description: (directory_user.directory_id)
        - key: OrganizationID
          optional: true
          type: string
          description: (directory_user.organization_id)
        - key: FirstName
          optional: true
          type: string
          description: (directory_user.first_name)
        - key: LastName
          optional: true
          type: string
          description: (directory_user.last_name)
        - key: Email
          optional: true
          type: string
          description: (directory_user.email)
        - key: Groups
          type: '[]directorysync.UserGroup'
          description: (directory_user.groups)
        - key: State
          type: directorysync.UserState
          description: (directory_user.state)
        - key: CustomAttributes
          type: json.RawMessage
          description: (directory_user.custom_attributes)
        - key: Role
          type: object
          description: (directory_user.role)
          properties:
            - key: Slug
              type: string
              description: (directory_user.role.slug)
  php:
    - url: /reference/directory-sync/directory-user
      key: DirectoryUser
      id: directory_user
      title: WorkOS\Resource\DirectoryUser
      properties:
        - key: id
          type: string
          description: (directory_user.id)
        - key: idpId
          type: string
          description: (directory_user.idp)
        - key: directoryId
          type: string
          description: (directory_user.directory_id)
        - key: organizationId
          optional: true
          type: string
          description: (directory_user.organization_id)
        - key: firstName
          optional: true
          type: string
          description: (directory_user.first_name)
        - key: lastName
          optional: true
          type: string
          description: (directory_user.last_name)
        - key: email
          optional: true
          type: string
          description: (directory_user.email)
        - key: groups
          type: 'DirectoryGroup[]'
          description: (directory_user.groups)
        - key: state
          type: string
          description: (directory_user.state)
        - key: customAttributes
          type: array
          description: (directory_user.custom_attributes)
        - key: createdAt
          type: string
          description: (directory_user.created_at)
        - key: updatedAt
          type: string
          description: (directory_user.updated_at)
  java:
    - url: /reference/directory-sync/directory-user
      key: User
      id: directory_user
      title: class User
      properties:
        - key: obj
          type: '"directory_user"'
          description: (directory_user.object)
        - key: id
          type: String
          description: (directory_user.id)
        - key: directoryId
          type: String
          description: (directory_user.directory_id)
        - key: organizationId
          optional: true
          type: String
          description: (directory_user.organization_id)
        - key: idpId
          type: String
          description: (directory_user.idp)
        - key: email
          optional: true
          type: String
          description: (directory_user.email)
        - key: firstName
          optional: true
          type: String
          description: (directory_user.first_name)
        - key: lastName
          optional: true
          type: String
          description: (directory_user.last_name)
        - key: createdAt
          type: String
          description: (directory_user.created_at)
        - key: updatedAt
          type: String
          description: (directory_user.updated_at)
        - key: groups
          optional: true
          type: List<Group>
          description: (directory_user.groups)
        - key: state
          type: UserState
          description: (directory_user.java_state)
        - key: customAttributes
          type: 'Map<String, Any?>'
          description: (directory_user.custom_attributes)
originalPath: >-
  .tmp-workos-clone/packages/docs/content/reference/directory-sync/directory-user/index.mdx
---

# Directory User

A Directory User represents an active organization user.

Developers can receive [Webhooks](/events/directory-sync) as employees are added, updated or removed, allowing for provisioning and de-provisioning Users within an application.

<CodeBlock
  title="Example Directory User"
  file="directory-user"
  referenceId="directory_user"
/>
