Skip to content

Get a key

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

Returns one key of a Redis (Valkey) database with its type, TTL, size and value. Only available for Redis databases.

  • string: value holds the first 64 KiB; truncated is true when the value is longer. length is the size in bytes.
  • hash, set, list, zset, stream: items holds one page of about 200 entries and length is the element count. When there is more, pass next back as the next query parameter. next is an empty string on the last page. Columns are field, value (hash), member (set), index, value (list), member, score (zset) and id, fields (stream, with fields as a JSON object).
  • Values that are not valid UTF-8 are shown with \x escapes. Each cell is cut at 8 KiB.

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

keystring

Key name. Required unless key_b64 is sent.

key_b64string

Key name as standard base64, for binary key names (see raw_b64 in List keys). Overrides key.

dbinteger

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

Default 0min 0 · max 15

nextstring

The next value from the previous page of this key's value.

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

The key and one page of its value.

successbooleanRequired

true when the request succeeded.

messagestringRequired

Human-readable status message.

dataobject
Show 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.

lengthintegerRequired

String length in bytes, or the number of elements in a collection.

valuestring

The string value (first 64 KiB). Only present for string keys.

truncatedbooleanRequired

true when a string value is longer than the 64 KiB returned.

itemsobject

One page of a collection's elements. Only present for hash, set, list, zset and stream keys.

Show attributes
columnsarray of objectsRequired

Result columns, in order.

Show item attributes
namestringRequired

Column name.

typestringRequired

Type name reported by the engine (for example int4 in PostgreSQL or varchar in MySQL). Empty string for Redis and for unknown types.

rowsarray of array of string | nullssRequired

Result rows. Each row is an array of cells in column order. Every value is a string; null is SQL NULL.

row_countintegerRequired

Number of rows in rows.

truncatedbooleanRequired

true when more rows exist than were returned, because of the row cap, the page size or the response size cap.

commandstring

PostgreSQL's command tag (for example SELECT 2 or EXPLAIN). For MySQL, SELECT <n> when the statement returned columns. For Redis SCAN-family commands, next cursor <n>. Omitted when the result was truncated and otherwise when there is none.

duration_msintegerRequired

Time taken to run the statement and read the result, in milliseconds.

nextstringRequired

Value to pass as next for the following page. Empty string when there are no more pages.

Errors

StatusMeaning
400The request failed. Possible messages: key is required, invalid key_b64, invalid page, key browsing is only available for Valkey databases, 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 database does not exist, or the key does not exist (key not found, it may have expired).
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.