rpc-admin is a command-line utility for managing API keys used by sol-rpc-router. All keys are stored in Redis and support per-key rate limiting, owner tracking, and active/inactive status.
Global Options
Redis connection URL. Can also be set via
REDIS_URL environment variable.Commands
create
Create a new API key with configurable rate limits and optional expiration.Owner identifier for the key (e.g.,
client-name, project-id). Used for tracking and metrics.Rate limit in requests per second (RPS).
Expiration timestamp (Unix epoch seconds). Optional.
Custom API key value. If omitted, a random 32-character alphanumeric key is generated.
Examples
Output
Redis Storage
Keys are stored as Redis hashes with the following structure:list
List all API keys with owner and active status.Example Output
inspect
View detailed information about a specific API key.The API key to inspect.
Example
Output
revoke
Revoke an API key by marking it as inactive. The key remains in Redis but authentication will fail.The API key to revoke.
Example
Output
Implementation Details
Revocation sets theactive field to "false" in Redis:
api_keys_index set and can be reactivated using the update command.
update
Update properties of an existing API key.The API key to update.
New rate limit in requests per second.
New owner identifier.
Set to
true to activate or false to deactivate the key.Examples
Output
Environment Variables
Alternative to
--redis-url flag. The flag takes precedence if both are set.Redis Key Schema
API Key Hash
Each API key is stored as a Redis hash atapi_key:<key_value>:
| Field | Type | Description |
|---|---|---|
owner | string | Owner identifier |
rate_limit | number | Requests per second limit |
created_at | number | Unix timestamp of creation |
active | string | "true" or "false" |
expires_at | number | Optional Unix timestamp |
Index Set
All keys are tracked in a Redis set:list command to enumerate all keys efficiently.
Caching Behavior
The caching behavior includes:Cache Duration
Cache Duration
API key metadata is cached for 60 seconds (TTL). After the TTL expires, the next request will fetch fresh data from Redis.
Eventual Consistency
Eventual Consistency
Multiple router instances share the same Redis backend but maintain independent caches. Changes made via
rpc-admin will be eventually consistent across all instances within 60 seconds.Cache Invalidation
Cache Invalidation
There is no manual cache invalidation. To force immediate enforcement of key changes:
- Restart the router (recommended for critical changes)
- Wait up to 60 seconds for the cache to expire naturally