SDK — API Keys
The rivano.keys resource lets you manage API keys for your tenant. Use scoped keys to limit what CI pipelines, gateway instances, and team members can do.
List keys
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
const { data, total } = await rivano.keys.list();
for (const key of data) {
console.log(`${key.id} [${key.scope}] ${key.name ?? 'unnamed'} — created ${key.createdAt}`);
} The list response returns key metadata — not the key string itself. The full key is only available at creation time.
Create a key
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
const result = await rivano.keys.create({
name: 'ci-pipeline',
scope: 'api',
});
// Store result.key securely — it is never returned again
console.log('Key:', result.key);
console.log('ID:', result.id); ⚠
The key field in the create response is the only time the full key string is returned. Save it immediately to a secret manager. If you lose it, revoke and recreate the key.
Create parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
name | string | No | Human-readable label for the key |
scope | 'api' | 'agent' | 'ingest' | No | Permission scope (default: api) |
Key scopes
| Scope | Permissions |
|---|---|
api | Full read/write access to the Rivano API |
agent | Read-only access to agents and traces — suitable for observability integrations |
ingest | Write-only access to ingest trace data — suitable for gateway instances |
Revoke a key
import Rivano from '@rivano/sdk';
const rivano = new Rivano({ apiKey: 'rv_...' });
await rivano.keys.revoke('key_abc123');
console.log('Key revoked');
Revoking a key is immediate and irreversible. Any service using the revoked key receives 401 responses.
Error handling
| Error | When it occurs |
|---|---|
SdkAuthError | The calling key is invalid |
SdkForbiddenError | Insufficient permissions to manage keys |
SdkNotFoundError | Key ID does not exist |
Related
- SDK Teams — Issue scoped keys to specific teams
- CLI Overview — The CLI uses
~/.rivano/config.jsonfor key storage - Getting Started — Installation — Environment variable configuration