/ Docs

Decide Approvals

Approve or deny one or more approval requests, with the approver's choices (Task #6191). Each decision runs exactly the checks and writes of ``POST /approvals/{request_id}/decision`` (see :func:`decide_approval`) and may also carry ``input``: what the approver chose on the card. This is the only route that takes input, and a server that predates input does not serve it, so a new client never has its choice silently dropped by an old server: the request is refused there before anything is decided. **Per-item results, one transaction each, in request order.** A decision that is refused (``refused``, with the problem the single route would have answered) or needs a payment method first (``activation_required``) has nothing of its own written, and the others are applied regardless. Each decision commits on its own, so one decision's locks are never held while another's are taken. Side effects run after the commits: one wake per asking conversation, carrying every outcome in it, and one provisioner nudge per fulfilled bot. **What a decision that has committed is owed, it gets.** Its realtime events are handed to the request's publisher at its commit, and its wake and nudge are started even when a later decision fails the request. Anything other than a refusal fails the whole request, as it would the single route: an unexpected error, a failed savepoint release or rollback, or a failed commit. Decisions committed before it stay decided (the card reads live state). A commit that fails may still have landed, so it is checked on a fresh connection, and a decision that did land gets its side effects too.

POST
/v1/orgs/{org_id}/approvals/decisions

Authorization

BearerAuth
AuthorizationBearer <token>

Botyard API key — see /docs/authentication.

In: header

Path Parameters

org_id*Org Id

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Decide one or more approval requests, each on its own (Task #6191).

Response Body

application/json

curl -X POST "https://example.com/v1/orgs/string/approvals/decisions" \  -H "Content-Type: application/json" \  -d '{    "decisions": [      {        "approve": true,        "request_id": "266ea41d-adf5-480b-af50-15b940c2b846"      }    ]  }'
{
  "results": [
    {
      "outcome": "decided",
      "request_id": "string",
      "state": {
        "request_id": "string",
        "status": "pending",
        "spec": {
          "kind": "mcp_server.create",
          "title": "string",
          "rationale": "string",
          "summary_lines": [
            "string"
          ],
          "quote": {
            "item_label": "string",
            "price_cents": 0,
            "currency": "str",
            "interval": "month",
            "meter": "bot_count",
            "included_remaining": 0
          },
          "tools": [
            {
              "slug": "string",
              "tool_id": "string",
              "name": "string",
              "description": "string",
              "domain": "string"
            }
          ]
        },
        "created_at": "string",
        "expires_at": "string",
        "decided_by_user_id": "string",
        "decided_at": "string",
        "decision_reason": "string",
        "viewer_may_decide": true,
        "viewer_may_deny": false,
        "approve_blockers": [
          "string"
        ],
        "requires_payment_method": false,
        "blocked_by_plan_limit": false,
        "missing_permissions": [
          {
            "permission": {
              "domain": "platform",
              "resource": "fleet",
              "action": "read"
            },
            "label": "string",
            "tool_ids": [
              "string"
            ],
            "grantable_by_caller": true
          }
        ],
        "decision_options": {
          "kind": "eval_run.start",
          "credentials": [
            {
              "credential_id": "string",
              "label": "string",
              "provider": "openai",
              "spend_model": "string",
              "own_plan": true
            }
          ]
        },
        "details": {
          "kind": "mcp_server.create"
        }
      }
    }
  ]
}
{
  "type": "string",
  "title": "string",
  "status": 0,
  "detail": "string",
  "instance": "string",
  "error_code": "string",
  "errors": [
    {
      "pointer": "string",
      "detail": "string",
      "type": "string"
    }
  ],
  "trace_id": "string"
}

Decide Approval

Approve or deny a bot's request to spend the organization's money. Approving issues a short-lived, single-use grant bound to the digest of the payload on the card; the bot is woken with that payload handed back to it and retries the same call, which now passes the gate. The wake echoes the payload rather than relying on the bot to remember it, because the default approval lifetime is seven days and the asking session is usually long gone by the time a human answers. Denying issues nothing and tells the bot why. Three refusals sit in front of the transition, in this order: 1. **Authority.** The decider must hold the permission the kind's own action requires, over and above the ``conversation:approval.update`` floor the route already gated on. A member who could not create the MCP server themselves cannot authorize a bot to create it for them — that is the whole sentence the actor rule is built around. 2. **Hard cap.** A grant cannot buy past a plan limit, so approving one that the cap already blocks would mint authority for a call that is going to be refused anyway. Refused as ``plan_limit_reached``, the same code the gate would raise. 3. **Payment method.** On a card-free org a chargeable approval cannot be granted, so the request is left ``pending`` and an activation intent is returned for the client's existing checkout flow. See :class:`~botyard_api.models.approvals.ApprovalActivationIntent` for why there is no "approved, awaiting payment" state. Denials skip 2 and 3 entirely: refusing to spend money is always available, whatever the plan says. **Payload-dependent authority (#3157).** A kind may add an ``approver_shortfall`` hook on top of the static permission; an approve is refused while it names anything. For ``bot_tool.assign`` that is the union of the listed tools' requirements plus their visibility to the approver. **Kinds performed on approval.** For a ``performed_on_approval`` kind the action happens here, in the decision's transaction, and its grant is spent by id before commit — the bot is told it is done rather than to retry. A failure anywhere rolls the decision back with it, so the request stays pending and nothing is half-applied.

Audit events

Botyard REST API endpoints for audit events.