Skip to content
/docs

Admin SDK

VetoAdmin client reference for managing policies, decisions, approvals, tools, and API keys.

VetoAdmin is exported from the main veto-sdk package. Use it for management operations: policies, decisions, approvals, tools, policy drafts, MCP upstreams, and API keys.

import { VetoAdmin } from "veto-sdk";

const admin = new VetoAdmin({
  baseUrl: process.env.VETO_API_URL ?? "https://api.veto.so",
  apiKey: process.env.VETO_API_KEY!,
});

Policies

const policies = await admin.listPolicies({ projectId: "proj_xxx" });
const policy = await admin.getPolicy("issue_refund");

await admin.createPolicy({
  toolName: "issue_refund",
  mode: "deterministic",
  constraints: [
    { argumentName: "amount_usd", action: "deny", maximum: 500 },
  ],
});

await admin.updatePolicy("issue_refund", { /* updated fields */ });
await admin.activatePolicy("issue_refund");
await admin.deactivatePolicy("issue_refund");
await admin.deletePolicy("issue_refund");

Decisions

const page = await admin.listDecisions({ projectId: "proj_xxx", limit: 50 });
const decision = await admin.getDecision("dec_xxx");
const stats = await admin.getDecisionStats({ projectId: "proj_xxx" });

Approvals

const pending = await admin.listPendingApprovals();
const approval = await admin.getApproval("apr_xxx");

await admin.resolveApproval("apr_xxx", { action: "approve", resolvedBy: "user@company.com" });

await admin.batchResolveApprovals({
  approvals: [
    { id: "apr_1", action: "approve", resolvedBy: "user@company.com" },
    { id: "apr_2", action: "deny",    resolvedBy: "user@company.com" },
  ],
});

Tools

const tools = await admin.listTools();
await admin.deleteTool("old_tool_name");

Policy Drafts

const drafts = await admin.listPolicyDrafts({ status: "pending" });
const draft = await admin.getPolicyDraft("draft_xxx");

await admin.approvePolicyDraft("draft_xxx");
await admin.rejectPolicyDraft("draft_xxx", "Scope too broad");

MCP Upstreams

const upstreams = await admin.listUpstreams();

const upstream = await admin.createUpstream({
  name: "my-mcp-server",
  url: "http://localhost:3000/mcp",
  transport: "mcp-sse",
});

const result = await admin.testUpstream(upstream.id);
await admin.deleteUpstream(upstream.id);

API Keys

const keys = await admin.listApiKeys();

const created = await admin.createApiKey({
  name: "prod-agent",
  projectId: "proj_xxx",
});

console.log(created.key); // shown once only

await admin.revokeApiKey("key_xxx");

Organizations and Projects

Read-only via API key:

const { data: orgs } = await admin.listOrganizations();
const { data: projects } = await admin.listProjects({ organizationId: "org_xxx" });