Use ACL GENTOKEN to create the credential you need before you can give an ACL user a password.
ACL SETUSER does not accept arbitrary passwords with >password: the value must come from GENTOKEN. Call it with just a username to have a strong password generated for you, or supply your own password to wrap instead. Either way, the reply is a token string that does two things at once: pass it to SETUSER as >token to set the user's password, and later use it directly as UPSTASH_REDIS_REST_TOKEN, or exchange it (or the password it wraps) for a fresh one with ACL RESTTOKEN. GENTOKEN is an Upstash extension.
Syntax#
Arguments#
| Argument | Required | Repeatable | Description |
|---|---|---|---|
username | Yes | No | ACL user this token will belong to. The user does not need to exist yet. |
password | No | No | Password to wrap in the token. When omitted, a strong random password is generated instead. |
Important points#
- A supplied
passwordis checked for minimum entropy and rejected if too weak. - This only generates a token; it does not create or modify the user. Pass the result to
ACL SETUSER <username> >tokento actually set it as the user's password.
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 | Bulk string |
| RESP3 | Bulk string |
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.
Redis CLI
@upstash/redis
This command is not supported yet in @upstash/redis.
upstash_redis
This command is not supported yet in upstash_redis.