> ## Documentation Index
> Fetch the complete documentation index at: https://doc.lucidworks.com/llms.txt
> Use this file to discover all available pages before exploring further.

# User API

export const LwTemplate = ({title = "Key questions to get you started", icon = "sparkles", cta = "Powered by Agent Studio", linkHref = "https://lucidworks.com/demo/?utm_source=docs&utm_medium=referral&utm_campaign=docs_cta_ai"}) => {
  const [isLoaded, setIsLoaded] = useState(false);
  useEffect(() => {
    const timer = setTimeout(() => {
      setIsLoaded(true);
    }, 500);
    return () => clearTimeout(timer);
  }, []);
  return <div className="lw-template-container">
      <Card title={title} icon={icon}>
        {isLoaded && <span dangerouslySetInnerHTML={{
    __html: `<lw-template id="a029c1a9-28be-427e-b0e1-5d918920246a"></lw-template
            >`
  }} />}
        <Link href={linkHref} className="agent-studio-link text-left text-gray-600 gap-2 dark:text-gray-400 text-sm font-medium flex flex-row items-center hover:text-primary dark:hover:text-primary-light group-hover:text-primary group-hover:dark:text-primary-light">Powered by Lucidworks Agent Studio</Link>
      </Card>
    </div>;
};

[localhost link]: http://localhost:3000/docs/4/fusion-server/reference/api/authentication-and-authorization-apis/user-api

[mintlify link]: https://doc.lucidworks.com/docs/4/fusion-server/reference/api/authentication-and-authorization-apis/user-api

[old doc.lw link]: https://doc.lucidworks.com/fusion/5.9/340

The User API allows you to create, update, and remove user accounts. This API should only be called to manage users in the native security realm. Users from other security realms are managed directly by Fusion’s auth proxy.

<LwTemplate />

## Create, Update, Delete or List Users

The path for this request is:

`/api/users/<id>`

where *\<id>* is the user ID.

<Note>
  In order to see this object within the [Fusion UI](/docs/4/fusion-server/concepts/object-explorer), it **must** be associated with an app. To do this, create the object using the `/apps` endpoint.
</Note>

A GET request lists information about the user. The ID can be omitted in a GET request to get all users.

A POST request creates a new user, while a PUT updates a user record.

DELETE will remove the user.

### Input

| Parameter                              | Description                                                                                                               |
| -------------------------------------- | ------------------------------------------------------------------------------------------------------------------------- |
| username  <br />*Required*             | The username. This is distinct from their ID, which is assigned by the system as a unique identifier.                     |
| password  <br />*Required*             | The user’s password. Required when creating a new user. The user’s password is not returned in the output of any request. |
| passwordConfirm  <br />*Required*      | When creating a user or updating a user’s password, you must confirm the defined password.                                |
| realmName  <br />*Required*            | The realm the user belongs to, which defines how they authenticate against the system.                                    |
| permissions  <br />*Optional*          | The permissions that have been defined for this user that are not inherited from their assigned role.                     |
| inheritedPermissions  <br />*Optional* | The user’s specific permissions that are inherited from their role assignment.                                            |
| roleNames  <br />*Optional*            | The list of user’s roles, which define some or all of the permissions they have.                                          |

### Output

When creating a user with a POST request or listing users with GET, the user properties will be returned.

When updating or removing a user with a PUT or DELETE, no output will be returned.

### Examples

*Get all the configured users of the system:*

**REQUEST**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD https://FUSION_HOST:8764/api/users
```

**RESPONSE**

```json wrap  theme={"dark"}
[
	{
	"realmName":"native",
	"username":"admin",
	"id":"2856ba33-80bd-400d-99dc-3d181bc68d9a",
	"roleNames":["admin"],
	"permissions":[],
	"createdAt":"2015-07-01T03:18:06Z"},
		{"realmName":"native",
		"username":"collection-admin",
		"id":"9780a33c-c49d-48e3-a869-bd65951aea8f",
		"roleNames":["ui-user","collection-admin"],
		"permissions":[],
		"createdAt":"2015-07-01T03:18:06Z"
	}
]
```

*Add a new user named 'guest'*:

**REQUEST**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD -X POST -H 'Content-type: application/json' -d '{"username":"guest", "password":"password456", "passwordConfirm":"password456", "realmName": "native"}' https://FUSION_HOST:8764/api/users
```

**RESPONSE**

```json wrap  theme={"dark"}
{
	"realmName":"native",
	"username":"guest",
	"id":"2f5b52a7-550d-407d-b592-32ab42afe3ca",
	"roleNames":[],
	"permissions":[],
	"createdAt":"2015-08-06T11:42:15Z"
}
```

*Update a user to include the role named "admin":*

**REQUEST**

```bash wrap  theme={"dark"}
curl -u USERNAME:PASSWORD -X PUT -H 'Content-type: application/json' -d '{"name":"joe.smith", "realmName":"myLDAP", "roleNames":["admin"]}' https://FUSION_HOST:8764/api/users/aefa7ffc-23f1-45ac-b326-f7bb007d3b9d
```

**RESPONSE**

None.
