# ACL GETUSER

> Get the user's details.

Use `ACL GETUSER` to inspect the resulting permissions of a single ACL user, broken out into structured fields instead of the raw rule string that [`ACL LIST`](/redis/commands/server/acl-list) returns.

The reply describes the user's on/off and other flags, its passwords, the commands it can call as a single space-separated permission string, the key patterns it can access, and the channel patterns it can publish to or subscribe on. A username that does not exist returns a null reply rather than an error, which makes this command a convenient way to check whether a user exists before creating or modifying it.

## Syntax

```redis
ACL GETUSER <username>
```

## Arguments

| Argument | Required | Repeatable | Description |
| --- | --- | --- | --- |
| `username` | Yes | No | ACL user to inspect. |

## Important points

- Returns null when the given username does not exist, instead of an error.
- The reply has five fields: `flags`, `passwords`, `commands`, `keys`, and `channels`. Standard Redis 7+ also returns a `selectors` field; this deployment does not support selectors, so client libraries that expect one will simply receive an empty or undefined value for it.

## Response

The reply reports the result of the operation. Error replies have the same shape in RESP2 and RESP3 and are surfaced as exceptions by the SDKs below.

| Protocol | Reply |
| --- | --- |
| RESP2 | Flat array of alternating field names and values, with nested arrays for `flags`, `passwords`, `keys`, and `channels`; or Null array |
| RESP3 | Map of five fields, with a Set for `flags` and Arrays for `passwords`, `keys`, and `channels`; or Null |

<Note>
  Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.
</Note>

## Examples

TCP examples use the TLS `REDIS_URL` from the Upstash console. REST examples use `UPSTASH_REDIS_REST_URL` and `UPSTASH_REDIS_REST_TOKEN`.

<AccordionGroup>

<Accordion title="Redis CLI" icon="terminal">

```bash
ACL GETUSER app
```

</Accordion>

<Accordion title="@upstash/redis" icon="node-js" iconType="brands">

<Note>
  This command is not supported yet in `@upstash/redis`.
</Note>

</Accordion>

<Accordion title="upstash_redis" icon="python" iconType="brands">

<Note>
  This command is not supported yet in `upstash_redis`.
</Note>

</Accordion>

<Accordion title="ioredis" icon="node-js" iconType="brands">

```ts
import Redis from "ioredis";

const redis = new Redis(process.env.REDIS_URL!);
const result = await redis.acl("GETUSER", "app");
console.log(result);
```

</Accordion>

<Accordion title="node-redis" icon="node-js" iconType="brands">

```ts
import { createClient } from "redis";

const client = await createClient({ url: process.env.REDIS_URL })
  .on("error", console.error)
  .connect();
const result = await client.aclGetUser("app");
console.log(result);
// { flags: [...], passwords: [...], commands: '...', keys: [...], channels: [...], selectors: undefined }
```

</Accordion>

<Accordion title="redis-py" icon="python" iconType="brands">

```python
import os
import redis

client = redis.from_url(os.environ["REDIS_URL"])
result = client.acl_getuser("app")
print(result)
```

</Accordion>

<Accordion title="go-redis" icon="golang" iconType="brands">

<Note>
  go-redis has no typed `ACLGetUser` method; call `ACL GETUSER` through `Do`.
</Note>

```go
package main

import (
    "context"
    "fmt"
    "os"

    "github.com/redis/go-redis/v9"
)

func main() {
    opts, err := redis.ParseURL(os.Getenv("REDIS_URL"))
    if err != nil {
        panic(err)
    }
    client := redis.NewClient(opts)
    result, err := client.Do(context.Background(), "ACL", "GETUSER", "app").Result()
    if err != nil {
        panic(err)
    }
    fmt.Println(result)
}
```

</Accordion>

<Accordion title="jedis" icon="java" iconType="brands">

```java
import java.net.URI;

import redis.clients.jedis.Jedis;

try (Jedis jedis = new Jedis(new URI(System.getenv("REDIS_URL")))) {
  Object result = jedis.aclGetUser("app");
  System.out.println(result);
}
```

</Accordion>

<Accordion title="redis-rs" icon="rust" iconType="brands">

```rust
use redis::TypedCommands;

fn main() -> redis::RedisResult<()> {
    let url = std::env::var("REDIS_URL").expect("REDIS_URL is not set");
    let client = redis::Client::open(url)?;
    let mut connection = client.get_connection()?;

    let result = connection.acl_getuser("app")?;
    println!("{result:?}");
    Ok(())
}
```

</Accordion>

</AccordionGroup>
