跳转到内容
EN

键值库

指南 →

基础地址与鉴权

键值库保存键和值,路径在 /database/v1/kv 下;键与命令的接口见各自的页面,也可以用 Upstash 兼容接口连接现有 Redis 客户端。用表格库的 ID 访问这些路径,返回 404 DATABASE_NOT_FOUND。创建请求体没有 kind。创建键值库的组织需已开通该能力,否则创建返回 400 INVALID_PARAMS:kind kv is not available。

创建键值库

POST /database/v1/kv

请求体

字段 类型 必填 说明
name string 是 名称
labels object 否 标签

返回: Database.

响应

HTTP 201

Success

application/json

名称 类型 说明
id string Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path.
name string Display name given at creation or by the last update; it is not an identifier.
labels object String tags attached to the database, as key and value pairs; empty object when none.
kind string Which store the database is, fixed at creation by the path it was created under: table (/database/v1/table, tables and rows) or kv (/database/v1/kv, keys and values); informational and read only.
status string Lifecycle state of the database. Table, field and row calls work only while it is active.
table_count integer Number of tables currently in the database, at most 50; refreshed when the schema changes.
size_bytes integer Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately.
created_at string Time the database was created, as an RFC 3339 UTC timestamp.
updated_at string Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp.
deleted_at string | null Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore.
purge_at string | null Permanent deletion deadline for deleting databases; null otherwise.
终端窗口
curl -X POST "https://api.deepraxis.com/database/v1/kv" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"docs-database-kv","labels":{"purpose":"docs","sample":"docs-database-"}}'

响应示例 — HTTP 201

{
"id": "db_581e6ba51c0b40be",
"kind": "kv",
"name": "docs-database-kv",
"labels": {
"purpose": "docs",
"sample": "docs-database-"
},
"status": "active",
"table_count": 0,
"size_bytes": 86016,
"created_at": "2026-11-27T03:16:53.654Z",
"updated_at": "2026-11-27T03:16:54.392Z",
"deleted_at": null,
"purge_at": null
}

列出键值库

GET /database/v1/kv

参数 位置 说明
cursor query 上一页返回的 next_cursor。
limit query 最多返回的条数。 (default: 20) (1–100)
labels query 精确匹配标签,例如 labels[purpose]=docs。
status query 库状态:active 或 deleting;省略时只列出 active。

返回: Page + object.

响应

HTTP 200

Success

application/json

名称 类型 说明
data array<object> Databases on this page, newest first (created_at descending, ties by id). Deleting databases are excluded unless status=deleting.
data[].id string Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path.
data[].name string Display name given at creation or by the last update; it is not an identifier.
data[].labels object String tags attached to the database, as key and value pairs; empty object when none.
data[].kind string Which store the database is, fixed at creation by the path it was created under: table (/database/v1/table, tables and rows) or kv (/database/v1/kv, keys and values); informational and read only.
data[].status string Lifecycle state of the database. Table, field and row calls work only while it is active.
data[].table_count integer Number of tables currently in the database, at most 50; refreshed when the schema changes.
data[].size_bytes integer Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately.
data[].created_at string Time the database was created, as an RFC 3339 UTC timestamp.
data[].updated_at string Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp.
data[].deleted_at string | null Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore.
data[].purge_at string | null Permanent deletion deadline for deleting databases; null otherwise.
next_cursor string | null Opaque cursor for the next page, or null when there are no more items. Databases list: pass it as cursor. Events list: pass it as after_seq (order asc) or before_seq (order desc).
终端窗口
curl -g -X GET "https://api.deepraxis.com/database/v1/kv?limit=10&labels[purpose]=docs&labels[sample]=docs-database-" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

响应示例 — HTTP 200

{
"data": [
{
"id": "db_581e6ba51c0b40be",
"kind": "kv",
"name": "docs-database-kv",
"labels": {
"purpose": "docs",
"sample": "docs-database-"
},
"status": "active",
"table_count": 0,
"size_bytes": 86016,
"created_at": "2026-11-27T03:16:53.654Z",
"updated_at": "2026-11-27T03:16:54.392Z",
"deleted_at": null,
"purge_at": null
}
],
"next_cursor": null
}

