/v1/databases/{uid}/data/keysScans 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
uidstringRequiredThe database's uid.
Query parameters
patternstringGlob-style MATCH pattern. Defaults to *. At most 1024 characters.
Default *max length 1024
cursorstringCursor from a previous response. Omit (or send 0) to start a new scan.
dbintegerRedis logical database, 0 to 15. Defaults to 0. Non-numeric values are treated as 0.
Default 0min 0 · max 15
Headers
X-Workspace-SlugstringRequiredSlug of the workspace the request acts on. You can also pass it as the workspace_slug query parameter.
Response
One page of keys.
successbooleanRequiredtrue when the request succeeded.
messagestringRequiredHuman-readable status message.
dataobjectShow attributesHide attributes
keysarray of objectsRequiredKeys found in this page, sorted by name.
Show item attributesHide item attributes
keystringRequiredKey name. Names that are not valid UTF-8 are shown with \x escapes.
raw_b64stringExact key name as standard base64. Only present when the name is not valid UTF-8.
typestringRequiredRedis type, such as string, hash, list, set, zset or stream.
ttl_msintegerRequiredTime to live in milliseconds. -1 when the key has no expiry.
cursorstringRequiredCursor to pass back to continue the scan. "0" when the scan is complete.
dbintegerRequiredLogical database that was scanned.
keyspacesarray of objects | nullRequiredKey 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 attributesHide item attributes
dbintegerRequiredLogical database number.
keysintegerRequiredNumber of keys in that database.
Errors
| Status | Meaning |
|---|---|
400 | The 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. |
401 | The API key is missing, invalid, expired or revoked. |
403 | You cannot access the workspace, your role does not allow this action, or the account is suspended. |
404 | The resource does not exist or you cannot access it. |
409 | The 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.