---
title: "set rules"
method: POST
path: "/api/v1/approval-rules/set_rules"
tags: ["approval-rules"]
---

# set rules

`POST /api/v1/approval-rules/set_rules`

## Request

- Base URL: `https://cloudforbots.com`
- URL: `https://cloudforbots.com/api/v1/approval-rules/set_rules`
- Auth: HTTP bearer

Save the user's rules (needs an API key so they stay yours). Each rule: {name, when:{type:[...], max_usd, min_usd, reversible, target_ends_with:[...]}, verdict:"auto"|"ask"|"deny"}. First matching rule wins; anything unmatched needs approval. Call once without confirm to preview, then with confirm=true.

## Headers

- `Idempotency-Key` string
- `X-Request-Id` string

## Request body

- object
  - `rules` object[], required
  - `confirm` boolean

## Response `200`

Tool result (always includes request_id).

- object

## Other responses

- `400`: Bad JSON
- `401`: Missing or bad key
- `403`: Key limits (scopes) do not allow this tool or action
- `409`: Same Idempotency-Key still running
- `422`: Idempotency-Key reused on another route
- `429`: Over 20 requests/second for this key, or free daily limit
- `504`: Tool did not answer in time; retry with the same Idempotency-Key

---

[API](https://skmtc.dev/cloudforbots/apis/cloud-for-bots-api.md) · [All operations](https://skmtc.dev/cloudforbots/apis/cloud-for-bots-api/llms.txt) · [OpenAPI document](https://skmtc.dev/cloudforbots/apis/cloud-for-bots-api/revisions/1afdb5648693?raw)
