# Agents
Source: https://docs.veto.tools/api-reference/agents
Create, list, get, update, and delete agents via the REST API.
An agent represents an AI system that Veto authorizes on behalf of. Every authorization request is scoped to a specific agent, and policies are attached to agents.
## The agent object
UUID uniquely identifying the agent.
Human-readable name for the agent.
Optional description of the agent's purpose.
Current status of the agent. One of `"active"`, `"suspended"`, or `"revoked"`. Only `"active"` agents can receive `"allowed"` authorization decisions.
ISO 8601 timestamp of when the agent was created.
ISO 8601 timestamp of the last update.
***
## POST /v1/agents
Create a new agent in your workspace.
Requires an API key with `admin` scope.
Human-readable name for the agent. Must be between 1 and 255 characters.
Optional description. Maximum 2,000 characters.
Returns the created agent object with HTTP `201`.
```bash cURL theme={null}
curl -X POST https://api.veto.tools/v1/agents \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Email assistant",
"description": "Handles inbox triage and draft responses"
}'
```
```typescript Node.js theme={null}
const agent = await veto.createAgent({
name: 'Email assistant',
description: 'Handles inbox triage and draft responses',
});
```
```json 201 theme={null}
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Email assistant",
"description": "Handles inbox triage and draft responses",
"status": "active",
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z"
}
```
***
## GET /v1/agents
List all agents in your workspace.
Maximum number of agents to return. Must be between 1 and 200.
Number of agents to skip. Use with `limit` for pagination.
Returns a paginated envelope with an array of agent objects.
```bash cURL theme={null}
curl "https://api.veto.tools/v1/agents?limit=50&offset=0" \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
const agents = await veto.listAgents();
```
```json 200 theme={null}
{
"data": [
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Email assistant",
"description": "Handles inbox triage and draft responses",
"status": "active",
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z"
}
],
"pagination": {
"limit": 50,
"offset": 0,
"count": 1,
"total": 1
}
}
```
***
## GET /v1/agents/:id
Retrieve a single agent by UUID.
Returns the agent object, or `404` with `AGENT_NOT_FOUND` if it does not exist in your workspace.
```bash cURL theme={null}
curl https://api.veto.tools/v1/agents/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
const agent = await veto.getAgent('550e8400-e29b-41d4-a716-446655440000');
```
```json 200 theme={null}
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Email assistant",
"description": "Handles inbox triage and draft responses",
"status": "active",
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z"
}
```
***
## PATCH /v1/agents/:id
Update an existing agent. All fields are optional — only the fields you include are updated.
Requires an API key with `admin` scope.
New name for the agent. Must be between 1 and 255 characters.
New description. Set to `null` to clear it. Maximum 2,000 characters.
New status. One of `"active"`, `"suspended"`, or `"revoked"`.
Setting status to `"suspended"` or `"revoked"` immediately causes all subsequent authorization requests for this agent to be denied without policy evaluation.
Returns the updated agent object.
```bash cURL theme={null}
curl -X PATCH https://api.veto.tools/v1/agents/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{ "status": "suspended" }'
```
```json 200 theme={null}
{
"id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Email assistant",
"description": "Handles inbox triage and draft responses",
"status": "suspended",
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T11:00:00.000Z"
}
```
***
## DELETE /v1/agents/:id
Permanently delete an agent. This cascades to all policies and audit logs associated with the agent.
Requires an API key with `admin` scope.
Returns `204 No Content` on success.
```bash cURL theme={null}
curl -X DELETE https://api.veto.tools/v1/agents/550e8400-e29b-41d4-a716-446655440000 \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
await veto.deleteAgent('550e8400-e29b-41d4-a716-446655440000');
```
# API keys
Source: https://docs.veto.tools/api-reference/api-keys
Create, list, and revoke API keys via the REST API.
API keys authenticate requests to the Veto API. Each key is scoped to a workspace and carries a set of permission scopes.
All API key management endpoints require an API key with `admin` scope.
## The API key object
UUID uniquely identifying the key.
Human-readable name for the key.
The first 12 characters of the raw key (e.g. `veto_a1b2c3d4`). Use this to identify which key was used — it is safe to display and log.
Permission scopes granted to this key. `["admin"]` grants full access. `["read-only"]` restricts to non-mutating endpoints.
ISO 8601 expiration date, or `null` if the key never expires.
ISO 8601 timestamp of the most recent authenticated request, or `null` if the key has never been used. Only available on list responses.
ISO 8601 timestamp of when the key was created.
***
## POST /v1/api-keys
Create a new API key for your workspace.
The raw API key is returned **only once** in the creation response. Store it immediately in a secure secrets manager — you cannot retrieve it again. Only the prefix is stored by Veto.
Human-readable name to identify this key. Must be between 1 and 255 characters.
Permission scopes for the key. Use `["admin"]` for full access or `["read-only"]` for read-only access.
Optional expiration date as an ISO 8601 datetime string. If omitted, the key never expires.
Returns `201` with the key metadata **and the raw key**. The `key` field is not included in any subsequent responses.
```bash cURL theme={null}
curl -X POST https://api.veto.tools/v1/api-keys \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{
"name": "Production worker",
"scopes": ["admin"],
"expiresAt": "2027-01-01T00:00:00.000Z"
}'
```
```json 201 theme={null}
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Production worker",
"prefix": "veto_a1b2c3",
"scopes": ["admin"],
"expiresAt": "2027-01-01T00:00:00.000Z",
"createdAt": "2026-01-15T10:00:00.000Z",
"key": "veto_a1b2c3d4e5f6g7h8i9j0k1l2m3n4o5p6"
}
```
***
## GET /v1/api-keys
List all API keys in your workspace. The raw key and its hash are never included in list responses.
Maximum number of keys to return. Must be between 1 and 200.
Number of keys to skip.
Returns a paginated envelope with key metadata objects.
```bash cURL theme={null}
curl https://api.veto.tools/v1/api-keys \
-H "Authorization: Bearer veto_..."
```
```json 200 theme={null}
{
"data": [
{
"id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
"name": "Production worker",
"prefix": "veto_a1b2c3",
"scopes": ["admin"],
"expiresAt": "2027-01-01T00:00:00.000Z",
"lastUsedAt": "2026-01-15T10:30:00.000Z",
"createdAt": "2026-01-15T10:00:00.000Z"
}
],
"pagination": {
"limit": 100,
"offset": 0,
"count": 1,
"total": 1
}
}
```
***
## DELETE /v1/api-keys/:id
Revoke an API key. The key is permanently deleted and will no longer authenticate requests. This action cannot be undone.
Returns `204 No Content` on success.
```bash cURL theme={null}
curl -X DELETE https://api.veto.tools/v1/api-keys/a1b2c3d4-e5f6-7890-abcd-ef1234567890 \
-H "Authorization: Bearer veto_..."
```
# Audit logs
Source: https://docs.veto.tools/api-reference/audit-logs
Query and export the audit log of all authorization decisions.
Every call to `/v1/authorize` produces an audit log entry, regardless of the outcome. The audit log is append-only and scoped to your workspace.
Audit log entries cannot be deleted via the API. The log is append-only to preserve a complete, tamper-evident record of authorization decisions.
## The audit log entry object
UUID uniquely identifying this log entry.
UUID of the agent that made the authorization request.
The action type recorded. For authorization decisions this is always `"authorize"`.
The tool name that was evaluated.
The parameters from the authorization request, with sensitive keys redacted to `"[REDACTED]"`. Redacted key names include: `password`, `secret`, `token`, `key`, `credential`, `authorization`, `api_key`, `apiKey`, `access_token`, `refresh_token`.
The authorization outcome. One of `"allowed"` or `"denied"`.
UUID of the policy that produced this decision. `null` when the default-deny rule applied.
Human-readable explanation of the decision.
Time in milliseconds from when the request was received to when the decision was produced.
ISO 8601 timestamp of when the authorization was evaluated.
***
## GET /v1/audit-logs
Query audit logs with optional filters. Results are returned in reverse chronological order.
Requires an API key with `admin` scope.
Filter by agent UUID.
Filter by action type (e.g. `"authorize"`).
Filter by exact tool name.
Filter by outcome. One of `"allowed"` or `"denied"`.
Start of the time range. ISO 8601 datetime string.
End of the time range. ISO 8601 datetime string.
Maximum number of entries to return. Must be between 1 and 1,000.
Number of entries to skip.
Returns a paginated envelope with an array of audit log entries.
```bash cURL theme={null}
curl "https://api.veto.tools/v1/audit-logs?agent_id=550e8400-e29b-41d4-a716-446655440000&result=denied&limit=25" \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
const { data, pagination } = await veto.queryAuditLog({
agentId: '550e8400-e29b-41d4-a716-446655440000',
result: 'denied',
limit: 25,
});
```
```json 200 theme={null}
{
"data": [
{
"id": "7c9e6679-7425-40de-944b-e07fc1f90ae7",
"agentId": "550e8400-e29b-41d4-a716-446655440000",
"action": "authorize",
"toolName": "file.write",
"parameters": { "path": "/etc/passwd" },
"result": "denied",
"policyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reason": "Parameter \"path\" value \"/etc/passwd\" does not match pattern /^\\/home\\//",
"latencyMs": 12,
"timestamp": "2026-01-15T10:30:00.000Z"
}
],
"pagination": {
"limit": 25,
"offset": 0,
"count": 1,
"total": 1
}
}
```
***
## GET /v1/audit-logs/export
Export audit logs as a CSV file. Accepts the same filter parameters as `GET /v1/audit-logs` (without `limit` and `offset`) and exports up to **5,000 rows**.
Requires an API key with `admin` scope.
Filter by agent UUID.
Filter by action type.
Filter by exact tool name.
Filter by outcome. One of `"allowed"` or `"denied"`.
Start of the time range. ISO 8601 datetime string.
End of the time range. ISO 8601 datetime string.
The response is a CSV file with the following columns:
```
Timestamp, Agent ID, Tool, Result, Reason, Latency (ms), Parameters
```
Response headers:
| Header | Description |
| ------------------------- | --------------------------------------------------------------- |
| `Content-Type` | `text/csv` |
| `Content-Disposition` | `attachment; filename="veto-audit-log-.csv"` |
| `X-Veto-Export-Truncated` | `"true"` if the result set was truncated to the 5,000-row limit |
| `X-Veto-Export-Limit` | `"5000"` — present when `X-Veto-Export-Truncated` is set |
If `X-Veto-Export-Truncated: true` is present, narrow your query using `from` and `to` filters to retrieve the full dataset across multiple exports.
```bash cURL theme={null}
curl "https://api.veto.tools/v1/audit-logs/export?agent_id=550e8400-e29b-41d4-a716-446655440000&result=denied" \
-H "Authorization: Bearer veto_..." \
-o veto-audit.csv
```
# Authorize
Source: https://docs.veto.tools/api-reference/authorize
Check if an agent is authorized to call a specific tool with given parameters.
The authorize endpoint is the core of Veto. Call it **before every tool execution** to get an allow/deny decision. Veto evaluates all active policies for the agent and returns the result in a single synchronous response.
## POST /v1/authorize
UUID of the agent making the tool call.
Name of the tool being invoked. Can be any string up to 255 characters — use a consistent naming convention across your application (e.g. `file.write`, `send_email`, `db.query`).
The parameters being passed to the tool. Used for parameter constraint evaluation in policies. The total serialized size of this object must not exceed 64 KB.
Keys matching sensitive patterns (`password`, `secret`, `token`, `key`, `credential`, `authorization`, `api_key`, `apiKey`, `access_token`, `refresh_token`) are automatically redacted to `"[REDACTED]"` before being stored in the audit log.
```bash cURL theme={null}
curl -X POST https://api.veto.tools/v1/authorize \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"tool_name": "file.write",
"parameters": { "path": "/home/user/doc.txt", "content": "Hello" }
}'
```
```typescript Node.js theme={null}
const result = await veto.authorize(
'550e8400-e29b-41d4-a716-446655440000',
'file.write',
{ path: '/home/user/doc.txt', content: 'Hello' }
);
if (!result.allowed) {
throw new Error(`Blocked: ${result.reason}`);
}
```
## Response
Returns an `AuthorizationResult` object.
`true` if the action is permitted, `false` otherwise. This is the primary field to branch on.
The authorization decision. One of `"allowed"` or `"denied"`.
UUID of the policy that produced this decision. `null` when the agent has no matching policy and the default-deny rule applies.
Human-readable explanation of the decision. Useful for logging and surfacing context to users.
ISO 8601 timestamp of when the evaluation was performed.
```json Allowed theme={null}
{
"allowed": true,
"outcome": "allowed",
"matchedPolicyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reason": "Allowed by policy \"Safe file operations\"",
"evaluatedAt": "2026-01-15T10:30:00.000Z"
}
```
```json Denied (no matching policy) theme={null}
{
"allowed": false,
"outcome": "denied",
"matchedPolicyId": null,
"reason": "No policy explicitly allows this action (default deny)",
"evaluatedAt": "2026-01-15T10:30:00.000Z"
}
```
```json Denied (parameter constraint) theme={null}
{
"allowed": false,
"outcome": "denied",
"matchedPolicyId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"reason": "Parameter \"path\" value \"/etc/passwd\" does not match pattern /^\\/home\\//",
"evaluatedAt": "2026-01-15T10:30:00.000Z"
}
```
## Agent status behavior
Veto checks the agent's status before evaluating any policies:
* **`active`** — normal policy evaluation proceeds.
* **`suspended`** — all requests are immediately denied. No policies are evaluated.
* **`revoked`** — all requests are immediately denied. No policies are evaluated.
To re-enable a suspended agent, update its status to `"active"` via [PATCH /v1/agents/:id](/api-reference/agents).
## Default deny
If no enabled policy matches the tool call, Veto denies the request. Authorization requires an explicit allow — there is no implicit permission.
## Audit logging
Every call to `/v1/authorize` is recorded in the audit log, including denied requests. If the audit log write fails (for example, due to a database error), the authorization decision is still returned — but the response will include:
```
X-Veto-Audit: failed
```
This header signals a compliance gap: the decision was made but not recorded. Your integration should monitor for this header if audit trail completeness is a requirement.
# Errors
Source: https://docs.veto.tools/api-reference/errors
Error codes, HTTP status codes, and how to handle errors from the Veto API.
All errors from the Veto API use the same response envelope:
```json theme={null}
{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent not found in this workspace"
}
}
```
`code` is a machine-readable string you can match against in code. `message` is a human-readable description of the problem.
## Error codes
| HTTP status | Code | Meaning |
| ----------- | ------------------- | --------------------------------------------------- |
| `400` | `VALIDATION_ERROR` | Request body or query parameters failed validation |
| `401` | `UNAUTHORIZED` | Missing or invalid API key |
| `403` | `FORBIDDEN` | Valid key but insufficient scope for this operation |
| `404` | `AGENT_NOT_FOUND` | Agent does not exist in this workspace |
| `404` | `POLICY_NOT_FOUND` | Policy does not exist |
| `404` | `API_KEY_NOT_FOUND` | API key does not exist |
| `429` | `RATE_LIMITED` | Rate limit exceeded |
| `500` | `INTERNAL_ERROR` | Internal server error |
## Rate limit errors
When you receive a `429`, the response includes a `Retry-After` header with the number of seconds until the rate limit window resets:
```
HTTP/1.1 429 Too Many Requests
Retry-After: 34
```
Wait the indicated number of seconds before retrying.
## SDK error handling
### Node.js
The Veto Node.js SDK exposes three error classes:
* **`VetoError`** — base class for all Veto errors. Has `.code` (string) and `.statusCode` (number).
* **`UnauthorizedError`** — thrown on `401` responses. Extends `VetoError`.
* **`RateLimitError`** — thrown on `429` responses. Extends `VetoError`. Has `.retryAfterMs` (milliseconds until reset).
```typescript theme={null}
import { VetoClient, VetoError, UnauthorizedError, RateLimitError } from '@useveto/node';
const veto = new VetoClient({ apiKey: 'veto_...' });
try {
const result = await veto.authorize('agent-uuid', 'file.write', { path: '/tmp/out.txt' });
} catch (err) {
if (err instanceof RateLimitError) {
// Wait the indicated time then retry
await sleep(err.retryAfterMs);
retry();
} else if (err instanceof UnauthorizedError) {
// API key is missing or invalid
console.error('Check your API key:', err.message);
} else if (err instanceof VetoError) {
// Any other Veto API error
console.error(`API error ${err.statusCode} [${err.code}]:`, err.message);
} else {
throw err;
}
}
```
### Python
```python theme={null}
from veto import VetoClient, VetoError, UnauthorizedError, RateLimitError
import time
client = VetoClient(api_key="veto_...")
try:
result = client.authorize("agent-uuid", "file.write", {"path": "/tmp/out.txt"})
except RateLimitError as e:
# e.retry_after_ms contains milliseconds until reset
time.sleep(e.retry_after_ms / 1000)
except UnauthorizedError as e:
print("Check your API key:", e.message)
except VetoError as e:
print(f"API error {e.status_code} [{e.code}]: {e.message}")
```
# API overview
Source: https://docs.veto.tools/api-reference/overview
Base URL, authentication, request format, and pagination for the Veto REST API.
## Base URL
All API requests are made to:
```
https://api.veto.tools
```
Every endpoint is prefixed with `/v1/`. For example:
```
https://api.veto.tools/v1/agents
```
## Authentication
Include your API key as a Bearer token in the `Authorization` header on every request:
```
Authorization: Bearer veto_
```
API keys are prefixed with `veto_`. You can create and manage keys via the [API Keys](/api-reference/api-keys) endpoints or the Veto dashboard.
## Request format
All request bodies must be JSON. Set the `Content-Type` header accordingly:
```
Content-Type: application/json
```
## Rate limits
The API allows **600 requests per minute** per API key. Every response includes the following headers:
| Header | Description |
| ----------------------- | ---------------------------------------- |
| `X-RateLimit-Limit` | Maximum requests allowed per minute |
| `X-RateLimit-Remaining` | Requests remaining in the current window |
When you exceed the limit, the API returns `429 Too Many Requests` with a `Retry-After` header indicating how many seconds to wait before retrying.
## Example request
```bash theme={null}
curl https://api.veto.tools/v1/agents \
-H "Authorization: Bearer veto_..."
```
## Pagination
List endpoints return a paginated envelope:
```json theme={null}
{
"data": [...],
"pagination": {
"limit": 50,
"offset": 0,
"count": 10,
"total": 42
}
}
```
| Field | Description |
| ------------------- | ------------------------------------------------- |
| `data` | Array of results for the current page |
| `pagination.limit` | Maximum results requested |
| `pagination.offset` | Number of results skipped |
| `pagination.count` | Number of results in this page |
| `pagination.total` | Total number of matching results across all pages |
Use `limit` and `offset` query parameters to paginate through results.
## Error responses
Errors follow a consistent shape:
```json theme={null}
{
"error": {
"code": "AGENT_NOT_FOUND",
"message": "Agent not found in this workspace"
}
}
```
See the [Errors](/api-reference/errors) page for a full list of error codes.
## HTTP status codes
| Code | Meaning |
| ----- | ----------------------------------------- |
| `200` | Success |
| `201` | Resource created |
| `204` | Success, no content (e.g. after a delete) |
| `400` | Bad request — validation error |
| `401` | Unauthorized — missing or invalid API key |
| `403` | Forbidden — valid key, insufficient scope |
| `404` | Not found |
| `429` | Rate limit exceeded |
| `500` | Internal server error |
# Policies
Source: https://docs.veto.tools/api-reference/policies
Create, list, get, update, and delete policies via the REST API.
Policies define what an agent is allowed to do. Each policy is attached to a single agent and contains one or more rules. When `/v1/authorize` is called, Veto evaluates all enabled policies for the agent in priority order and returns the first matching decision.
## The policy object
UUID uniquely identifying the policy.
UUID of the agent this policy applies to.
Human-readable name for the policy.
Array of rules. At least one rule is required. Maximum 50 rules per policy.
Rule type. One of:
* `"tool_allowlist"` — explicitly allow the listed tools
* `"tool_denylist"` — explicitly deny the listed tools
* `"parameter_constraint"` — enforce constraints on parameter values
* `"rate_limit"` — limit how many times tools can be called in a time window
* `"time_based"` — restrict tool use to specific hours or days
Tool names this rule applies to. Supports glob patterns (e.g. `"calendar.*"`). Omit or use `["*"]` to match all tools.
Parameter constraints, keyed by parameter name. Each constraint may include:
* `regex` — value must match this regular expression (max 128 characters)
* `enum` — value must be one of the listed strings (max 100 entries)
* `min` — numeric minimum (inclusive)
* `max` — numeric maximum (inclusive)
Required when `type` is `"rate_limit"`.
* `maxCalls` (integer, 1–1,000,000) — maximum allowed calls in the window
* `windowSeconds` (integer, 1–86400) — time window duration in seconds
Required when `type` is `"time_based"`.
* `allowedHours` — array of allowed hours (0–23)
* `allowedDays` — array of allowed days (0=Sunday, 6=Saturday)
* `timezone` — IANA timezone string (e.g. `"America/Chicago"`)
Evaluation order. Higher values are evaluated first. Defaults to `0`.
Whether this policy is active. Disabled policies are skipped during evaluation.
ISO 8601 timestamp of creation.
ISO 8601 timestamp of the last update.
***
## POST /v1/policies
Create a new policy.
Requires an API key with `admin` scope.
UUID of the agent this policy applies to. The agent must exist in your workspace.
Descriptive name for the policy. Must be between 1 and 255 characters.
Array of policy rules. Minimum 1, maximum 50. See the policy object above for the `PolicyRule` schema.
Evaluation order relative to other policies for this agent. Higher values are evaluated first. Must be an integer between 0 and 1,000.
Whether the policy is active immediately on creation.
Returns the created policy object with HTTP `201`.
```bash cURL theme={null}
curl -X POST https://api.veto.tools/v1/policies \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{
"agent_id": "550e8400-e29b-41d4-a716-446655440000",
"name": "Allow file reads with rate limit",
"priority": 10,
"rules": [
{
"type": "tool_allowlist",
"tools": ["file.read", "file.list"]
},
{
"type": "rate_limit",
"tools": ["file.read"],
"rateLimit": { "maxCalls": 1000, "windowSeconds": 3600 }
}
]
}'
```
```typescript Node.js theme={null}
const policy = await veto.createPolicy({
agentId: '550e8400-e29b-41d4-a716-446655440000',
name: 'Allow file reads with rate limit',
priority: 10,
rules: [
{ type: 'tool_allowlist', tools: ['file.read', 'file.list'] },
{
type: 'rate_limit',
tools: ['file.read'],
rateLimit: { maxCalls: 1000, windowSeconds: 3600 },
},
],
});
```
```json 201 theme={null}
{
"id": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
"agentId": "550e8400-e29b-41d4-a716-446655440000",
"name": "Allow file reads with rate limit",
"priority": 10,
"enabled": true,
"rules": [
{
"type": "tool_allowlist",
"tools": ["file.read", "file.list"]
},
{
"type": "rate_limit",
"tools": ["file.read"],
"rateLimit": { "maxCalls": 1000, "windowSeconds": 3600 }
}
],
"createdAt": "2026-01-15T10:00:00.000Z",
"updatedAt": "2026-01-15T10:00:00.000Z"
}
```
***
## GET /v1/policies
List policies in your workspace.
Filter by agent UUID. Returns only policies attached to this agent.
Maximum number of policies to return. Must be between 1 and 200.
Number of policies to skip.
Returns a paginated envelope with an array of policy objects.
```bash cURL theme={null}
curl "https://api.veto.tools/v1/policies?agent_id=550e8400-e29b-41d4-a716-446655440000" \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
const policies = await veto.listPolicies('550e8400-e29b-41d4-a716-446655440000');
```
***
## GET /v1/policies/:id
Retrieve a single policy by UUID.
Returns the policy object, or `404` with `POLICY_NOT_FOUND` if it does not exist in your workspace.
```bash cURL theme={null}
curl https://api.veto.tools/v1/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
const policy = await veto.getPolicy('3fa85f64-5717-4562-b3fc-2c963f66afa6');
```
***
## PATCH /v1/policies/:id
Update an existing policy. All fields are optional.
Requires an API key with `admin` scope.
New name for the policy.
Replacement rule set. When provided, replaces the entire `rules` array. Minimum 1, maximum 50.
New priority value. Integer between 0 and 1,000.
Enable or disable the policy. Disabled policies are skipped during evaluation.
Returns the updated policy object.
```bash cURL theme={null}
curl -X PATCH https://api.veto.tools/v1/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{ "enabled": false }'
```
```typescript Node.js theme={null}
const updated = await veto.updatePolicy('3fa85f64-5717-4562-b3fc-2c963f66afa6', {
enabled: false,
});
```
***
## DELETE /v1/policies/:id
Permanently delete a policy.
Requires an API key with `admin` scope.
Returns `204 No Content` on success.
```bash cURL theme={null}
curl -X DELETE https://api.veto.tools/v1/policies/3fa85f64-5717-4562-b3fc-2c963f66afa6 \
-H "Authorization: Bearer veto_..."
```
```typescript Node.js theme={null}
await veto.deletePolicy('3fa85f64-5717-4562-b3fc-2c963f66afa6');
```
# Authentication
Source: https://docs.veto.tools/authentication
How to authenticate with the Veto API using API keys.
Veto uses API keys for authentication. Every request to the Veto API must include a valid key in the `Authorization` header using the Bearer scheme.
## API key format
All Veto API keys are prefixed with `veto_` followed by 32 hex characters:
```
veto_a3f8c2e1d4b79f2e6c1a8d3b5e4f7c2a
```
This prefix makes keys easy to identify in logs, environment variables, and secret scanners.
## Sending the key
Include your key in the `Authorization` header on every request:
```http theme={null}
Authorization: Bearer veto_a3f8c2e1d4b79f2e6c1a8d3b5e4f7c2a
```
### Raw HTTP
```http theme={null}
POST /v1/authorize HTTP/1.1
Host: api.veto.tools
Authorization: Bearer veto_a3f8c2e1d4b79f2e6c1a8d3b5e4f7c2a
Content-Type: application/json
{
"agent_id": "agent_01j...",
"tool_name": "send_email",
"parameters": {
"to": "customer@example.com"
}
}
```
### Node.js SDK
Pass the key to `VetoClient` at construction time. The SDK attaches the `Authorization` header automatically on every request.
```typescript theme={null}
import { VetoClient } from "@useveto/node";
const veto = new VetoClient({
apiKey: process.env.VETO_API_KEY!, // required
endpoint: "https://api.veto.tools", // optional, this is the default
timeout: 5000, // optional, ms (default: 5000)
});
```
Never hardcode your API key in source code. Load it from an environment variable or secrets manager. If a key is compromised, revoke it immediately from **Settings → API Keys** in the dashboard.
## Key scopes
Each API key has one of two scopes:
| Scope | Access |
| ----------- | ----------------------------------------------------------------------------- |
| `admin` | Full access — create, read, update, and delete agents, policies, and API keys |
| `read-only` | Query access — read agents, policies, and audit logs, but no mutations |
The authorization endpoint (`POST /v1/authorize`) works with **both** scopes. For production services that only call `authorize`, use a read-only key to limit the blast radius of a leaked credential.
## Creating API keys
### Dashboard
Go to **Settings → API Keys** and click **New API key**. Give it a name, choose a scope, and optionally set an expiry date.
The raw key is shown **once** at creation and never again. Copy it before closing the dialog. After creation, only the key prefix (e.g., `veto_a3f8c2`) is shown for identification.
### API
You can also create keys programmatically. This requires an existing key with `admin` scope.
```http theme={null}
POST /v1/api-keys HTTP/1.1
Host: api.veto.tools
Authorization: Bearer veto_
Content-Type: application/json
{
"name": "production-service",
"scopes": ["read-only"]
}
```
Response (key shown once):
```json theme={null}
{
"id": "key_01j...",
"name": "production-service",
"prefix": "veto_a3f8c2",
"scopes": ["read-only"],
"expiresAt": null,
"createdAt": "2026-04-08T12:00:00.000Z",
"key": "veto_a3f8c2e1d4b79f2e6c1a8d3b5e4f7c2a"
}
```
To revoke a key, send `DELETE /v1/api-keys/:id` with an admin key.
## Rate limits
The Veto API enforces a limit of **600 requests per minute** per API key. This applies across all endpoints.
Every response includes rate limit headers:
| Header | Description |
| ----------------------- | ---------------------------------------- |
| `X-RateLimit-Limit` | Your limit (requests per minute) |
| `X-RateLimit-Remaining` | Requests remaining in the current window |
| `X-RateLimit-Reset` | Unix timestamp when the window resets |
When you exceed the limit, the API returns `429 Too Many Requests` with a `Retry-After` header indicating how many seconds to wait.
The SDK surfaces this as a `RateLimitError` with a `retryAfterMs` property:
```typescript theme={null}
import { VetoClient, RateLimitError, UnauthorizedError, VetoError } from "@useveto/node";
try {
const result = await veto.authorize(agentId, toolName, parameters);
} catch (error) {
if (error instanceof RateLimitError) {
console.log(`Rate limited. Retry after ${error.retryAfterMs}ms`);
} else if (error instanceof UnauthorizedError) {
console.log("Invalid or missing API key");
} else if (error instanceof VetoError) {
console.log(`API error ${error.statusCode}: ${error.message}`);
}
}
```
## Error reference
| Status | Code | Meaning |
| ----------------------- | -------------- | ---------------------------------------------------------------------------------------------------------------- |
| `401 Unauthorized` | `UNAUTHORIZED` | The API key is missing, malformed, or invalid |
| `403 Forbidden` | `FORBIDDEN` | The key is valid but its scope does not permit this action (e.g., a read-only key attempting to create a policy) |
| `429 Too Many Requests` | `RATE_LIMITED` | The per-minute request limit has been exceeded. Check the `Retry-After` response header |
# Agents
Source: https://docs.veto.tools/concepts/agents
Understanding agents in Veto — what they are, how they're managed, and their lifecycle.
An agent is an AI actor — a bot, workflow, LLM-based tool, or any automated system — that you register with Veto so its tool calls can be authorized at runtime.
Before Veto can make an authorization decision for an actor, that actor must be registered as an agent. Requests from unknown agent IDs are rejected with a 404.
## Agent fields
```typescript theme={null}
interface Agent {
id: string;
name: string;
description: string | null;
status: "active" | "suspended" | "revoked";
createdAt: string;
updatedAt: string;
}
```
## Agent status
Every agent has a `status` that controls whether it can make authorized tool calls.
The agent can make tool calls. Each call is evaluated against the agent's attached policies to determine whether it is allowed or denied.
All authorization requests from this agent are immediately denied, regardless of policies. Use suspension for temporary holds — you can reactivate a suspended agent.
All authorization requests are denied, same as suspended. Revocation is intended to be permanent. A revoked agent cannot be reactivated through normal flows.
When an agent is suspended or revoked, Veto short-circuits policy evaluation entirely and returns `denied` without inspecting any rules. No policy can override a non-active status.
## Workspace scoping
Agents are scoped to your workspace. An agent ID from one workspace cannot be used to authorize calls in another. This isolation is enforced on every authorization request.
## Creating an agent
You can create agents from the Veto dashboard or programmatically via the API or Node.js SDK.
```typescript theme={null}
import { VetoClient } from "@useveto/node";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
const agent = await veto.createAgent({
name: "support-bot",
description: "Customer support agent",
});
console.log(agent.id); // Use this ID when calling veto.authorize(...)
```
## Attaching policies
An agent on its own has no permissions — Veto defaults to denying all tool calls for agents with no matching policies. To allow an agent to do anything, attach at least one [policy](/concepts/policies) with an explicit allowlist rule.
A single agent can have multiple policies attached to it. See [Policies](/concepts/policies) for how evaluation order and priority work.
# Audit Log
Source: https://docs.veto.tools/concepts/audit-log
Every authorization decision Veto makes is logged and queryable.
Every call to `POST /v1/authorize` creates an immutable audit log entry. The audit log gives you a complete record of what your agents tried to do, what was allowed or denied, and why.
## Audit log entries
```typescript theme={null}
interface AuditLogEntry {
id: string;
agentId: string;
action: string;
toolName: string;
parameters: Record;
result: "allowed" | "denied";
policyId: string | null;
reason: string;
latencyMs: number;
timestamp: string;
}
```
Each entry captures:
| Field | Description |
| ------------ | ---------------------------------------------------------------- |
| `agentId` | The agent that made the request |
| `toolName` | The tool the agent attempted to call |
| `parameters` | The parameters passed with the call (sensitive values redacted) |
| `result` | The authorization outcome: `allowed` or `denied` |
| `policyId` | The policy that produced the decision, or `null` if default deny |
| `reason` | A human-readable explanation of the decision |
| `latencyMs` | Time taken to evaluate the request, in milliseconds |
| `timestamp` | When the authorization request was received (ISO 8601) |
## Sensitive parameter redaction
Before parameters are written to the audit log, Veto automatically redacts values whose keys match any of the following patterns:
`password`, `secret`, `token`, `key`, `credential`, `authorization`, `api_key`, `apiKey`, `access_token`, `refresh_token`
Matched values are replaced with `"[REDACTED]"`. This applies to both top-level keys and nested object keys.
## Example log entry
```json theme={null}
{
"id": "log_01j9xkqp4c8tz6wm3r7nvs5b",
"agentId": "agt_01j9xkqp4c8tz6wm3r7nvs5a",
"action": "authorize",
"toolName": "file.write",
"parameters": {
"path": "/tmp/output.txt",
"content": "Hello, world!",
"api_key": "[REDACTED]"
},
"result": "denied",
"policyId": "pol_01j9xkqp4c8tz6wm3r7nvs5c",
"reason": "Parameter \"path\" value \"/tmp/output.txt\" does not match pattern /^\\/home\\//",
"latencyMs": 12,
"timestamp": "2026-04-08T14:32:01.000Z"
}
```
## Append-only
The audit log is append-only. Entries cannot be deleted or modified via the API. This ensures your audit trail is tamper-evident and suitable for compliance purposes.
## Querying the audit log
Use the Node.js SDK or the API to filter and page through audit log entries.
```typescript theme={null}
import { VetoClient } from "@useveto/node";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
const logs = await veto.queryAuditLog({
agentId: "agt_01j9xkqp4c8tz6wm3r7nvs5a",
result: "denied",
limit: 50,
});
console.log(logs.data); // array of AuditLogEntry
console.log(logs.pagination); // { limit, offset, count, total }
```
Available filters:
| Filter | Type | Description |
| ---------- | ------------------------- | --------------------------------------------- |
| `agentId` | string | Only entries for this agent |
| `toolName` | string | Only entries for this tool name (exact match) |
| `result` | `"allowed"` \| `"denied"` | Filter by outcome |
| `from` | ISO date string | Entries at or after this timestamp |
| `to` | ISO date string | Entries at or before this timestamp |
| `limit` | number | Number of entries to return |
| `offset` | number | Pagination offset |
Results are always returned in reverse chronological order (newest first).
## Exporting to CSV
You can export audit log entries as a CSV file via `GET /v1/audit-logs/export`. The export supports the same filters as the query endpoint and returns up to **5,000 rows** per request.
The CSV includes the following columns: `Timestamp`, `Agent ID`, `Tool`, `Result`, `Reason`, `Latency (ms)`, `Parameters`.
If the export is truncated because there are more than 5,000 matching entries, the response includes an `X-Veto-Export-Truncated: true` header. Narrow your filters (for example, reduce the date range) to export the full dataset in multiple requests.
## Dashboard
The Veto dashboard provides a searchable, filterable view of your audit log. You can filter by agent, tool name, result, and date range without writing any code.
# Policies
Source: https://docs.veto.tools/concepts/policies
How Veto policies govern what agents are allowed to do.
A policy is a named set of [rules](/concepts/rules) attached to a specific agent. When an agent makes a tool call, Veto evaluates that agent's policies to decide whether to allow or deny the request.
## Policy fields
```typescript theme={null}
interface Policy {
id: string;
agentId: string;
name: string;
rules: PolicyRule[];
priority: number;
enabled: boolean;
createdAt: string;
updatedAt: string;
}
```
## Default deny
Veto uses a **default deny** model. If no enabled policy explicitly allows a tool call, the request is denied — even if no rule explicitly blocks it either.
This means an agent with no policies attached, or only disabled policies, can make no tool calls at all.
## Priority
When an agent has multiple policies, they are evaluated in descending priority order — **higher number = evaluated first**.
The first policy that produces a definitive match wins. Evaluation stops there; subsequent lower-priority policies are not checked.
**Example:** An agent has two policies:
| Policy | Priority | Purpose |
| --------------------- | -------- | ----------------------------------------- |
| Block dangerous tools | 10 | Denylists `system.exec` and `file.delete` |
| Allow safe tools | 0 | Allowlists `file.read` and `web.search` |
When the agent calls `system.exec`, the "Block dangerous tools" policy (priority 10) is evaluated first and immediately denies the request. The "Allow safe tools" policy is never reached.
When the agent calls `file.read`, "Block dangerous tools" is still evaluated first. The denylist rule doesn't match `file.read`, so it doesn't produce a definitive decision. Evaluation continues to "Allow safe tools", which allowlists `file.read` and returns `allowed`.
## Enabled and disabled policies
Setting `enabled: false` on a policy causes it to be skipped entirely during evaluation. Disabling a policy is useful for temporarily suspending a set of rules without deleting them.
## Multiple policies per agent
You can layer multiple policies on a single agent using priority:
* Put narrow deny rules at higher priority to block specific tools first
* Put broader allow rules at lower priority as a baseline
* Add constraint or rate-limit policies at intermediate priorities
## Creating a policy
```typescript theme={null}
import { VetoClient } from "@useveto/node";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
const policy = await veto.createPolicy({
agentId: "agt_123",
name: "Allow safe tools",
priority: 0,
enabled: true,
rules: [
{
type: "tool_allowlist",
tools: ["file.read", "web.search"],
},
{
type: "rate_limit",
tools: ["web.search"],
rateLimit: { maxCalls: 100, windowSeconds: 3600 },
},
],
});
```
See [Rules](/concepts/rules) for a full reference on every rule type you can include.
# Rules
Source: https://docs.veto.tools/concepts/rules
The five rule types you can use in Veto policies.
Rules are the building blocks of [policies](/concepts/policies). Each rule defines a specific condition that must be satisfied for a tool call to proceed. A policy can contain multiple rules of different types.
```typescript theme={null}
interface PolicyRule {
type: "tool_allowlist" | "tool_denylist" | "parameter_constraint" | "rate_limit" | "time_based";
tools?: string[]; // which tools this rule applies to (supports trailing wildcard)
parameters?: Record;
rateLimit?: RateLimitConfig;
timeWindow?: TimeWindowConfig;
}
```
## Tool patterns
Several rule types accept a `tools` array that scopes the rule to specific tool names. Two pattern forms are supported:
* **Exact match**: `"file.read"` matches only `file.read`
* **Trailing wildcard**: `"file.*"` matches `file.read`, `file.write`, `file.delete`, and any other tool starting with `file.`
* **Match all**: `"*"` matches any tool name
***
## 1. tool\_allowlist
An allowlist explicitly permits the listed tools. If the requested tool is **not** in the list, the request is denied.
```json theme={null}
{
"type": "tool_allowlist",
"tools": ["file.read", "web.search"]
}
```
Using a wildcard to allow an entire namespace:
```json theme={null}
{
"type": "tool_allowlist",
"tools": ["calendar.*"]
}
```
An allowlist rule that matches the requested tool affirmatively contributes to an `allowed` decision. The policy evaluator requires at least one affirmative rule to return `allowed`.
***
## 2. tool\_denylist
A denylist explicitly blocks the listed tools. If the requested tool **is** in the list, the request is denied immediately.
```json theme={null}
{
"type": "tool_denylist",
"tools": ["system.exec", "file.delete"]
}
```
**Important:** A denylist does not implicitly allow everything else. If your policy contains only denylist rules and no allowlist rules, the policy will never produce an `allowed` decision — tools not on the denylist simply won't match, and evaluation will fall through to the next policy (or default deny).
To block specific tools while allowing others, use a denylist policy at higher priority combined with a separate allowlist policy at lower priority. See [Policies](/concepts/policies) for an example.
***
## 3. parameter\_constraint
A parameter constraint validates the values of tool parameters before allowing the call. If any parameter fails its constraint, the request is denied.
```typescript theme={null}
interface ParameterConstraint {
regex?: string; // value must match this regular expression
enum?: string[]; // value must be one of these strings
min?: number; // value must be >= this number (inclusive)
max?: number; // value must be <= this number (inclusive)
}
```
Use the `tools` field to scope the constraint to specific tools. Omit `tools` to apply the constraint to all tools.
**Example: restrict file writes to paths under `/home/`**
```json theme={null}
{
"type": "parameter_constraint",
"tools": ["file.write"],
"parameters": {
"path": { "regex": "^/home/" }
}
}
```
**Example: restrict an environment parameter to known values**
```json theme={null}
{
"type": "parameter_constraint",
"tools": ["deploy.trigger"],
"parameters": {
"environment": { "enum": ["staging", "production"] }
}
}
```
**Example: cap a numeric parameter within a safe range**
```json theme={null}
{
"type": "parameter_constraint",
"parameters": {
"timeout": { "min": 1, "max": 30 }
}
}
```
Parameter values that match a [sensitive key pattern](/concepts/audit-log#sensitive-parameter-redaction) (such as `password`, `token`, or `api_key`) are redacted in denial reasons and audit log entries.
***
## 4. rate\_limit
A rate limit caps how many times an agent can successfully call a tool within a rolling time window.
```typescript theme={null}
interface RateLimitConfig {
maxCalls: number; // maximum allowed successful calls
windowSeconds: number; // length of the rolling window, in seconds
}
```
Use the `tools` field to scope the limit to specific tools. Omit `tools` to apply the limit across all tool calls.
**Example: cap web searches to 100 per hour**
```json theme={null}
{
"type": "rate_limit",
"tools": ["web.search"],
"rateLimit": { "maxCalls": 100, "windowSeconds": 3600 }
}
```
**Example: global call limit across all tools**
```json theme={null}
{
"type": "rate_limit",
"rateLimit": { "maxCalls": 500, "windowSeconds": 60 }
}
```
Only calls that resulted in `allowed` count against the rate limit budget. Denied requests do not consume quota.
***
## 5. time\_based
A time-based rule restricts tool calls to certain hours of the day or days of the week.
```typescript theme={null}
interface TimeWindowConfig {
allowedHours?: number[]; // hours (0–23) when calls are permitted
allowedDays?: number[]; // days of week: 0 = Sunday, 6 = Saturday
timezone?: string; // IANA timezone string, e.g. "America/Chicago"
}
```
If `timezone` is omitted, times are evaluated in UTC.
**Example: business hours only, Monday–Friday, US Central**
```json theme={null}
{
"type": "time_based",
"timeWindow": {
"allowedHours": [9, 10, 11, 12, 13, 14, 15, 16, 17],
"allowedDays": [1, 2, 3, 4, 5],
"timezone": "America/Chicago"
}
}
```
**Example: restrict to weekends only**
```json theme={null}
{
"type": "time_based",
"timeWindow": {
"allowedDays": [0, 6]
}
}
```
***
Keep denylist rules and allowlist rules in separate policies rather than mixing them in the same policy. A policy containing only denylist rules will never produce an `allowed` result — it can only deny or pass through. Use priority to layer a high-priority deny policy on top of a lower-priority allow policy. This keeps your intent explicit and your evaluation logic predictable.
# API Keys
Source: https://docs.veto.tools/dashboard/api-keys
Create, manage, and revoke API keys for accessing the Veto API.
Your API key grants full access to your workspace. Store it in an environment variable — never hardcode it in source code.
API keys authenticate requests to the Veto REST API and SDK. You can create multiple keys per workspace, which makes it easy to rotate them without downtime and scope them to least privilege.
## Key format
Veto API keys start with `veto_` followed by 32 hex characters:
```
veto_a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4
```
After creation, only the first 12 characters (the prefix) are stored and displayed. The full key is shown exactly once.
## Key scopes
| Scope | Access |
| ----------- | -------------------------------------------------------------------------------------- |
| `admin` | Full access — create, update, and delete agents, policies, and API keys |
| `read-only` | Read access — query agents, policies, and audit logs; cannot create or modify anything |
`POST /v1/authorize` works with both `admin` and `read-only` keys. You can use a read-only key in your agent runtime and reserve the admin key for your control plane.
## Creating a key
### From the dashboard
Go to **Settings → API Keys** in the [Veto dashboard](https://app.veto.tools).
Click **New API Key** to open the creation dialog.
Give the key a descriptive name (e.g., `production-server`) and select a scope: `admin` or `read-only`.
Copy the key immediately — it is displayed once and never stored in plaintext. Close the dialog only after you've saved it somewhere secure.
### Via the API
```bash theme={null}
curl -X POST https://api.veto.tools/v1/api-keys \
-H "Authorization: Bearer veto_..." \
-H "Content-Type: application/json" \
-d '{"name": "production-server", "scopes": ["admin"]}'
```
The response includes a `key` field with the raw key. Store it immediately — subsequent calls to `GET /v1/api-keys` return only the prefix.
## Using a key
Pass the key as a Bearer token in every request:
```
Authorization: Bearer veto_...
```
With the SDK:
```typescript theme={null}
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
```
## Rotating keys
Veto supports multiple active keys per workspace, so you can rotate without downtime:
Create a new key in **Settings → API Keys** or via `POST /v1/api-keys`.
Deploy your application with the new key set in your environment.
Confirm requests are succeeding with the new key before proceeding.
Once traffic has shifted, revoke the old key from **Settings → API Keys**.
## Revoking a key
**From the dashboard:** Go to **Settings → API Keys** and click **Revoke** next to the key you want to remove.
**Via the API:**
```bash theme={null}
curl -X DELETE https://api.veto.tools/v1/api-keys/{id} \
-H "Authorization: Bearer veto_..."
```
A successful revocation returns `204 No Content`. Revoked keys are immediately invalid — any request using them will return `401 Unauthorized`.
## Rate limits
Each API key is limited to **600 requests per minute**. Every response includes rate limit headers:
| Header | Description |
| ----------------------- | ---------------------------------------- |
| `X-RateLimit-Limit` | Maximum requests allowed per minute |
| `X-RateLimit-Remaining` | Requests remaining in the current window |
| `X-RateLimit-Reset` | Unix timestamp when the window resets |
If you exceed the limit, the API returns `429 Too Many Requests` with a `Retry-After` header indicating how many seconds to wait before retrying.
# Dashboard
Source: https://docs.veto.tools/dashboard/overview
Manage agents, policies, and audit logs from the Veto dashboard at app.veto.tools.
The Veto dashboard is at [app.veto.tools](https://app.veto.tools) and requires a Veto account.
## Signing in
Go to [app.veto.tools](https://app.veto.tools) and sign in with your email, Google, or GitHub account. The first time you sign in, Veto automatically creates a workspace for you — no extra setup needed.
## What you can do
### Overview
The overview page is the landing page for your workspace. It shows high-level stats: how many agents you have and a summary of recent authorization decisions.
### Agents
The **Agents** section is where you register and manage the AI actors in your system.
* Create a new agent with a name and description
* View all agents and their current status
* Click an agent to see its attached policies and recent authorization activity
* Delete agents you no longer need
Each agent has one of three statuses:
| Status | Behavior |
| ----------- | ------------------------------------------- |
| `active` | Authorization checks run normally |
| `suspended` | All requests are denied while suspended |
| `revoked` | Permanently disabled; cannot be reactivated |
### Policies
The **Policies** section lets you define what each agent is allowed to do.
* Create policies using the visual rule builder — no code required
* Enable or disable individual policies with a toggle
* Set a priority to control evaluation order (higher number = evaluated first)
* Add one or more rules to each policy:
| Rule type | What it does |
| --------------------- | -------------------------------------------------------------- |
| Tool allowlist | Explicitly permits specific tools |
| Tool denylist | Explicitly blocks specific tools |
| Parameter constraints | Validates tool parameters with regex, enums, or min/max ranges |
| Rate limits | Caps how many times a tool can be called within a time window |
| Time-based windows | Restricts tool access to specific hours or days |
Click any policy to see the full rule configuration.
### Audit log
The **Audit Log** is a complete, searchable record of every authorization decision Veto has made.
Filter by:
* Agent
* Result (`allowed` or `denied`)
* Tool name
* Time range
Each log entry shows:
| Field | Description |
| -------------- | --------------------------------- |
| Timestamp | When the decision was made |
| Agent | Which agent made the request |
| Tool | The tool that was evaluated |
| Result | `allowed` or `denied` |
| Reason | Why the decision was made |
| Latency | How long evaluation took |
| Matched policy | Which policy triggered the result |
The log is paginated for large workspaces and append-only — entries cannot be deleted.
### Settings → API keys
The **Settings** page is where you manage API keys for programmatic access to the Veto API.
* Create new keys with a name and scope (`admin` or `read-only`)
* The full key is shown once on creation — copy it before closing the dialog
* Existing keys are listed by their prefix (e.g., `veto_abc123...`) along with metadata like creation date and last used time
* Revoke keys you no longer need
Use read-only API keys for monitoring integrations and log aggregation pipelines. This limits exposure if a key is ever compromised — read-only keys cannot modify agents, policies, or other keys.
# MCP Integration
Source: https://docs.veto.tools/integrations/mcp
Add Veto authorization to any Model Context Protocol server with a single wrapper.
## What is MCP?
Model Context Protocol (MCP) is a standard for AI agents to call tools on external servers. Each tool invocation is a structured request that your server handles.
Veto integrates at the MCP layer — authorization is evaluated **before** any tool handler executes. If a call is denied, your handler code never runs.
## Installation
```bash theme={null}
npm install @useveto/node
```
## Integration options
`createVetoGuard` returns a `protect` function that wraps your tool handler. When authorization is denied, the handler never executes — Veto returns an MCP-compatible error response directly.
```typescript theme={null}
import { VetoClient, createVetoGuard } from "@useveto/node";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
const protect = createVetoGuard(veto, { agentId: "support-bot" });
const server = new McpServer({ name: "my-server", version: "1.0.0" });
server.tool(
"send-email",
{ to: z.string(), subject: z.string(), body: z.string() },
protect("send-email", async (params) => {
await sendEmail(params);
return { content: [{ type: "text", text: "Email sent!" }] };
}),
);
```
When authorization is denied, `protect` returns this response to the MCP client instead of calling your handler:
```json theme={null}
{
"content": [{ "type": "text", "text": "Authorization denied: ..." }],
"isError": true
}
```
`vetoMiddleware` returns a guard function you call at the top of each handler. If authorization is denied, it **throws** a `VetoError` — you can catch it and handle it yourself.
```typescript theme={null}
import { VetoClient, vetoMiddleware, VetoError } from "@useveto/node";
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
import { z } from "zod";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
const guard = vetoMiddleware(veto, { agentId: "support-bot" });
const server = new McpServer({ name: "my-server", version: "1.0.0" });
server.tool(
"send-email",
{ to: z.string(), subject: z.string(), body: z.string() },
async (params) => {
await guard("send-email", params); // throws VetoError if denied
await sendEmail(params);
return { content: [{ type: "text", text: "Sent!" }] };
},
);
```
Use `vetoMiddleware` when you need to add custom logic (logging, fallback behavior, conditional bypasses) around the authorization check.
## VetoMcpOptions
Both `createVetoGuard` and `vetoMiddleware` accept a `VetoMcpOptions` object as their second argument.
| Option | Type | Required | Description |
| ---------- | ---------------------------- | -------- | --------------------------------------------------------------------------------------- |
| `agentId` | `string` | Yes | The agent ID to authorize against. Must match a registered agent in your Veto account. |
| `onError` | `"deny" \| "allow"` | No | What to do when the Veto API is unreachable. Default: `"deny"` (fail-closed). |
| `onDenied` | `(toolName, reason) => void` | No | Optional callback invoked whenever authorization is denied. Use for logging or metrics. |
```typescript theme={null}
const protect = createVetoGuard(veto, {
agentId: "support-bot",
onError: "deny", // fail-closed (default)
onDenied: (toolName, reason) => {
metrics.increment("veto.denied", { tool: toolName });
logger.warn(`Tool denied: ${toolName} — ${reason}`);
},
});
```
## Fail-closed behavior
If the Veto API is unreachable (network error, timeout, 5xx), tool calls are **blocked by default**. This ensures your agent cannot take unauthorized actions simply because authorization is temporarily unavailable.
Fail-closed is the right default for production. A momentary network partition should not become a security gap.
Setting `onError: "allow"` (fail-open) lets tool calls proceed when Veto is unreachable. This is not recommended for production — use it only in development or for non-sensitive tools where availability outweighs authorization risk.
## How it works
```
MCP Client → MCP Server → createVetoGuard → Veto API
↓ ↓
(allowed) run handler (denied) isError: true
```
Step by step:
1. An MCP client sends a `tools/call` request.
2. `createVetoGuard` (or `vetoMiddleware`) intercepts the call before your handler runs.
3. It sends an authorization check to the Veto API with the agent ID, tool name, and parameters.
4. **Allowed** — your tool handler executes and returns its result.
5. **Denied** — Veto returns `{ isError: true }` without executing your handler. (`vetoMiddleware` throws instead.)
6. **Veto API unreachable** — tool call is blocked (fail-closed by default).
Every decision is recorded in the Veto audit log regardless of outcome.
# Node.js SDK
Source: https://docs.veto.tools/integrations/node-sdk
Use @useveto/node to integrate Veto into Node.js and edge runtime applications.
## Installation
```bash theme={null}
npm install @useveto/node
```
## Setup
```typescript theme={null}
import { VetoClient } from "@useveto/node";
const veto = new VetoClient({
apiKey: process.env.VETO_API_KEY!, // required
endpoint: "https://api.veto.tools", // optional — default
timeout: 5000, // optional — ms, default 5000
});
```
## Authorization
`veto.authorize` is the primary method. It checks whether an agent is permitted to call a tool with the given parameters and returns an `AuthorizationResult`.
```typescript theme={null}
veto.authorize(agentId: string, toolName: string, parameters?: Record): Promise
```
The `AuthorizationResult` shape:
| Field | Type | Description |
| ----------------- | ----------------------- | ------------------------------------------------------------------------- |
| `allowed` | `boolean` | Whether the action is permitted. |
| `outcome` | `"allowed" \| "denied"` | The full authorization outcome. |
| `matchedPolicyId` | `string \| null` | ID of the policy that produced this decision, or `null` for default deny. |
| `reason` | `string` | Human-readable explanation. |
| `evaluatedAt` | `string` | ISO timestamp of when the decision was made. |
```typescript theme={null}
const result = await veto.authorize("support-bot", "send_email", {
to: "user@example.com",
subject: "Refund confirmation",
});
if (!result.allowed) {
console.log(`Blocked: ${result.reason}`);
return;
}
// proceed with sending the email
```
If no policy matches the agent and tool, Veto **denies by default**. You must explicitly create a policy that allows an action for it to be permitted.
## Agent management
```typescript createAgent theme={null}
const agent = await veto.createAgent({
name: "support-bot",
description: "Customer support automation agent",
});
// returns Agent: { id, name, description, status, createdAt, updatedAt }
```
```typescript listAgents theme={null}
const agents = await veto.listAgents();
// returns Agent[]
```
```typescript getAgent theme={null}
const agent = await veto.getAgent("agent-uuid");
```
```typescript deleteAgent theme={null}
await veto.deleteAgent("agent-uuid");
// returns void
```
## Policy management
Policies contain one or more rules that determine what an agent can do. Higher `priority` values are evaluated first.
### Rule types
| Type | Description |
| ---------------------- | ------------------------------------------------------------- |
| `tool_allowlist` | Explicitly allow the listed tools (glob patterns supported). |
| `tool_denylist` | Explicitly block the listed tools. |
| `parameter_constraint` | Constrain parameter values via regex, enum, or numeric range. |
| `rate_limit` | Limit how many times a tool can be called per time window. |
| `time_based` | Restrict tool use to specific hours or days of the week. |
### createPolicy
```typescript theme={null}
const policy = await veto.createPolicy({
agentId: "agent-uuid",
name: "Allow safe read operations",
priority: 10,
enabled: true,
rules: [
{
type: "tool_allowlist",
tools: ["file.read", "web.search"],
},
{
type: "tool_denylist",
tools: ["file.delete", "system.exec"],
},
{
type: "parameter_constraint",
tools: ["file.read"],
parameters: {
path: {
regex: "^/home/", // must start with /home/
},
},
},
{
type: "rate_limit",
tools: ["web.search"],
rateLimit: {
maxCalls: 100,
windowSeconds: 3600, // 100 calls per hour
},
},
{
type: "time_based",
tools: ["send_email"],
timeWindow: {
allowedHours: [9, 10, 11, 12, 13, 14, 15, 16, 17], // business hours
allowedDays: [1, 2, 3, 4, 5], // Monday–Friday
timezone: "America/New_York",
},
},
],
});
```
```typescript listPolicies theme={null}
// list all policies
const policies = await veto.listPolicies();
// filter by agent
const agentPolicies = await veto.listPolicies("agent-uuid");
```
```typescript getPolicy theme={null}
const policy = await veto.getPolicy("policy-uuid");
```
```typescript updatePolicy theme={null}
const updated = await veto.updatePolicy("policy-uuid", {
name: "Allow safe read operations (updated)",
enabled: false,
// rules and priority can also be updated
});
```
```typescript deletePolicy theme={null}
await veto.deletePolicy("policy-uuid");
// returns void
```
## Audit log
`queryAuditLog` returns a paginated list of every authorization decision Veto has made.
```typescript theme={null}
veto.queryAuditLog(filters?: AuditLogFilters): Promise
```
### AuditLogFilters
| Field | Type | Description |
| ---------- | ----------------------- | ------------------------------------- |
| `agentId` | `string` | Filter by agent. |
| `action` | `string` | Filter by action string. |
| `toolName` | `string` | Filter by tool name. |
| `result` | `"allowed" \| "denied"` | Filter by outcome. |
| `from` | `string` | ISO timestamp — entries on or after. |
| `to` | `string` | ISO timestamp — entries on or before. |
| `limit` | `number` | Max entries to return. |
| `offset` | `number` | Pagination offset. |
```typescript theme={null}
const log = await veto.queryAuditLog({
agentId: "agent-uuid",
result: "denied",
from: "2026-01-01T00:00:00Z",
limit: 50,
offset: 0,
});
console.log(`${log.pagination.total} total denials`);
for (const entry of log.data) {
console.log(`[${entry.timestamp}] ${entry.toolName} — ${entry.reason}`);
}
```
The response also includes a `pagination` object with `limit`, `offset`, `count`, and `total` fields.
## Error handling
The SDK exports three error classes:
| Class | Extends | Code | Status | Extra field |
| ------------------- | ----------- | -------------- | ------ | -------------------------------------- |
| `VetoError` | `Error` | varies | varies | `.code: string`, `.statusCode: number` |
| `UnauthorizedError` | `VetoError` | `UNAUTHORIZED` | 401 | — |
| `RateLimitError` | `VetoError` | `RATE_LIMITED` | 429 | `.retryAfterMs: number` |
```typescript theme={null}
import { VetoError, UnauthorizedError, RateLimitError } from "@useveto/node";
try {
const result = await veto.authorize("support-bot", "send_email", {
to: "user@example.com",
});
if (!result.allowed) {
console.warn(`Denied: ${result.reason}`);
}
} catch (error) {
if (error instanceof RateLimitError) {
// back off and retry
console.error(`Rate limited — retry after ${error.retryAfterMs}ms`);
await sleep(error.retryAfterMs);
} else if (error instanceof UnauthorizedError) {
// bad or expired API key
console.error("Invalid API key — check VETO_API_KEY");
} else if (error instanceof VetoError) {
// any other Veto error (timeout, network, server error)
console.error(`Veto error [${error.code}]: ${error.message}`);
}
}
```
`VetoError` also covers `TIMEOUT` (status 408) and `NETWORK_ERROR` (status 0) when the Veto API is unreachable.
## Fail-closed behavior
By default, if the Veto API is unreachable (network error or timeout), the SDK **denies the request**. This ensures your agent cannot take unauthorized actions simply because authorization is unavailable.
When using MCP middleware (`createVetoGuard` or `vetoMiddleware`), you can override this with the `onError` option:
```typescript theme={null}
import { VetoClient, createVetoGuard } from "@useveto/node";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
// Default — fail-closed (recommended for production)
const protect = createVetoGuard(veto, {
agentId: "my-agent",
onError: "deny",
});
// Fail-open — allow tool calls even when Veto is unreachable
const protect = createVetoGuard(veto, {
agentId: "my-agent",
onError: "allow",
});
```
`onError: "allow"` lets tool calls proceed when Veto is unreachable. This is not recommended for production — a network partition becomes a security gap.
# Python SDK
Source: https://docs.veto.tools/integrations/python-sdk
Use the useveto Python package to integrate Veto into Python applications.
## Installation
```bash theme={null}
pip install useveto
```
## Clients
The `useveto` package ships two clients with identical APIs — choose based on whether your application is synchronous or asynchronous.
| Client | Use when |
| ----------------- | ----------------------------------------------- |
| `VetoClient` | Synchronous code (scripts, Django, Flask, etc.) |
| `AsyncVetoClient` | Async code (FastAPI, async frameworks) |
Both accept the same constructor parameters:
| Parameter | Type | Required | Description |
| ---------- | ------- | -------- | ----------------------------------------------- |
| `api_key` | `str` | Yes | Your Veto API key. |
| `endpoint` | `str` | No | API base URL. Default: `https://api.veto.tools` |
| `timeout` | `float` | No | Request timeout in seconds. Default: `5.0` |
## Sync client
```python theme={null}
from veto import VetoClient
client = VetoClient(
api_key="veto_...",
endpoint="https://api.veto.tools", # optional
timeout=5.0, # optional
)
result = client.authorize("agent-uuid", "file.write", {"path": "/etc/passwd"})
if not result.allowed:
print(f"Blocked: {result.reason}")
```
## Async client
```python theme={null}
from veto import AsyncVetoClient
async def check_authorization():
async with AsyncVetoClient(api_key="veto_...") as client:
result = await client.authorize("agent-uuid", "send_email", {
"to": "user@example.com",
"subject": "Refund confirmation",
})
if not result.allowed:
print(f"Blocked: {result.reason}")
```
## Authorization
`authorize` is the primary method. It checks whether an agent is permitted to call a tool with the given parameters.
```python theme={null}
client.authorize(agent_id, tool_name, parameters={}) -> AuthorizationResult
```
The `AuthorizationResult` has these fields:
| Field | Type | Description |
| ------------------- | ------------- | ------------------------------------------------------ |
| `allowed` | `bool` | Whether the action is permitted. |
| `outcome` | `str` | `"allowed"` or `"denied"`. |
| `matched_policy_id` | `str \| None` | ID of the matching policy, or `None` for default deny. |
| `reason` | `str` | Human-readable explanation. |
| `evaluated_at` | `str` | ISO timestamp of the decision. |
If no policy matches the agent and tool, Veto **denies by default**. You must explicitly create a policy that allows an action for it to be permitted.
## Agent management
```python create_agent theme={null}
from veto import VetoClient, CreateAgentInput
client = VetoClient(api_key="veto_...")
agent = client.create_agent(CreateAgentInput(
name="support-bot",
description="Customer support automation agent",
))
# returns Agent: id, name, description, status, created_at, updated_at
```
```python list_agents theme={null}
agents = client.list_agents()
# returns List[Agent]
```
```python get_agent theme={null}
agent = client.get_agent("agent-uuid")
```
```python delete_agent theme={null}
client.delete_agent("agent-uuid")
# returns None
```
## Policy management
```python create_policy theme={null}
from veto import VetoClient, CreatePolicyInput, PolicyRule
client = VetoClient(api_key="veto_...")
policy = client.create_policy(CreatePolicyInput(
agent_id="agent-uuid",
name="Allow safe read operations",
rules=[
PolicyRule(type="tool_allowlist", tools=["file.read", "web.search"]),
PolicyRule(type="tool_denylist", tools=["file.delete", "system.exec"]),
],
priority=10,
))
```
```python list_policies theme={null}
# all policies
policies = client.list_policies()
# filter by agent
agent_policies = client.list_policies(agent_id="agent-uuid")
```
```python get_policy theme={null}
policy = client.get_policy("policy-uuid")
```
```python update_policy theme={null}
from veto import UpdatePolicyInput
updated = client.update_policy("policy-uuid", UpdatePolicyInput(
name="Allow safe read operations (updated)",
enabled=False,
))
```
```python delete_policy theme={null}
client.delete_policy("policy-uuid")
# returns None
```
## Audit logs
```python theme={null}
response = client.query_audit_log(
agent_id="agent-uuid", # optional
tool_name="file.write", # optional
result="denied", # optional: "allowed" | "denied"
from_time="2026-01-01T00:00:00Z", # optional ISO datetime
to_time="2026-04-01T00:00:00Z", # optional ISO datetime
limit=100, # optional
offset=0, # optional
)
print(f"{response.pagination.total} total entries")
for entry in response.data:
print(f"[{entry.timestamp}] {entry.tool_name} — {entry.reason}")
```
## LangChain integration
Wrap any LangChain tool function with Veto authorization. If the action is denied, the wrapper returns the denial reason as a string instead of executing the tool.
```python theme={null}
from veto import VetoClient, VetoError
veto = VetoClient(api_key="veto_...")
def veto_tool_wrapper(tool_func, tool_name: str, agent_id: str):
"""Wrap any LangChain tool with Veto authorization."""
def wrapper(*args, **kwargs):
result = veto.authorize(agent_id, tool_name, kwargs)
if not result.allowed:
return f"Authorization denied: {result.reason}"
return tool_func(*args, **kwargs)
wrapper.__name__ = tool_func.__name__
wrapper.__doc__ = tool_func.__doc__
return wrapper
# Usage
def web_search(query: str) -> str:
return search_the_web(query)
web_search = veto_tool_wrapper(web_search, tool_name="web_search", agent_id="agent-uuid")
```
## CrewAI integration
Use `before_tool_callback` to intercept every tool call in a CrewAI agent. Return `False` to block execution.
```python theme={null}
from veto import VetoClient
veto = VetoClient(api_key="veto_...")
def before_tool_callback(agent_id: str):
def callback(tool_name: str, tool_input: dict) -> bool:
result = veto.authorize(agent_id, tool_name, tool_input)
return result.allowed
return callback
# Attach to your CrewAI agent
agent = Agent(
role="Support Bot",
before_tool_callback=before_tool_callback("agent-uuid"),
...
)
```
## Error handling
```python theme={null}
from veto import VetoError, UnauthorizedError, RateLimitError
import time
try:
result = client.authorize("agent-uuid", "send_email", {
"to": "user@example.com",
})
if not result.allowed:
print(f"Denied: {result.reason}")
except RateLimitError as e:
# back off and retry
print(f"Rate limited — retry after {e.retry_after_ms}ms")
time.sleep(e.retry_after_ms / 1000)
except UnauthorizedError:
# bad or expired API key
print("Invalid API key — check VETO_API_KEY")
except VetoError as e:
# any other Veto error (timeout, network, server error)
print(f"{e.code}: {e}")
```
## Context managers
Both clients support context managers for automatic resource cleanup.
```python sync theme={null}
from veto import VetoClient
with VetoClient(api_key="veto_...") as client:
result = client.authorize("agent-1", "file.read")
print(result.allowed)
```
```python async theme={null}
from veto import AsyncVetoClient
async def run():
async with AsyncVetoClient(api_key="veto_...") as client:
result = await client.authorize("agent-1", "file.read")
print(result.allowed)
```
# Introduction
Source: https://docs.veto.tools/introduction
What Veto is, why it exists, and how it fits into an AI agent stack.
Veto is a runtime authorization service for AI agents. It sits between your agent and the tools it calls, evaluates every action against the policies you define, and decides: **allow** or **deny** — in under 10ms, at the edge.
## The problem
Identity protocols like MCP and OAuth answer one question: *who is this agent?* They don't answer the harder question: *what should this agent be allowed to do?*
An authenticated agent can still send emails it shouldn't send, delete records it shouldn't delete, or call external APIs at unbounded rates. Authentication is a prerequisite — it's not authorization.
Veto fills that gap.
## How it fits
Every tool call your agent makes passes through Veto before it executes:
```
Agent → Veto (authorized?) → Tool execution
```
If a matching policy allows the action, it proceeds. If nothing allows it, it's blocked. There is no implicit trust — the default posture is deny.
## Key concepts
**Agents** are the AI actors you register with Veto — bots, workflows, or models that call tools on behalf of users or systems. Each agent has a stable ID used in authorization checks.
**Policies** are the rules that govern what an agent can do. A policy is a named set of rules attached to an agent. Rules can express allowlists, denylists, parameter constraints, rate limits, and time-based windows.
**Authorization checks** are the calls your code makes to Veto at runtime — one per tool invocation. Veto evaluates the matching policies and returns a decision with a reason.
**Audit log** is the complete record of every decision Veto has made. Every authorization check — allowed or denied — is logged and queryable, giving you a full trail of agent behavior.
## What you get
Powered by Cloudflare Workers with global distribution. Authorization adds no meaningful latency to your tool calls.
No matching policy means blocked. You opt in to what's allowed — not what's denied.
Every check is logged with the outcome, matched policy, reason, and latency. Query it from the dashboard or API.
Typed clients for both languages. One method call to authorize a tool call.
Drop-in guard and middleware helpers for Model Context Protocol servers.
Tool allowlists, denylists, parameter constraints, rate limits, and time-based windows.
## Next step
Make your first authorization check in under 5 minutes.
# Quick Start
Source: https://docs.veto.tools/quickstart
Make your first authorization check in under 5 minutes.
Sign up at [app.veto.tools](https://app.veto.tools) and create a workspace. A workspace is the container for your agents, policies, and audit logs.
In the dashboard, go to **Settings → API Keys** and create a new key.
The raw API key is shown **once** at creation and never again — only the key prefix is stored. Copy it immediately and save it somewhere secure, such as a password manager or secrets vault.
Your key will look like this:
```
veto_a3f8c2e1d4b7...
```
For local development, store it in an environment variable:
```bash theme={null}
export VETO_API_KEY=veto_a3f8c2e1d4b7...
```
```bash Node.js theme={null}
npm install @useveto/node
```
```bash Python theme={null}
pip install useveto
```
An agent represents an AI actor — a bot, workflow, or model — that calls tools. Register one using the SDK or the dashboard.
```typescript Node.js theme={null}
import { VetoClient } from "@useveto/node";
const veto = new VetoClient({ apiKey: process.env.VETO_API_KEY! });
const agent = await veto.createAgent({
name: "support-bot",
description: "Customer support agent that can send emails and look up orders",
});
console.log(agent.id); // e.g. "agent_01j..."
```
```python Python theme={null}
import os
from veto import VetoClient, CreateAgentInput
veto = VetoClient(api_key=os.environ["VETO_API_KEY"])
agent = veto.create_agent(CreateAgentInput(
name="support-bot",
description="Customer support agent that can send emails and look up orders",
))
print(agent.id) # e.g. "agent_01j..."
```
You can also create agents directly in the dashboard under **Agents → New agent**. Copy the agent ID — you'll use it in authorization checks.
Policies define what your agent is allowed to do. The following example creates a policy that allows the `support-bot` agent to call `send_email` and `lookup_order`, and nothing else.
```typescript Node.js theme={null}
const policy = await veto.createPolicy({
agentId: agent.id,
name: "Support bot — allowed tools",
rules: [
{
type: "tool_allowlist",
tools: ["send_email", "lookup_order"],
},
],
priority: 10,
enabled: true,
});
console.log(policy.id);
```
```python Python theme={null}
from veto import CreatePolicyInput, PolicyRule
policy = veto.create_policy(CreatePolicyInput(
agent_id=agent.id,
name="Support bot — allowed tools",
rules=[
PolicyRule(
type="tool_allowlist",
tools=["send_email", "lookup_order"],
)
],
priority=10,
enabled=True,
))
print(policy.id)
```
Any tool not on the allowlist is blocked by default — you don't need to define a denylist.
Call `veto.authorize()` before each tool execution. Pass the agent ID, the tool name, and (optionally) the call parameters.
```typescript Node.js theme={null}
const result = await veto.authorize(
agent.id, // agentId: string
"send_email", // toolName: string
{ // parameters (optional)
to: "customer@example.com",
subject: "Your order has shipped",
},
);
if (result.allowed) {
// proceed with the tool call
await sendEmail(result);
} else {
console.log(`Blocked: ${result.reason}`);
}
```
```python Python theme={null}
result = veto.authorize(
agent_id=agent.id,
tool_name="send_email",
parameters={
"to": "customer@example.com",
"subject": "Your order has shipped",
},
)
if result.allowed:
# proceed with the tool call
send_email(result)
else:
print(f"Blocked: {result.reason}")
```
The response includes:
| Field | Type | Description |
| ----------------- | ----------------------- | ------------------------------------------------------------------ |
| `allowed` | `boolean` | Whether the action is permitted |
| `outcome` | `"allowed" \| "denied"` | The decision |
| `matchedPolicyId` | `string \| null` | The policy that produced this decision, or `null` for default deny |
| `reason` | `string` | Human-readable explanation |
| `evaluatedAt` | `string` | ISO 8601 timestamp of the evaluation |
A denied response looks like this:
```json theme={null}
{
"allowed": false,
"outcome": "denied",
"matchedPolicyId": null,
"reason": "No policy allows tool 'delete_account' for this agent",
"evaluatedAt": "2026-04-08T12:00:00.000Z"
}
```
## What's next
Learn about API key scopes, rate limits, and secure key management.
Explore all five rule types — allowlists, denylists, parameter constraints, rate limits, and time windows.
Full SDK reference including MCP middleware.
REST API reference for every endpoint.