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

PUT/api/v1/kv/{key} grava (ou atualiza) uma chavewrites (or updates) a key
GET/api/v1/kv/{key} lê uma chavereads a key
DELETE/api/v1/kv/{key} remove uma chavedeletes a key
GET/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

CampoFieldDescriçãoDescription
valueo valor a guardar, como string. Dado binário fica por conta de quem chama, em base64 — não é um endpoint de bytes crusthe value to store, as a string. Binary data is the caller's own base64 responsibility — this isn't a raw-bytes endpoint
ttl_secondsopcional, padrão 0 (sem expiração) — depois desse tempo a chave some sozinhaoptional, 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

StatusMotivoReason
400chave 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)
401token ausente ou inválidomissing or invalid token
404chave não encontrada — nunca existiu, foi removida, ou expiroukey not found — never existed, was deleted, or expired
429limite de taxa excedido — leitura e escrita têm cotas separadasrate 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.