---
title: "Add a rule to an agent"
method: POST
path: "/v1/agents/{agent_id}/rules"
tags: ["rules"]
---

# Add a rule to an agent

`POST /v1/agents/{agent_id}/rules`

## Request

- Base URL: `https://api.spendnod.com` (the document declares no server; this is the origin it was published from)
- URL: `https://api.spendnod.com/v1/agents/{agent_id}/rules`
- Auth: none declared

## Path parameters

- `agent_id` string, uuid, required

## Request body

- RuleCreate
  - `rule_type` 'max_per_transaction' | 'max_per_day' | 'max_per_month' | 'allowed_vendors' | 'blocked_vendors' | 'allowed_categories' | 'blocked_categories' | 'require_approval_above' | 'auto_approve_below', required
  - `value` object, required: Rule value payload. Examples: {"amount": 50.0} for amount rules, {"vendors": ["AWS", "GCP"]} for vendor rules.

## Response `201`

Successful Response

- RuleResponse
  - `id` string, uuid, required
  - `agent_id` string, uuid, required
  - `rule_type` 'max_per_transaction' | 'max_per_day' | 'max_per_month' | 'allowed_vendors' | 'blocked_vendors' | 'allowed_categories' | 'blocked_categories' | 'require_approval_above' | 'auto_approve_below', required
  - `value` object, required
  - `is_active` boolean, required
  - `created_at` string, date-time, required

## Other responses

- `422`: Validation Error

---

[API](https://skmtc.dev/spendnod/apis/spendnod-api.md) · [All operations](https://skmtc.dev/spendnod/apis/spendnod-api/llms.txt) · [OpenAPI document](https://skmtc.dev/spendnod/apis/spendnod-api/revisions/170dc867d036?raw)
