{"ok":true,"data":{"site":"kv.disk.zone","name":"disk.zone KV API","version":"1.0.0","description":"disk.zone 的 KV 键值存储：按命名空间组织，数据在 B2 存储池，单个 key 的读写在离用户最近的边缘完成。用 disk.zone 账号新建命名空间，用命名空间 Key 或账户 Key 通过 HTTP 读写。","base_url":"https://kv.disk.zone","links":{"openapi":"https://kv.disk.zone/api/openapi.json","llms_txt":"https://kv.disk.zone/llms.txt","docs":"https://kv.disk.zone/docs","health":"https://kv.disk.zone/api/health","platform":"https://disk.zone/developers","app":"https://kv.disk.zone/app","account":"https://disk.zone/app/account"},"auth":{"namespace_key":{"title":"命名空间 Key","how":"新建命名空间时返回，之后随时可在控制台或 GET /api/namespaces/{ns} 查看，形如 kvk_…；以 Authorization: Bearer kvk_… 调用 /v1/{ns}/…（也可 ?apikey= 或 x-api-key）。只能操作这一个命名空间，最快的读写方式。"},"cookie":{"title":"浏览器登录","how":"在 disk.zone 任一页面登录后，本站网页直接调用接口。"},"bearer":{"title":"Bearer 访问令牌","how":"POST https://disk.zone/api/auth/login 时传 \"mode\":\"token\"，以 Authorization: Bearer <access_token> 调用。"},"api_key":{"title":"账户 API Key","how":"https://disk.zone/app/account 创建，dzk.<用户名>.<keyid>.<secret>；能操作该账号的全部命名空间。"}},"conventions":{"envelope":{"success":"{\"ok\":true,\"data\":…}","failure":"{\"ok\":false,\"error\":{\"code\":\"snake_case\",\"message\":\"中文说明\"}}"},"errors":{"description":"error.code 是稳定的 snake_case 机器码，程序据此判断；error.message 是给人看的中文说明。","http_status":{"400":"参数错误","401":"未登录、令牌失效或 Key 不对","403":"被拒绝","404":"不存在","405":"请求方法不被允许","409":"冲突（如名字已被占用）","413":"太大","502":"存储上游出错","503":"暂时不可用（附 retry-after）"}},"time":"时间为 Unix 毫秒。"},"ops":[{"name":"kv_get","title":"读取一个 key","tag":"kv","method":"GET","path":"/v1/{ns}/{key}","auth":"namespace_key_or_account","mutates":false,"description":"返回值本身（不加 ok/data 包装），带 etag（版本号）、x-kv-metadata、x-kv-expiration（Unix 秒）；支持 Range、If-Range、If-Match。HEAD 只要头部。不存在时 404。","url":"https://kv.disk.zone/v1/{ns}/{key}"},{"name":"kv_put","title":"写入一个 key","tag":"kv","method":"PUT","path":"/v1/{ns}/{key}","auth":"namespace_key_or_account","mutates":true,"body":"application/octet-stream","description":"请求体就是值（任意字节，单次最大约 100 MB）。同一 key 再写就是覆盖。返回 {etag, expires}。","query":[{"name":"ttl","description":"多少秒后过期","schema":{"type":"integer","minimum":1}},{"name":"expiration","description":"过期时刻（Unix 秒）","schema":{"type":"integer"}},{"name":"metadata","description":"附带的 JSON 元数据（也可放 x-kv-metadata 头，URL 编码）","schema":{"type":"string"}}],"url":"https://kv.disk.zone/v1/{ns}/{key}"},{"name":"kv_delete","title":"删除一个 key","tag":"kv","method":"DELETE","path":"/v1/{ns}/{key}","auth":"namespace_key_or_account","mutates":true,"description":"删除这个 key 的所有版本，不留痕迹。不存在也算成功。","url":"https://kv.disk.zone/v1/{ns}/{key}"},{"name":"kv_list","title":"按前缀列出","tag":"kv","method":"GET","path":"/v1/{ns}","auth":"namespace_key_or_account","mutates":false,"description":"按字节顺序分页列出 key：{keys: [{name, size, modified, id, expires}], cursor, list_complete}。翻页时把 cursor 原样带回；一页可能少于 limit，以 list_complete 为准。","query":[{"name":"prefix","schema":{"type":"string"}},{"name":"limit","schema":{"type":"integer","minimum":1,"maximum":10000,"default":1000}},{"name":"cursor","schema":{"type":"string"}},{"name":"after","description":"从这个名字之后开始（不含）","schema":{"type":"string"}},{"name":"before","description":"到这个名字之前为止（不含）","schema":{"type":"string"}}],"url":"https://kv.disk.zone/v1/{ns}"},{"name":"kv_delete_many","title":"批量删除","tag":"kv","method":"POST","path":"/v1/{ns}?delete","auth":"namespace_key_or_account","mutates":true,"description":"一次删除 1–1000 个 key：{deleted, failed: [{key, code}]}。","input":{"type":"object","properties":{"keys":{"type":"array","items":{"type":"string"},"minItems":1,"maxItems":1000},"ids":{"type":"array","description":"可选：和 keys 一一对应的版本号（列表里的 id），给了就按版本删，更快","items":{"type":["string","null"]}}},"required":["keys"]},"url":"https://kv.disk.zone/v1/{ns}?delete"},{"name":"me","title":"当前账号","tag":"account","method":"GET","path":"/api/me","auth":"login","mutates":false,"description":"当前 disk.zone 账号：{user: {id}}。","url":"https://kv.disk.zone/api/me"},{"name":"namespaces_list","title":"我的命名空间","tag":"namespaces","method":"GET","path":"/api/namespaces","auth":"login","mutates":false,"description":"当前账号的命名空间：{items: [{name, state, created, key}]}。key 是这个命名空间的 Key（kvk_…），随时可取。","url":"https://kv.disk.zone/api/namespaces"},{"name":"namespace_create","title":"新建命名空间","tag":"namespaces","method":"POST","path":"/api/namespaces","auth":"login","mutates":true,"description":"新建一个命名空间，返回 {name, key, created}，key 是它的 Key（kvk_…），之后也能随时用 GET 取回。名字全站唯一，先到先得。","input":{"type":"object","properties":{"name":{"type":"string","pattern":"^[A-Za-z0-9][A-Za-z0-9_-]{0,63}$","description":"1–64 个字母、数字、_ 或 -，以字母或数字开头"}},"required":["name"]},"url":"https://kv.disk.zone/api/namespaces"},{"name":"namespace_get","title":"一个命名空间","tag":"namespaces","method":"GET","path":"/api/namespaces/{ns}","auth":"login","mutates":false,"description":"{name, state, created, key}：key 是这个命名空间当前的 Key。","url":"https://kv.disk.zone/api/namespaces/{ns}"},{"name":"namespace_rekey","title":"换一把 Key","tag":"namespaces","method":"POST","path":"/api/namespaces/{ns}/key","auth":"login","mutates":true,"description":"生成新的命名空间 Key 并返回 {name, key}；旧 Key 在一分钟内失效。","url":"https://kv.disk.zone/api/namespaces/{ns}/key"},{"name":"namespace_delete","title":"删除命名空间","tag":"namespaces","method":"DELETE","path":"/api/namespaces/{ns}","auth":"login","mutates":true,"description":"Key 立即失效（各地缓存最多一分钟）；后台随后删掉全部数据，删完名字才能再用。","url":"https://kv.disk.zone/api/namespaces/{ns}"},{"name":"health","title":"健康检查","tag":"service","method":"GET","path":"/api/health","auth":"none","mutates":false,"description":"{service, status}。","url":"https://kv.disk.zone/api/health"}]}}