Primitives KV
Key/Value API
Simple state over HTTP. Store and retrieve JSON values by key — no database to provision, no connection strings to manage.
Quickstart
Store and retrieve values in seconds.
1. Set a value
Store any JSON value under a key.
PUT https://api.rocketstack.dev/kv/items/user-123-prefs
{
"value": {
"theme": "dark",
"notifications": true
}
}2. Get a value
Retrieve the stored value by key.
GET https://api.rocketstack.dev/kv/items/user-123-prefs
// Response (data):
{
"key": "user-123-prefs",
"value": { "theme": "dark", ... },
"version": "...",
"expiresAt": null
}3. Delete a value
Remove a key and its value.
DELETE https://api.rocketstack.dev/kv/items/user-123-prefs
// Key is removed immediatelyFeatures
Simple yet powerful key-value storage.
CRUD operations
Get, set, and delete by key. Simple HTTP verbs, predictable behavior.
TTL support
Set expiration on keys. Auto-cleanup for session data, caches, and temp state.
JSON values
Store structured data. Objects, arrays, nested structures — we preserve it all.
Atomic operations
Set-if-not-exists, compare-and-swap. Build safe concurrent workflows.
TTL (Time to Live)
Automatically expire keys after a duration.
Set at T+0 Expires at T+3600 (1 hour)
Set a value with 1-hour TTL
PUT https://api.rocketstack.dev/kv/items/session-abc123
{
"value": {
"userId": "usr_456",
"authenticated": true
},
"ttlSeconds": 3600
}
// The key will automatically expire after 1 hourLimits & Quotas
Generous defaults for most workloads.
| Resource | Limit |
|---|---|
| Key size | 512 bytes |
| Value size | 1 MB |
| Keys per account | 1,000,000 |
| TTL range | 1 second to 365 days |
| Reads per second | 1,000 (soft limit) |
Use Cases
Common patterns for the Key/Value API.
Feature flags
Store feature toggles and roll out changes gradually. Check flags from any service.
Session state
Store user sessions with TTL. Stateless servers, persistent sessions across requests.
Config storage
Centralized configuration for your services. Update once, read from anywhere.
Ready to store your first key?
Get your API key and start storing data in seconds.