Key-Value Store API

REST API for Redis-based key-value operations.

Base URL

https://api.cloud.tenzro.com/kev

Endpoints

Create Store

POST /kev/stores
Content-Type: application/json
X-Project-ID: proj_xyz
{
"name": "cache",
"description": "Application cache"
}
# Response
{
"kev_store_id": "kev_abc123",
"name": "cache",
"status": "ready",
"created_at": "2024-01-15T00:00:00Z"
}

Set Value

POST /kev/stores/{kev_store_id}/set
Content-Type: application/json
{
"key": "user:123",
"value": { "name": "John", "email": "john@example.com" },
"ttl": 3600
}
# Response
{
"success": true
}

Get Value

GET /kev/stores/{kev_store_id}/get?key=user:123
# Response
{
"key": "user:123",
"value": { "name": "John", "email": "john@example.com" },
"ttl": 3500
}

Delete Key

DELETE /kev/stores/{kev_store_id}/keys/{key}
# Response
{
"deleted": true
}

Batch Get

POST /kev/stores/{kev_store_id}/mget
Content-Type: application/json
{
"keys": ["user:123", "user:456", "user:789"]
}
# Response
{
"values": {
"user:123": { "name": "John" },
"user:456": { "name": "Jane" },
"user:789": null
}
}

Hash Operations

# Set hash field
POST /kev/stores/{kev_store_id}/hset
{
"key": "session:abc",
"field": "user_id",
"value": "123"
}
# Get hash field
GET /kev/stores/{kev_store_id}/hget?key=session:abc&field=user_id
# Get all hash fields
GET /kev/stores/{kev_store_id}/hgetall?key=session:abc

List Keys

GET /kev/stores/{kev_store_id}/keys?pattern=user:*&limit=100
# Response
{
"keys": ["user:123", "user:456"],
"cursor": "next_cursor_value"
}

Increment

POST /kev/stores/{kev_store_id}/incr
{
"key": "counter:visits",
"amount": 1
}
# Response
{
"value": 42
}

Expire

POST /kev/stores/{kev_store_id}/expire
{
"key": "session:abc",
"ttl": 7200
}
# Response
{
"success": true,
"expires_at": "2024-01-15T14:00:00Z"
}

Error Responses

{
"error": {
"code": "key_not_found",
"message": "Key 'user:999' does not exist",
"status": 404
}
}