Skip to content

List keys

GET/v1/databases/{uid}/data/keys

Scans the keys of a Redis (Valkey) database with SCAN and returns their type and TTL. Only available for Redis databases; other engines return 400.

One call runs up to 20 SCAN rounds of 500 until at least 100 keys are found or the scan completes, so a page can hold more or fewer than 100 keys. Keys in a page are sorted by name. Pass the returned cursor back to continue; "0" means the whole keyspace has been covered. As with any SCAN, a key may appear on more than one page.

Key names that are not valid UTF-8 are shown escaped in key and given exactly in raw_b64. Use raw_b64 with key_b64 on Get a key.

The database must be ready. Requires the secrets read permission (owner, admin or developer role).

Authentication

Send your API key as Authorization: Bearer <token>. The request is scoped to the workspace in X-Workspace-Slug.

Path parameters

uidstringRequired

The database's uid.

Query parameters

patternstring

Glob-style MATCH pattern. Defaults to *. At most 1024 characters.

Default *max length 1024

cursorstring

Cursor from a previous response. Omit (or send 0) to start a new scan.

dbinteger

Redis logical database, 0 to 15. Defaults to 0. Non-numeric values are treated as 0.

Default 0min 0 · max 15

Headers

X-Workspace-SlugstringRequired

Slug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.

Response

200

One page of keys.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show attributes
keysarray of objectsRequired

Keys found in this page, sorted by name.

Show item attributes
keystringRequired

Key name. Names that are not valid UTF-8 are shown with \x escapes.

raw_b64string

Exact key name as standard base64. Only present when the name is not valid UTF-8.

typestringRequired

Redis type, such as string, hash, list, set, zset or stream.

ttl_msintegerRequired

Time to live in milliseconds. -1 when the key has no expiry.

cursorstringRequired

Cursor to pass back to continue the scan. "0" when the scan is complete.

dbintegerRequired

Logical database that was scanned.

keyspacesarray of objects | nullRequired

Key counts per logical database that has keys, from INFO keyspace. null when no database has keys or the counts could not be read.

Show item attributes
dbintegerRequired

Logical database number.

keysintegerRequired

Number of keys in that database.

Errors

StatusMeaning
400The request failed. Possible messages: key browsing is only available for Valkey databases, pattern is too long, invalid cursor, db must be between 0 and 15, or an error from the server.
401The API key is missing, invalid, expired or revoked.
403You cannot access the workspace, your role does not allow this action, or the account is suspended.
404The resource does not exist or you cannot access it.
409The data browser cannot run right now. Possible messages: the database must be ready to browse its data, the data viewer is busy, try again in a moment, and couldn't reach the database, check that it's running and try again.

Errors use the standard error format.