{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/account/sync-governance-request.json",
  "title": "Sync Governance Request",
  "description": "Sync the governance agent endpoint against specific accounts. The service persists the governance agent and calls it for approval during governed lifecycle events via check_governance. Uses replace semantics: each call replaces any previously synced agent on the specified accounts. The service MUST verify that the authenticated agent has authority over each referenced account before persisting the governance agent.\n\nThe binding is **account-scoped, not plan-scoped**. Each account binds to exactly one governance agent, and that agent owns the lifecycle for every plan on the account. Initial buyer-side checks address a plan by plan_id; downstream services pass only the opaque governance_context, from which the issuing agent recovers the plan. Governance registration does not vary per plan.\n\nA plan is unitary — budget authority, delivery monitoring, and regulatory compliance are phases of the same evaluation (`purchase` / `modification` / `delivery` on check_governance), not specialisms held by different agents — so a single agent owns the full lifecycle. Buyers that need internal specialist review compose that inside the governance agent, not at the registration layer. `governance_agents` is an array (not a scalar) because that is the shape 3.0 shipped with and existing senders MUST continue to work; the `maxItems: 1` constraint is load-bearing. The single-agent rule is also baked into the singular governance_context carried across tasks.",
  "x-tool-summary": "Bind or replace the governance agent used for approval across specific advertiser accounts.",
  "type": "object",
  "allOf": [
    {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/version-envelope.json"
    }
  ],
  "x-mutates-state": true,
  "properties": {
    "idempotency_key": {
      "type": "string",
      "description": "Client-generated unique key for at-most-once execution. `account` gives resource-level dedup, but governance changes emit audit events and can trigger reapproval flows — this key prevents those side effects from firing twice on retry. MUST be unique per (seller, request) pair. Use a fresh UUID v4 for each request.",
      "minLength": 16,
      "maxLength": 255,
      "pattern": "^[A-Za-z0-9_.:-]{16,255}$"
    },
    "accounts": {
      "type": "array",
      "description": "Per-account governance agent configuration. Each entry pairs an account reference with the governance agents for that account.",
      "items": {
        "type": "object",
        "properties": {
          "account": {
            "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/account-ref.json",
            "description": "Account to sync governance agents for. Use account_id for account-id namespaces or brand + operator for buyer-declared accounts."
          },
          "governance_agents": {
            "type": "array",
            "description": "Governance agent endpoint for this account. Exactly one entry — the single agent that owns the account's full governance lifecycle. The seller calls this agent via check_governance during media buy lifecycle events. The array shape is preserved for wire compatibility with 3.0 senders; `maxItems: 1` is load-bearing and mirrors the singular `governance_context` on the protocol envelope.",
            "items": {
              "type": "object",
              "properties": {
                "url": {
                  "type": "string",
                  "format": "uri",
                  "pattern": "^https://",
                  "description": "Governance agent endpoint URL. Must use HTTPS."
                },
                "authentication": {
                  "type": "object",
                  "description": "Authentication the seller presents when calling this governance agent.",
                  "properties": {
                    "schemes": {
                      "type": "array",
                      "items": {
                        "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/enums/auth-scheme.json"
                      },
                      "minItems": 1,
                      "maxItems": 1
                    },
                    "credentials": {
                      "type": "string",
                      "description": "Authentication credential (e.g., Bearer token).",
                      "minLength": 32
                    }
                  },
                  "required": [
                    "schemes",
                    "credentials"
                  ],
                  "additionalProperties": false
                }
              },
              "required": [
                "url",
                "authentication"
              ],
              "additionalProperties": false
            },
            "minItems": 1,
            "maxItems": 1
          }
        },
        "required": [
          "account",
          "governance_agents"
        ],
        "additionalProperties": false
      },
      "minItems": 1,
      "maxItems": 100
    },
    "context": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/context.json"
    },
    "ext": {
      "$ref": "https://adcontextprotocol.org/schemas/3.2.0-beta.0/core/ext.json"
    }
  },
  "required": [
    "idempotency_key",
    "accounts"
  ],
  "additionalProperties": true,
  "examples": [
    {
      "description": "Sync the governance agent on an account-id namespace account",
      "data": {
        "idempotency_key": "e1b3a6c8-5678-489a-bcde-f01234567891",
        "accounts": [
          {
            "account": {
              "account_id": "acct-social-001"
            },
            "governance_agents": [
              {
                "url": "https://governance.pinnacle-media.com",
                "authentication": {
                  "schemes": [
                    "Bearer"
                  ],
                  "credentials": "gov-token-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
                }
              }
            ]
          }
        ]
      }
    },
    {
      "description": "Sync the governance agent on a buyer-declared account by natural key",
      "data": {
        "idempotency_key": "f2c4b7d9-6789-489b-cdef-012345678902",
        "accounts": [
          {
            "account": {
              "brand": {
                "domain": "nova-brands.com",
                "brand_id": "spark"
              },
              "operator": "pinnacle-media.com"
            },
            "governance_agents": [
              {
                "url": "https://governance.pinnacle-media.com",
                "authentication": {
                  "schemes": [
                    "Bearer"
                  ],
                  "credentials": "gov-token-yyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy"
                }
              }
            ]
          }
        ]
      }
    }
  ]
}
