> For the complete documentation index, see [llms.txt](https://docs.redivis.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user.md).

# User

## *class* <mark style="color:purple;">User</mark>

Users own datasets and workflows. Various methods allow you to construct and list the datasets, workflows, and secrets of a user.

## Constructors

| Method                                                                                                                           | Description                              |
| -------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------- |
| [**`redivis.user`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/redivis/redivis.user.md)(name)           | Return a User, given their username.     |
| [**`redivis.currentUser`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/redivis/redivis.currentuser.md)() | Return the currently authenticated User. |

## Examples

```javascript
const user = redivis.user('jane');

const dataset = user.dataset('my_dataset'); // -> Returns a Dataset
const workflow = user.workflow('my_workflow'); // -> Returns a Workflow

await user.listDatasets(); // -> Returns an array of Datasets
await user.listWorkflows(); // -> Returns an array of Workflows

const me = await redivis.currentUser();
console.log(me.name);
```

## Attributes

| Name             | Description                                                                                                                                                                      |
| ---------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`name`**       | The user's username.                                                                                                                                                             |
| **`properties`** | An object containing the [API resource representation of the user](https://docs.redivis.com/api/resource-definitions/user.md). This will be fully populated after calling `get`. |

## Methods

| Method                                                                                                                                   | Description                                                                                                            |
| ---------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------- |
| [**`User.dataset`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.dataset.md)(name\[, options])          | Return a [Dataset](https://docs.redivis.com/api/client-libraries/redivis-js/reference/dataset.md) owned by the user.   |
| [**`User.exists`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.exists.md)()                            | Check whether the user exists.                                                                                         |
| [**`User.get`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.get.md)()                                  | Fetch the user's metadata, populating `user.properties`.                                                               |
| [**`User.listDatasets`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.listdatasets.md)(\[maxResults])   | List the user's [Datasets](https://docs.redivis.com/api/client-libraries/redivis-js/reference/dataset.md).             |
| [**`User.listWorkflows`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.listworkflows.md)(\[maxResults]) | List the user's [Workflows](https://docs.redivis.com/api/client-libraries/redivis-js/reference/workflow.md).           |
| [**`User.secret`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.secret.md)(name)                        | Return a [Secret](https://docs.redivis.com/api/client-libraries/redivis-js/reference/secret.md) of the user.           |
| [**`User.workflow`**](https://docs.redivis.com/api/client-libraries/redivis-js/reference/user/user.workflow.md)(name)                    | Return a [Workflow](https://docs.redivis.com/api/client-libraries/redivis-js/reference/workflow.md) owned by the user. |


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.redivis.com/api/client-libraries/redivis-js/reference/user.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
