SeleKV
SeleKV
Zero egress fees, on every plan. Reading your data never costs extra. Fair use applies and the limits below stop at your plan; they never turn into a surprise bill.
SeleKV is key-value storage for small, frequently read data: sessions, settings, feature flags, counters and caches. One HTTPS API, one SeleTech API key, and every project's data is isolated from every other project.
Quickstart
- Create an API key in the developer console (shown once; copy it into an environment variable).
- Store a value, read it back, count something.
curl
export KEY=ssk_live_xxxxxxxxxxxxxxxxxxxxxxxx
export HOST=https://kv.seleid.dev
curl -X PUT "$HOST/v1/kv/app/theme?ttl=3600" -H "Authorization: Bearer $KEY" --data-binary "dark"
curl "$HOST/v1/kv/app/theme" -H "Authorization: Bearer $KEY"
curl -X POST "$HOST/v1/kv/app/visits/incr" -H "Authorization: Bearer $KEY" -H "Content-Type: application/json" -d '{"by":1}'
TypeScript
const host = 'https://kv.seleid.dev';
const headers = { Authorization: `Bearer ${process.env.SELEKV_KEY}` };
await fetch(`${host}/v1/kv/app/theme?ttl=3600`, { method: 'PUT', headers, body: 'dark' });
const theme = await (await fetch(`${host}/v1/kv/app/theme`, { headers })).text();
const { value } = await (await fetch(`${host}/v1/kv/app/visits/incr`, { method: 'POST', headers: { ...headers, 'Content-Type': 'application/json' }, body: JSON.stringify({ by: 1 }) })).json();
Authentication
Send Authorization: Bearer <key>. A key belongs to one project and has scopes: read (get, list, usage), write (put, delete, increment) and admin. We store only a hash of each key.
Endpoints
| Method and path | Scope | What it does |
|---|---|---|
GET /v1/kv/{namespace}/{key} | read | The value, with X-Sele-Metadata and X-Sele-Expires headers when set. 404 when absent or expired. |
PUT /v1/kv/{namespace}/{key}?ttl=SECONDS | write | Store a value (the request body). Optional X-Sele-Metadata JSON up to 1024 bytes. If-None-Match: * creates only if the key is new (412 otherwise). |
DELETE /v1/kv/{namespace}/{key} | write | Remove a key. Safe to repeat. |
GET /v1/kv/{namespace}?prefix=&limit=&cursor= | read | List key names (up to 1000 per page) with the next cursor. |
POST /v1/kv/{namespace}/{key}/incr | write | Atomic counter. Body {"by": 1}. Exact even when many requests arrive at once. |
GET /v1/usage | read | Your stored data, reads and writes this month, and your plan limits. Not metered. |
Namespace and key names use 1 to 128 letters, numbers, dots, dashes, colons and underscores; keys may also use single / separators. A time-to-live is 1 second to 365 days; an expired key is gone immediately.
Person access for apps
An app can let its signed-in people use SeleKV directly with their own SeleID token, with no server key inside the app. Each person gets a private space that only they can reach: other people, other apps and your server keys never see it, and it never sees theirs.
- With a server key that has the
adminscope, register your app:PUT /v1/person/clients/{clientId}with{"rules":{"person":["read","write"]}}. Access is off until you do, and you can allow onlyread. - In the app, send the signed-in person's ID token (the
id_tokenfrom sign-in) asAuthorization: Bearer <token>to the same endpoints. Namespaces you name are placed inside that person's space automatically.
People can use the key-value endpoints only. Usage, and changing these rules, stay with server keys. Person traffic counts against your plan, with the same limits. GET /v1/person/clients lists your registered apps and DELETE /v1/person/clients/{clientId} removes one. Namespaces beginning with u: are reserved for this feature.
Limits
| Plan | Storage and monthly operations | Largest value | Namespaces |
|---|---|---|---|
| Free | 100 MB; 100k reads, 1k writes | 25 KB | 5 |
| Starter | 500 MB; 1M reads, 50k writes | 128 KB | 50 |
| Pro | 5 GB; 10M reads, 500k writes | 256 KB | 500 |
When a limit is reached the API answers 429 quota_exceeded with the limit and your usage, and deleting data frees room at once. Oversized values answer 413 value_too_large.
Errors
Errors are JSON: {"error":{"code":"...","message":"..."}}. Common codes: invalid_api_key (401), insufficient_scope (403), tenant_disabled (403), not_found (404), already_exists (412), not_a_number (409), quota_exceeded (429).