Keys
These operations exist only under /database/v1/kv; a table database’s id returns 404 DATABASE_NOT_FOUND. Reads need a read credential and writes a read-write credential.
Limits: a key is at most 1 KiB, a value at most 1 MiB, a reply at most 8 MiB (read in ranges with SCAN, HSCAN, LRANGE or ZRANGE) and a database at most 1 GiB.
To connect an existing Redis client use the Upstash-compatible API.
List keys
GET /database/v1/kv/{database_id}/keys
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned by databaseCreateKvDatabase or databaseListKvDatabases. A display name is not accepted; the id of a table database returns 404 DATABASE_NOT_FOUND. |
| limit | query | Keys per page, 1–500, default 50; a value outside the range returns 400 INVALID_PARAMS. (default: 50) (1–500) |
| cursor | query | The next_cursor of the previous page, passed back unchanged; omit it to start from the first key. |
| pattern | query | Redis glob (* any run, ? one character, [abc] a set, [^abc] a negated set) matched against the whole key, for example user:*; omitted returns every key. |
| type | query | Return only keys holding this value type; omitted returns every type. |
Returns: object.
Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| data | array<object> | Key summaries on this page in lexicographic key order; empty when nothing matches. |
| data[].key | string | The key name; pass it percent-encoded as the key path parameter of the key operations. |
| data[].type | string | Value type stored under the key. |
| data[].ttl_ms | integer | null | Time to live in milliseconds, remaining until the key expires; null when the key never expires. |
| data[].size_bytes | integer | Stored size of the value in bytes. |
| next_cursor | string | null | Cursor for the next page, passed back unchanged as cursor; null when this is the last page. |
curl -X GET "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/keys?pattern=user%3A*&limit=10" \ -H "Authorization: Bearer $PRAXIS_API_KEY"Response example — HTTP 200
{ "data": [ { "key": "user:1", "type": "hash", "ttl_ms": 3599183, "size_bytes": 16 } ], "next_cursor": null}Get key
GET /database/v1/kv/{database_id}/keys/{key}
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned by databaseCreateKvDatabase or databaseListKvDatabases. A display name is not accepted; the id of a table database returns 404 DATABASE_NOT_FOUND. |
| key | path | The key to read: any UTF-8 string up to 1 KiB, percent-encoded in the path (for example user%3A1 for user:1). Keys are case-sensitive. |
| limit | query | Container entries per page, 1–1000, default 100; ignored for a string value, which is never paged. (default: 100) (1–1000) |
| cursor | query | The next_cursor of the previous page of this key, passed back unchanged; omit it for the first page. |
Returns: Key.
Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| key | string | The key name. |
| type | string | Value type stored under the key; it decides the shape of value. |
| ttl_ms | integer | null | Time to live in milliseconds, remaining until the key expires; null when the key never expires. |
| size_bytes | integer | Stored size of the whole value in bytes, not of this page. |
| value | string | array<string | object> | The value in the shape of type: a string; hash as [{field, value}]; list and set as a string array; zset as [{member, score}]. For a container this is one page; read the rest with next_cursor. |
| next_cursor | string | null | Cursor for the next page of a container value, passed back unchanged as cursor; null for a string value and on the last page. |
curl -X GET "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/keys/user%3A1" \ -H "Authorization: Bearer $PRAXIS_API_KEY"Response example — HTTP 200
{ "key": "user:1", "type": "hash", "ttl_ms": 3598632, "size_bytes": 16, "value": [ { "field": "name", "value": "Ada" }, { "field": "role", "value": "admin" } ], "next_cursor": null}Set key
PUT /database/v1/kv/{database_id}/keys/{key}
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned by databaseCreateKvDatabase or databaseListKvDatabases. A display name is not accepted; the id of a table database returns 404 DATABASE_NOT_FOUND. |
| key | path | The key to write: any UTF-8 string up to 1 KiB, percent-encoded in the path (for example user%3A1 for user:1). Keys are case-sensitive. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| type | "string" / "hash" / "list" / "set" / "zset" | yes | Type of the new value; it becomes the key's type and replaces whatever was stored under it. |
| value | string / string / object[] | yes | The whole new value in the shape of type: a string; hash as [{field, value}]; list and set as a non-empty string array; zset as [{member, score}]. At most 1 MiB. |
| ttl_ms | integer / null | no | Omit to keep the key's existing TTL; a positive integer sets a new TTL in milliseconds; null makes the key permanent. |
Returns: Key.
Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| key | string | The key name. |
| type | string | Value type stored under the key; it decides the shape of value. |
| ttl_ms | integer | null | Time to live in milliseconds, remaining until the key expires; null when the key never expires. |
| size_bytes | integer | Stored size of the whole value in bytes, not of this page. |
| value | string | array<string | object> | The value in the shape of type: a string; hash as [{field, value}]; list and set as a string array; zset as [{member, score}]. For a container this is one page; read the rest with next_cursor. |
| next_cursor | string | null | Cursor for the next page of a container value, passed back unchanged as cursor; null for a string value and on the last page. |
curl -X PUT "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/keys/user%3A1" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"type":"hash","value":[{"field":"name","value":"Ada"},{"field":"role","value":"admin"}],"ttl_ms":3600000}'Response example — HTTP 200
{ "key": "user:1", "type": "hash", "ttl_ms": 3600000, "size_bytes": 16, "value": [ { "field": "name", "value": "Ada" }, { "field": "role", "value": "admin" } ], "next_cursor": null}Update key
PATCH /database/v1/kv/{database_id}/keys/{key}
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned by databaseCreateKvDatabase or databaseListKvDatabases. A display name is not accepted; the id of a table database returns 404 DATABASE_NOT_FOUND. |
| key | path | The key whose TTL changes: any UTF-8 string up to 1 KiB, percent-encoded in the path (for example user%3A1 for user:1). Keys are case-sensitive. |
Request body
| Field | Type | Required | Description |
|---|---|---|---|
| update_mask | "ttl_ms" | yes | The field being changed; only ttl_ms is writable and it must be stated. |
| ttl_ms | integer / null | yes | A positive integer sets the TTL in milliseconds from now; null removes the TTL so the key never expires. |
Returns: Key.
Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| key | string | The key name. |
| type | string | Value type stored under the key; it decides the shape of value. |
| ttl_ms | integer | null | Time to live in milliseconds, remaining until the key expires; null when the key never expires. |
| size_bytes | integer | Stored size of the whole value in bytes, not of this page. |
| value | string | array<string | object> | The value in the shape of type: a string; hash as [{field, value}]; list and set as a string array; zset as [{member, score}]. For a container this is one page; read the rest with next_cursor. |
| next_cursor | string | null | Cursor for the next page of a container value, passed back unchanged as cursor; null for a string value and on the last page. |
curl -X PATCH "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/keys/user%3A1" \ -H "Authorization: Bearer $PRAXIS_API_KEY" \ -H "Content-Type: application/json" \ -d '{"update_mask":"ttl_ms","ttl_ms":600000}'Response example — HTTP 200
{ "key": "user:1", "type": "hash", "ttl_ms": 600000, "size_bytes": 16, "value": [ { "field": "name", "value": "Ada" }, { "field": "role", "value": "admin" } ], "next_cursor": null}Delete key
DELETE /database/v1/kv/{database_id}/keys/{key}
| Parameter | Location | Description |
|---|---|---|
| database_id | path | Identifier of the key-value database: the id (db_…) returned by databaseCreateKvDatabase or databaseListKvDatabases. A display name is not accepted; the id of a table database returns 404 DATABASE_NOT_FOUND. |
| key | path | The key to delete: any UTF-8 string up to 1 KiB, percent-encoded in the path (for example user%3A1 for user:1). Keys are case-sensitive. |
Returns: object.
Response
HTTP 200
Success
application/json
| Name | Type | Description |
|---|---|---|
| deleted | boolean | True when the key existed and was removed; false when it was absent or had already expired. |
curl -X DELETE "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/keys/user%3A1" \ -H "Authorization: Bearer $PRAXIS_API_KEY"Response example — HTTP 200
{ "deleted": true}KeySummary
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | yes | The key name; pass it percent-encoded as the key path parameter of the key operations. |
| type | "string" / "hash" / "list" / "set" / "zset" | yes | Value type stored under the key. |
| ttl_ms | integer / null | yes | Time to live in milliseconds, remaining until the key expires; null when the key never expires. |
| size_bytes | integer | yes | Stored size of the value in bytes. |
Key
| Field | Type | Required | Description |
|---|---|---|---|
| key | string | yes | The key name. |
| type | "string" / "hash" / "list" / "set" / "zset" | yes | Value type stored under the key; it decides the shape of value. |
| ttl_ms | integer / null | yes | Time to live in milliseconds, remaining until the key expires; null when the key never expires. |
| size_bytes | integer | yes | Stored size of the whole value in bytes, not of this page. |
| value | string / string / object[] | yes | The value in the shape of type: a string; hash as [{field, value}]; list and set as a string array; zset as [{member, score}]. For a container this is one page; read the rest with next_cursor. |
| next_cursor | string / null | yes | Cursor for the next page of a container value, passed back unchanged as cursor; null for a string value and on the last page. |