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

ParameterTypeRequiredDescription
namestringNoHuman-readable label for the key
scope'api' | 'agent' | 'ingest'NoPermission scope (default: api)

Key scopes

ScopePermissions
apiFull read/write access to the Rivano API
agentRead-only access to agents and traces — suitable for observability integrations
ingestWrite-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

ErrorWhen it occurs
SdkAuthErrorThe calling key is invalid
SdkForbiddenErrorInsufficient permissions to manage keys
SdkNotFoundErrorKey ID does not exist