Skip to main content
Use ACL RESTTOKEN to get a REST API token for an ACL user you already created, given that user’s username and password. The password is the same value used with >password in ACL SETUSER, which is itself a value produced by ACL GENTOKEN; passing the full token string that GENTOKEN returned also works. The result is a bearer token scoped to that user’s permissions that can be set as UPSTASH_REDIS_REST_TOKEN, which is how a database user created for TCP access is also given REST API access. RESTTOKEN is an Upstash extension.

Syntax

Arguments

Important points

  • Returns an error if the username does not exist or the password does not match.
  • The returned token carries the same permissions as the underlying user; revoking or narrowing the user with ACL SETUSER also affects every token issued 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.
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.