> ## Documentation Index
> Fetch the complete documentation index at: https://docs.open-metadata.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a User

> Create a new user in your organization

# Create a User

Create a new user in your organization.

## Body Parameters

<ParamField body="name" type="string" required>
  Username for the user. Must be unique across the organization.
</ParamField>

<ParamField body="email" type="string" required>
  Email address of the user. Must be unique across the organization.
</ParamField>

<ParamField body="displayName" type="string">
  Human-readable display name for the user.
</ParamField>

<ParamField body="description" type="string">
  Description of the user in Markdown format.
</ParamField>

<ParamField body="isBot" type="boolean" default="false">
  Whether this user is a bot account.
</ParamField>

<ParamField body="isAdmin" type="boolean" default="false">
  Whether this user has admin privileges.
</ParamField>

<ParamField body="teams" type="array">
  Array of team fully qualified names to assign the user to.
</ParamField>

<ParamField body="roles" type="array">
  Array of role fully qualified names to assign to the user.
</ParamField>

<ParamField body="personas" type="array">
  Array of persona references to assign to the user.
</ParamField>

<ParamField body="domain" type="string">
  Fully qualified name of the domain to assign for governance purposes.
</ParamField>

<ParamField body="profile" type="object">
  Profile information for the user.

  <Expandable title="properties">
    <ParamField body="images" type="object">
      Profile images for the user.
    </ParamField>

    <ParamField body="timezone" type="string">
      Timezone of the user (e.g., `America/New_York`).
    </ParamField>
  </Expandable>
</ParamField>

<RequestExample dropdown>
  ```python POST /v1/users theme={null}
  from metadata.sdk import configure
  from metadata.sdk.entities import Users
  from metadata.generated.schema.api.teams.createUser import CreateUserRequest

  configure(
      host="https://your-company.open-metadata.org/api",
      jwt_token="your-jwt-token"
  )

  request = CreateUserRequest(
      name="aaron_johnson0",
      displayName="Aaron Johnson",
      email="aaron_johnson0@gmail.com",
      description="Data analyst in the Sales team",
      teams=["Sales"],
      roles=["DataSteward"]
  )

  user = Users.create(request)
  print(f"Created: {user.fullyQualifiedName}")
  ```

  ```java POST /v1/users theme={null}
  import static org.openmetadata.sdk.fluent.Users.*;

  // Create using builder pattern
  var user = Users.builder()
      .name("aaron_johnson0")
      .displayName("Aaron Johnson")
      .email("aaron_johnson0@gmail.com")
      .description("Data analyst in the Sales team")
      .create();
  ```

  ```bash POST /v1/users theme={null}
  curl -X POST "{base_url}/api/v1/users" \
    -H "Authorization: Bearer {access_token}" \
    -H "Content-Type: application/json" \
    -d '{
      "name": "aaron_johnson0",
      "displayName": "Aaron Johnson",
      "email": "aaron_johnson0@gmail.com",
      "description": "Data analyst in the Sales team",
      "teams": ["Sales"],
      "roles": ["DataSteward"]
    }'
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "77655e6e-ad33-49da-bbca-db4ba4d4e2cd",
    "name": "aaron_johnson0",
    "fullyQualifiedName": "aaron_johnson0",
    "displayName": "Aaron Johnson",
    "version": 0.1,
    "updatedAt": 1769982624214,
    "updatedBy": "admin",
    "email": "aaron_johnson0@gmail.com",
    "href": "http://localhost:8585/api/v1/users/77655e6e-ad33-49da-bbca-db4ba4d4e2cd",
    "isBot": false,
    "isAdmin": false,
    "allowImpersonation": false,
    "teams": [
      {
        "id": "7a2b921b-f623-4eb5-9736-649788ad842c",
        "type": "team",
        "name": "Sales",
        "fullyQualifiedName": "Sales",
        "displayName": "Sales",
        "deleted": false
      }
    ],
    "personas": [],
    "deleted": false,
    "roles": [
      {
        "id": "761c2bb2-0b77-4bc5-9af9-cf89536d6a12",
        "type": "role",
        "name": "DataSteward",
        "fullyQualifiedName": "DataSteward",
        "displayName": "Data Steward",
        "deleted": false
      }
    ],
    "domains": []
  }
  ```
</ResponseExample>

***

## Returns

Returns the created user object with all specified properties and system-generated fields.

## Response

<ResponseField name="id" type="string">
  Unique identifier for the user (UUID format).
</ResponseField>

<ResponseField name="name" type="string">
  Username.
</ResponseField>

<ResponseField name="fullyQualifiedName" type="string">
  Fully qualified name (same as `name` for users).
</ResponseField>

<ResponseField name="displayName" type="string">
  Human-readable display name.
</ResponseField>

<ResponseField name="email" type="string">
  Email address of the user.
</ResponseField>

<ResponseField name="isBot" type="boolean">
  Whether this user is a bot account.
</ResponseField>

<ResponseField name="isAdmin" type="boolean">
  Whether this user has admin privileges.
</ResponseField>

<ResponseField name="teams" type="array" optional>
  Teams the user belongs to.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the team.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of entity (always `team`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the team.
    </ResponseField>

    <ResponseField name="fullyQualifiedName" type="string">
      Fully qualified name of the team.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="roles" type="array" optional>
  Roles assigned to the user.

  <Expandable title="properties">
    <ResponseField name="id" type="string">
      UUID of the role.
    </ResponseField>

    <ResponseField name="type" type="string">
      Type of entity (always `role`).
    </ResponseField>

    <ResponseField name="name" type="string">
      Name of the role.
    </ResponseField>

    <ResponseField name="fullyQualifiedName" type="string">
      Fully qualified name of the role.
    </ResponseField>
  </Expandable>
</ResponseField>

<ResponseField name="personas" type="array" optional>
  Personas assigned to the user.
</ResponseField>

<ResponseField name="domains" type="array" optional>
  Domain assignments for governance.
</ResponseField>

<ResponseField name="version" type="number">
  Version number for the entity (starts at 0.1).
</ResponseField>

***

## Create or Update (PUT)

Use `PUT /v1/users` instead of `POST` to perform an upsert. If a user with the same `fullyQualifiedName` already exists, it will be updated; otherwise, a new user is created. The request body is the same as `POST`.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/users" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '{ ... same body as POST ... }'
```

<Note>
  `PUT` will not return a `409` conflict error if the entity already exists -- it will update the existing entity instead.
</Note>

***

## Bulk Create or Update (PUT)

Use `PUT /v1/users/bulk` to create or update multiple users in a single request. The request body is an array of create request objects.

```bash theme={null}
curl -X PUT "{base_url}/api/v1/users/bulk" \
  -H "Authorization: Bearer {access_token}" \
  -H "Content-Type: application/json" \
  -d '[
    { "name": "user_one", "email": "user_one@example.com" },
    { "name": "user_two", "email": "user_two@example.com" }
  ]'
```

***

## Error Handling

| Code  | Error Type              | Description                                     |
| ----- | ----------------------- | ----------------------------------------------- |
| `400` | `BAD_REQUEST`           | Invalid request body or missing required fields |
| `401` | `UNAUTHORIZED`          | Invalid or missing authentication token         |
| `403` | `FORBIDDEN`             | User lacks permission to create users           |
| `409` | `ENTITY_ALREADY_EXISTS` | User with same name already exists (POST only)  |
