Valta Docs

API Keys SDK

ApiKey type

FieldTypeDescription
idstringKey ID, used to revoke.
namestringHuman-readable label you assigned at creation.
keyPrefixstringFirst few characters of the key (e.g. sk_valta_abc...).
tierstringThe tier this key operates under.
lastUsedstring | nullISO 8601 timestamp of the last authenticated request, or null if never used.
createdAtstringISO 8601 timestamp.

The full key value is never included in list or get responses. It is returned only at creation.


valta.keys.list()

Returns all API keys on your account. Never includes the full key value.

Returns ApiKey[]

ts
import { ValtaClient } from 'valta-sdk'

const valta = new ValtaClient({ apiKey: process.env.VALTA_API_KEY })

const keys = await valta.keys.list()

for (const key of keys) {
  console.log(key.id, key.name, key.keyPrefix, key.lastUsed)
}

valta.keys.create(params)

Creates a new named API key. The full key is returned once only in fullKey. It cannot be retrieved again.

Parameters

FieldTypeRequiredDescription
namestringyesLabel for this key (e.g. production, ci-pipeline).

Returns CreateKeyResponse

FieldTypeDescription
idstringKey ID for future revocation.
namestringThe name you provided.
keyPrefixstringDisplayable prefix.
fullKeystringThe complete API key. Shown once — store immediately.
createdAtstringISO 8601 timestamp.
ts
const result = await valta.keys.create({ name: 'production' })

// Store result.fullKey immediately — it cannot be retrieved again
console.log(result.fullKey) // sk_valta_...
console.log(result.id)      // key_...

Store the fullKey immediately. Once this response is gone, the full key cannot be retrieved again. If you lose it, revoke the key and create a new one.


valta.keys.revoke(keyId)

Permanently revokes a key. Any request using the revoked key will receive 401 UNAUTHORISED immediately. This action cannot be undone.

Returns { success: true }

ts
await valta.keys.revoke('key_...')
// { success: true }
// All subsequent requests with that key return 401

Next steps