Skip to main content
The VelaManagementClient handles all account-level operations. It authenticates with your client secret (vela_cs_...).

Constructor

import { VelaManagementClient } from '@vela/sdk';

const client = new VelaManagementClient(clientSecret: string, options?: VelaClientOptions);
const client = new VelaManagementClient(process.env.VELA_CLIENT_SECRET);
OptionTypeDefaultDescription
baseUrlstringhttps://api.vela.devAPI base URL
timeoutnumber30000Request timeout in ms
fetchImpltypeof fetchglobalThis.fetchCustom fetch implementation

Top-level resources

Apps

const apps = await client.apps.list();
const { app, apiKey } = await client.apps.create({ name: 'My App' });
See the full Apps reference.

App-scoped resources

Schemas, notification rules, and events are scoped to a specific app. Use forApp() to get scoped resource handles:
const appRes = client.forApp('my-app'); // accepts UUID or slug

// Now use scoped resources:
const schemas = await appRes.schemas.list();
const rules = await appRes.notificationRules.list();
const events = await appRes.events.list();
ResourceDescription
appRes.schemasEvent schemas
appRes.notificationRulesNotification rules
appRes.eventsEvent listing

Complete example

import { VelaManagementClient } from '@vela/sdk';

const client = new VelaManagementClient(process.env.VELA_CLIENT_SECRET);

// Create an app
const { app, apiKey } = await client.apps.create({ name: 'Order Service' });

// Define a schema
const appRes = client.forApp(app.slug);
await appRes.schemas.create({
  eventName: 'order.placed',
  fields: [
    { id: 'f1', name: 'orderId', type: 'string', required: true },
    { id: 'f2', name: 'amountCents', type: 'number', required: true },
  ],
});

// Set up alerts
await appRes.notificationRules.create({
  name: 'Alert on errors',
  eventName: 'order.placed',
  conditions: [],
  actions: [
    { id: 'a1', destinationId: '<dest-id>', channel: 'slack', enabled: true },
  ],
});