{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/customdomain-ai/json-schema/customdomain-ai-agent-consent-approval-schema.json",
  "title": "AgentConsentApproval",
  "description": "The body is decoded with unknown fields rejected.",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/customdomain-ai-agents-api-openapi.yml#/components/schemas/AgentConsentApproval",
  "type": "object",
  "required": [
    "request",
    "application_id",
    "scopes"
  ],
  "properties": {
    "request": {
      "type": "string",
      "description": "The consent request id the browser arrived with (`aqr_...`)."
    },
    "member_id": {
      "type": "string",
      "description": "The member who approves, recorded as the grant's approver, the email recipient and the audit actor. It must belong to the workspace. With a member's own key it must be that member (`403` otherwise) and may be left out; with any other key it is required."
    },
    "application_id": {
      "type": "string",
      "description": "The one application of the workspace the agent will act within."
    },
    "scopes": {
      "type": "array",
      "minItems": 1,
      "items": {
        "$ref": "#/$defs/AgentScope"
      },
      "description": "What is approved, a subset of what the agent asked for."
    },
    "can_purchase": {
      "type": "boolean",
      "deprecated": true,
      "description": "Ignored. Purchase is allowed exactly when `domains:purchase` is among the scopes."
    },
    "spend_cap_cents": {
      "type": "integer",
      "minimum": 0,
      "description": "The monthly spend cap in US cents. Required, and above 0, with `domains:purchase`, which also needs a saved card (`409` without one)."
    },
    "persist": {
      "type": "boolean",
      "default": true,
      "description": "True (the default) keeps the access until it is revoked. False ends it after `expires_days`."
    },
    "expires_days": {
      "type": "integer",
      "minimum": 0,
      "default": 30,
      "description": "With `persist: false`, days until the grant expires."
    },
    "acknowledged_unverified": {
      "type": "boolean",
      "default": false,
      "description": "The approver confirmed they recognize the host the authorization code goes to. Required (`true`) when that host is neither a known assistant's (`verified`) nor a loopback address (`local`) in `GET /agent/consent-request/{id}`; without it such a consent is refused with `400`."
    }
  },
  "$defs": {
    "AgentScope": {
      "type": "string",
      "enum": [
        "domains:read",
        "domains:connect",
        "domains:disconnect",
        "domains:purchase"
      ],
      "description": "What an agent grant may do. `domains:read` looks: availability, connections, records, certificates, diagnoses, orders and the billing standing. `domains:connect` changes: connect a domain, recheck it, reapply its records, start a one click setup. `domains:disconnect` removes a connected domain, and the call must name the domain. `domains:purchase` spends, up to the grant's monthly cap."
    }
  }
}