Skip to main content
Use ACL SETUSER to create a new ACL user or change the rules of an existing one. Rules are applied left to right in a single call: they enable or disable the user (on, off), grant or revoke access to key patterns (~pattern), channel patterns (&pattern), commands and categories (+get, -@admin), and manage passwords. Because rules are cumulative, calling SETUSER again only adds to or removes from what a user already has; use reset to start over from a clean slate.

Syntax

Arguments

Important points

  • This command can expose administrative information or make a broad destructive change. Restrict it to trusted code paths.
  • nopass is rejected. Every user must have at least one password; there is no way to allow authentication with any password.
  • Plain-text passwords (>password) and pre-hashed passwords (#hash) are rejected. Passwords must be generated with ACL GENTOKEN and added with >token; this is what lets the same credential authenticate on both the TCP and REST endpoints.
  • Subcommand-scoped rules such as +client|list are not supported and return an error.
  • The default user cannot be modified; the command returns an error if it is the target.
  • Changes take effect immediately on new and existing connections, so a rule that narrows access can lock out a running application. Check with ACL GETUSER before applying it broadly.

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.
Client libraries often decode bulk strings, maps, sets, and numeric strings into language-native values. The table describes the Redis wire reply.

Examples

TCP examples use the TLS REDIS_URL from the Upstash console. REST examples use UPSTASH_REDIS_REST_URL and UPSTASH_REDIS_REST_TOKEN.
This command is not supported yet in @upstash/redis.
This command is not supported yet in upstash_redis.