Using
Counts live keys in the domain, optionally filtered by a prefix — the same semantics as `GET …/keys?prefix=`, without transferring the keys themselves.
applies to v0.5.1GET
/store-api/kv/{domain}/count
const url = 'https://example.com/store-api/kv/example/count';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://example.com/store-api/kv/example/count \ --header 'Authorization: Bearer <token>'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”domain
required
string
Domain name
Query Parameters
Section titled “Query Parameters”prefix
string
Key prefix filter
Responses
Section titled “Responses”Number of live keys matching the prefix. A full key scan under the hood (same cost as the equivalent keys?prefix= call) — cost grows linearly with domain size, so this is meant for on-demand use, not high-frequency polling.
Media typeapplication/json
Generic {"count": N} response, shared by JSON’s count_documents, KV’s
count_keys, and rel’s count_rows — one schema
instead of three identical ones.
object
count
required
integer format: int64
Example generated
{ "count": 1}Domain is being deleted
Media typetext/plain
string
Rate limit exceeded
Media typetext/plain
string
Headers
Section titled “Headers”Retry-After
integer format: int64