KV
Armazenamento chave-valor
Guarde e leia pares chave-valor sem subir banco nenhum. Cada cliente só vê as próprias chaves — não tem como ler ou sobrescrever a chave de outra conta, mesmo que o nome seja igual.
Key-value storage
Store and read key-value pairs without standing up a database. Each client only ever sees its own keys — there's no way to read or overwrite another account's key, even with the same name.
SYNC resposta na mesma chamada answers in the same call
Endpoints
Endpoints
/api/v1/kv/{key}
grava (ou atualiza) uma chavewrites (or updates) a key
/api/v1/kv/{key}
lê uma chavereads a key
/api/v1/kv/{key}
remove uma chavedeletes a key
/api/v1/kv
lista suas chaves (paginado)lists your keys (paginated)
A listagem devolve só os nomes das chaves, nunca os valores — mantém a resposta pequena não importa o tamanho do que está guardado. Pra ver um valor, é um GET por chave.
Listing returns only the key names, never the values — keeps the response small regardless of how much is stored. To see a value, it's a GET per key.
Corpo do PUT
PUT body
| Campo | Field | Descrição | Description |
|---|---|---|---|
value | o valor a guardar, como string. Dado binário fica por conta de quem chama, em base64 — não é um endpoint de bytes crus | the value to store, as a string. Binary data is the caller's own base64 responsibility — this isn't a raw-bytes endpoint | |
ttl_seconds | opcional, padrão 0 (sem expiração) — depois desse tempo a chave some sozinha | optional, defaults to 0 (no expiry) — the key disappears on its own after this long |
Exemplo
Example
# grava# write
curl -X PUT https://api.alicercelabs.com.br/api/v1/kv/preferencia-tema \
-H "Authorization: Bearer <token>" \
-d '{"value": "escuro", "ttl_seconds": 0}'
# lê# read
curl https://api.alicercelabs.com.br/api/v1/kv/preferencia-tema \
-H "Authorization: Bearer <token>"
{
"success": true,
"data": { "key": "preferencia-tema", "value": "escuro" },
"meta": { "elapsed_ms": 3, "request_id": "..." }
}
Erros possíveis
Possible errors
| Status | Motivo | Reason |
|---|---|---|
| 400 | chave vazia ou maior que 256 caracteres, corpo inválido, valor maior que a cota, ou limite de chaves atingido pra uma chave nova (atualizar uma já existente sempre é permitido, mesmo no limite) | empty/too-long key, invalid body, value over quota, or key-count limit reached for a new key (updating an existing one is always allowed, even at the limit) |
| 401 | token ausente ou inválido | missing or invalid token |
| 404 | chave não encontrada — nunca existiu, foi removida, ou expirou | key not found — never existed, was deleted, or expired |
| 429 | limite de taxa excedido — leitura e escrita têm cotas separadas | rate limit exceeded — reads and writes have separate quotas |
Limites
Limits
10.000/dia · 416/hora por operação (leitura e escrita contam separado). Cotas de armazenamento, por cliente: até 1000 chaves, até 64KB por valor.
10,000/day · 416/hour per operation (reads and writes counted separately). Storage quotas, per client: up to 1000 keys, up to 64KB per value.