读取键值库

GET /database/v1/kv/{database_id}

参数 位置 说明
database_id path 库 ID。

返回: Database.

响应

HTTP 200

Success

application/json

名称 类型 说明
id string Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path.
name string Display name given at creation or by the last update; it is not an identifier.
labels object String tags attached to the database, as key and value pairs; empty object when none.
kind string Which store the database is, fixed at creation by the path it was created under: table (/database/v1/table, tables and rows) or kv (/database/v1/kv, keys and values); informational and read only.
status string Lifecycle state of the database. Table, field and row calls work only while it is active.
table_count integer Number of tables currently in the database, at most 50; refreshed when the schema changes.
size_bytes integer Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately.
created_at string Time the database was created, as an RFC 3339 UTC timestamp.
updated_at string Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp.
deleted_at string | null Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore.
purge_at string | null Permanent deletion deadline for deleting databases; null otherwise.
终端窗口
curl -X GET "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

响应示例 — HTTP 200

{
"id": "db_581e6ba51c0b40be",
"kind": "kv",
"name": "docs-database-kv",
"labels": {
"purpose": "docs",
"sample": "docs-database-"
},
"status": "active",
"table_count": 0,
"size_bytes": 86016,
"created_at": "2026-11-27T03:16:53.654Z",
"updated_at": "2026-11-27T03:16:54.392Z",
"deleted_at": null,
"purge_at": null
}

更新键值库

PATCH /database/v1/kv/{database_id}

参数 位置 说明
database_id path 库 ID。

请求体

字段 类型 必填 说明
name string 否 名称
labels object 否 标签

返回: Database.

响应

HTTP 200

Success

application/json

名称 类型 说明
id string Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path.
name string Display name given at creation or by the last update; it is not an identifier.
labels object String tags attached to the database, as key and value pairs; empty object when none.
kind string Which store the database is, fixed at creation by the path it was created under: table (/database/v1/table, tables and rows) or kv (/database/v1/kv, keys and values); informational and read only.
status string Lifecycle state of the database. Table, field and row calls work only while it is active.
table_count integer Number of tables currently in the database, at most 50; refreshed when the schema changes.
size_bytes integer Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately.
created_at string Time the database was created, as an RFC 3339 UTC timestamp.
updated_at string Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp.
deleted_at string | null Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore.
purge_at string | null Permanent deletion deadline for deleting databases; null otherwise.
终端窗口
curl -X PATCH "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY" \
-H "Content-Type: application/json" \
-d '{"name":"docs-database-cache"}'

响应示例 — HTTP 200

{
"id": "db_581e6ba51c0b40be",
"kind": "kv",
"name": "docs-database-cache",
"labels": {
"purpose": "docs",
"sample": "docs-database-"
},
"status": "active",
"table_count": 0,
"size_bytes": 86016,
"created_at": "2026-11-27T03:16:53.654Z",
"updated_at": "2026-11-27T03:16:56.399Z",
"deleted_at": null,
"purge_at": null
}

删除键值库

DELETE /database/v1/kv/{database_id}

参数 位置 说明
database_id path 库 ID。

返回: Database.

响应

HTTP 200

Success

application/json

名称 类型 说明
id string Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path.
name string Display name given at creation or by the last update; it is not an identifier.
labels object String tags attached to the database, as key and value pairs; empty object when none.
kind string Which store the database is, fixed at creation by the path it was created under: table (/database/v1/table, tables and rows) or kv (/database/v1/kv, keys and values); informational and read only.
status string Lifecycle state of the database. Table, field and row calls work only while it is active.
table_count integer Number of tables currently in the database, at most 50; refreshed when the schema changes.
size_bytes integer Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately.
created_at string Time the database was created, as an RFC 3339 UTC timestamp.
updated_at string Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp.
deleted_at string | null Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore.
purge_at string | null Permanent deletion deadline for deleting databases; null otherwise.
终端窗口
curl -X DELETE "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

