Keys API
Key inspection, deletion, expiry management, scanning, and manipulation
The Keys API handles inspection, scan operations, expiry, rename, copy, and deletion.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
| GET | /{plateId}/keys/{key} | Get metadata and string preview |
| DELETE | /{plateId}/keys/exact/{key} | Delete one exact key |
| POST | /{plateId}/keys/delete | Delete many exact keys |
| POST | /{plateId}/keys/ttl | Set TTL in milliseconds |
| DELETE | /{plateId}/keys/ttl | Remove TTL |
| POST | /{plateId}/keys/{key}/rename | Rename a key |
| POST | /{plateId}/keys/{key}/copy | Copy a key |
| GET | /{plateId}/scan | Scan keys |
| POST | /{plateId}/keys/command | Execute allowed key commands |
Inspection
Get Key Metadata
GET /[id]/keys/mykeyThis returns metadata such as:
keyexiststypettl_msvaluefor string keys
ttl_ms follows Redis PTTL semantics:
-1means the key exists but has no expiry.-2means the key does not exist.
const response = await fetch("[base-url]/[id]/keys/mykey", {
headers: { "Authorization": "YOUR_API_KEY" }
});
const data = await response.json();
console.log(data.data);Deletion
Exact Delete vs Pattern Delete
Exact delete:
DELETE /[id]/keys/exact/mykeyDelete many exact keys:
POST /[id]/keys/delete
{
"keys": ["key1", "key2"]
}const response = await fetch("[base-url]/[id]/keys/delete", {
method: "POST",
headers: {
"Authorization": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ keys: ["key1", "key2"] })
});Expiry Management
Set TTL (Time To Live)
POST /[id]/keys/ttl
{
"key": "mykey",
"ttl_ms": 60000
}const response = await fetch("[base-url]/[id]/keys/ttl", {
method: "POST",
headers: {
"Authorization": "YOUR_API_KEY",
"Content-Type": "application/json"
},
body: JSON.stringify({ key: "mykey", ttl_ms: 60000 })
});Scanning
Scan Keys
GET /[id]/scan?cursor=0&count=100&match=user:*Scan with Type Filter
Supported types: string, list, set, zset, hash, stream
GET /[id]/scan?cursor=0&count=100&match=user:*&type=stringCommand Endpoints
POST /[id]/keys/command
Execute allowed key commands across the plate.
Allowed Commands:
| Command | Description |
|---|---|
| GET | Get value |
| SET | Set value |
| MGET | Get multiple values |
| MSET | Set multiple values |
| DEL | Delete keys |
| UNLINK | Async delete keys |
| EXISTS | Check key existence |
| TYPE | Get key type |
| RENAME | Rename key |
| COPY | Copy key |
| EXPIRE | Set expiry (seconds) |
| PEXPIRE | Set expiry (milliseconds) |
| TTL | Get TTL (seconds) |
| PTTL | Get TTL (milliseconds) |
| PERSIST | Remove expiry |