SmallPlate

Keys API

Key inspection, deletion, expiry management, scanning, and manipulation

The Keys API handles inspection, scan operations, expiry, rename, copy, and deletion.

Endpoints

MethodEndpointDescription
GET/{plateId}/keys/{key}Get metadata and string preview
DELETE/{plateId}/keys/exact/{key}Delete one exact key
POST/{plateId}/keys/deleteDelete many exact keys
POST/{plateId}/keys/ttlSet TTL in milliseconds
DELETE/{plateId}/keys/ttlRemove TTL
POST/{plateId}/keys/{key}/renameRename a key
POST/{plateId}/keys/{key}/copyCopy a key
GET/{plateId}/scanScan keys
POST/{plateId}/keys/commandExecute allowed key commands

Inspection

Get Key Metadata

GET /[id]/keys/mykey

This returns metadata such as:

  • key
  • exists
  • type
  • ttl_ms
  • value for string keys

ttl_ms follows Redis PTTL semantics:

  • -1 means the key exists but has no expiry.
  • -2 means 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/mykey

Delete 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=string

Command Endpoints

POST /[id]/keys/command

Execute allowed key commands across the plate.

Allowed Commands:

CommandDescription
GETGet value
SETSet value
MGETGet multiple values
MSETSet multiple values
DELDelete keys
UNLINKAsync delete keys
EXISTSCheck key existence
TYPEGet key type
RENAMERename key
COPYCopy key
EXPIRESet expiry (seconds)
PEXPIRESet expiry (milliseconds)
TTLGet TTL (seconds)
PTTLGet TTL (milliseconds)
PERSISTRemove expiry

On this page