响应示例 — HTTP 200

{
"id": "db_581e6ba51c0b40be",
"kind": "kv",
"name": "docs-database-cache",
"labels": {
"purpose": "docs",
"sample": "docs-database-"
},
"status": "deleting",
"table_count": 0,
"size_bytes": 90112,
"created_at": "2026-11-27T03:16:53.654Z",
"updated_at": "2026-11-27T03:17:03.630Z",
"deleted_at": "2026-11-27T03:17:03.630Z",
"purge_at": "2026-12-04T03:17:03.630Z"
}

恢复键值库

POST /database/v1/kv/{database_id}/restore

参数 位置 说明
database_id path 库 ID。

返回: Database.

响应

HTTP 200

Success

application/json

名称 类型 说明
id string Database identifier, prefixed db_. Pass it as database_id in every database, table, field, rows and events path.
name string Display name given at creation or by the last update; it is not an identifier.
labels object String tags attached to the database, as key and value pairs; empty object when none.
kind string Which store the database is, fixed at creation by the path it was created under: table (/database/v1/table, tables and rows) or kv (/database/v1/kv, keys and values); informational and read only.
status string Lifecycle state of the database. Table, field and row calls work only while it is active.
table_count integer Number of tables currently in the database, at most 50; refreshed when the schema changes.
size_bytes integer Storage size; row writes and GET refresh usage at most once per five seconds, schema changes refresh immediately.
created_at string Time the database was created, as an RFC 3339 UTC timestamp.
updated_at string Time of the last change to the name, labels, status or usage snapshot, as an RFC 3339 UTC timestamp.
deleted_at string | null Time the database entered the deleting state, as an RFC 3339 UTC timestamp; null while it is active and again after a restore.
purge_at string | null Permanent deletion deadline for deleting databases; null otherwise.
终端窗口
curl -X POST "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/restore" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

响应示例 — HTTP 200

{
"id": "db_581e6ba51c0b40be",
"kind": "kv",
"name": "docs-database-cache",
"labels": {
"purpose": "docs",
"sample": "docs-database-"
},
"status": "active",
"table_count": 0,
"size_bytes": 90112,
"created_at": "2026-11-27T03:16:53.654Z",
"updated_at": "2026-11-27T03:17:02.780Z",
"deleted_at": null,
"purge_at": null
}

清除键值库

POST /database/v1/kv/{database_id}/purge

参数 位置 说明
database_id path 库 ID。

返回: object.

响应

HTTP 200

Permanently purged

application/json

名称 类型 说明
id string Id (db_…) of the database that was permanently purged; it no longer resolves.
object string Resource type of the purged object; always database.
purged boolean Always true: the database and all of its data were permanently removed and cannot be recovered.
终端窗口
curl -X POST "https://api.deepraxis.com/database/v1/kv/${DATABASE_ID}/purge" \
-H "Authorization: Bearer $PRAXIS_API_KEY"

响应示例 — HTTP 200

{
"id": "db_581e6ba51c0b40be",
"object": "database",
"purged": true
}

Database

字段 类型 必填 说明
id string 是 资源 ID; ^db_
name string 是 名称
labels object 是 标签
kind "table" / "kv" 是 库的类型,由创建时的路径决定,只读:table(/database/v1/table)为表与行,kv(/database/v1/kv)为键值
status "provisioning" / "active" / "deleting" / "deleted" / "failed" 是 库状态
table_count integer 是 表数量
size_bytes integer 是 占用字节数
created_at date-time 是 创建时间
updated_at date-time 是 更新时间
deleted_at date-time / null 是 删除时间;未删除时为 null
purge_at date-time / null 是 —

Page

字段 类型 必填 说明
data JSON[] 是 资源数组
next_cursor string / null 是 下一页游标,原样传回 cursor;没有后续时为 null