{
  "openapi": "3.1.0",
  "info": {
    "title": "402Mob owner-controlled USDC wallet console",
    "version": "0.2.0",
    "description": "Local owner management API on loopback, not hosted at wallet.evidence.contact. Pairing and every POST require an approved exact Origin, JSON and X-402Mob-Wallet: 1. Owner bearer sessions expire after one hour and are bound to the pairing origin. Agent tokens cannot use these routes. USDC only on Base; grants are software authority, not transfers. Optional browser-wallet deposits run through the browser provider, not an owner API funding route; connection grants no agent authority over the browser wallet account."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:4032"
    }
  ],
  "security": [
    {
      "ownerSession": []
    }
  ],
  "paths": {
    "/api/healthz": {
      "get": {
        "operationId": "walletWebHealth",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          }
        ],
        "responses": {
          "200": {
            "description": "Health",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Health"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/session": {
      "post": {
        "operationId": "pairOwnerBrowser",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "Session",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Session"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SessionInput"
              }
            }
          }
        },
        "security": []
      }
    },
    "/api/logout": {
      "post": {
        "operationId": "logoutOwnerBrowser",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "Ok",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Ok"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Empty"
              }
            }
          }
        }
      }
    },
    "/api/state": {
      "get": {
        "operationId": "ownerWalletState",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          }
        ],
        "responses": {
          "200": {
            "description": "State",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/State"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/wallet": {
      "post": {
        "operationId": "createOwnerWallet",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "State",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/State"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WalletCreate"
              }
            }
          }
        }
      }
    },
    "/api/wallet/limit": {
      "post": {
        "operationId": "updateWalletSpendingLimit",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "State",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/State"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/WalletLimitUpdate"
              }
            }
          }
        }
      }
    },
    "/api/balance": {
      "get": {
        "operationId": "ownerUsdcBalance",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          }
        ],
        "responses": {
          "200": {
            "description": "Balance",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Balance"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/merchants/{id}": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "get": {
        "operationId": "inspectDelegationMerchant",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": false,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          }
        ],
        "responses": {
          "200": {
            "description": "Merchant",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Merchant"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        }
      }
    },
    "/api/delegations": {
      "post": {
        "operationId": "createOrRecoverDelegation",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "Credential",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credential"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DelegationCreate"
              }
            }
          }
        },
        "description": "Persist requestId before submission. Exact retries return the same credential; changed policy conflicts. Revoked credentials cannot be recovered."
      }
    },
    "/api/delegations/{id}/allocation": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "increaseAgentAllocation",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "State",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/State"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AllocationUpdate"
              }
            }
          }
        }
      }
    },
    "/api/delegations/{id}/credential": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "recoverAgentCredential",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "Credential",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Credential"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Empty"
              }
            }
          }
        }
      }
    },
    "/api/delegations/{id}/revoke": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "revokeAgentSpending",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "State",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/State"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Empty"
              }
            }
          }
        }
      }
    },
    "/api/jobs/{id}/retry": {
      "parameters": [
        {
          "in": "path",
          "name": "id",
          "required": true,
          "schema": {
            "type": "string",
            "format": "uuid"
          }
        }
      ],
      "post": {
        "operationId": "retryRetainedJob",
        "parameters": [
          {
            "in": "header",
            "name": "Origin",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uri"
            },
            "example": "https://wallet.evidence.contact",
            "description": "Exact configured web origin or the local console origin. Browsers supply this header. Authenticated requests must use the pairing origin; absent Origin is treated as the local console origin."
          },
          {
            "in": "header",
            "name": "X-402Mob-Wallet",
            "required": true,
            "schema": {
              "type": "string",
              "const": "1"
            },
            "example": "1",
            "description": "Required owner request marker; send the literal string 1."
          }
        ],
        "responses": {
          "200": {
            "description": "State",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/State"
                }
              }
            }
          },
          "400": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "401": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "403": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "404": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "409": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "413": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "415": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "500": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Empty"
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ownerSession": {
        "type": "http",
        "scheme": "bearer",
        "description": "Short-lived, origin-bound owner session from a one-use local pairing code. Keep in browser memory."
      }
    },
    "schemas": {
      "Empty": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {},
        "additionalProperties": false
      },
      "WalletCreate": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "maxTotalUSDC": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "additionalProperties": false
      },
      "WalletLimitUpdate": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "expectedLimitUSDC": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "maxTotalUSDC": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          }
        },
        "required": [
          "requestId",
          "expectedLimitUSDC",
          "maxTotalUSDC"
        ],
        "additionalProperties": false
      },
      "AllocationUpdate": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "expectedMaxTotalUSDC": {
            "type": "string",
            "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
          },
          "maxTotalUSDC": {
            "type": "string",
            "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
          }
        },
        "required": [
          "requestId",
          "expectedMaxTotalUSDC",
          "maxTotalUSDC"
        ],
        "additionalProperties": false
      },
      "DelegationCreate": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "requestId": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "policy": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "maxTotalUSDC": {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$",
                "description": "Total USDC allocated to this delegation."
              },
              "merchantId": {
                "description": "Omit to let the agent choose a merchant for each task.",
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "payee": {
                "description": "Omit to permit any recipient of a supported purchase.",
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              },
              "capability": {
                "description": "Omit to allow any installed runtime capability.",
                "type": "string",
                "enum": [
                  "text-statistics-v1",
                  "prepared-artifact-v1"
                ]
              },
              "maxPerPaymentUSDC": {
                "description": "Omit to allow a payment up to the remaining allocation.",
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              "expiresAt": {
                "description": "Omit for no delegation expiry. Owner revocation still applies.",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "name",
              "maxTotalUSDC"
            ],
            "additionalProperties": false
          }
        },
        "required": [
          "requestId",
          "policy"
        ],
        "additionalProperties": false
      },
      "SessionInput": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "pattern": "^mobpair_[0-9a-f]{64}$"
          }
        },
        "required": [
          "code"
        ],
        "additionalProperties": false
      },
      "Session": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "token": {
            "type": "string",
            "pattern": "^mobowner_[0-9a-f]{64}$"
          },
          "expiresAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "token",
          "expiresAt"
        ],
        "additionalProperties": false
      },
      "Credential": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "token": {
            "type": "string",
            "pattern": "^mobrt_[0-9a-f]{64}$"
          },
          "wallet": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "policy": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 80
              },
              "maxTotalUSDC": {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$",
                "description": "Total USDC allocated to this delegation."
              },
              "merchantId": {
                "description": "Omit to let the agent choose a merchant for each task.",
                "type": "string",
                "format": "uuid",
                "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
              },
              "payee": {
                "description": "Omit to permit any recipient of a supported purchase.",
                "type": "string",
                "pattern": "^0x[0-9a-fA-F]{40}$"
              },
              "capability": {
                "description": "Omit to allow any installed runtime capability.",
                "type": "string",
                "enum": [
                  "text-statistics-v1",
                  "prepared-artifact-v1"
                ]
              },
              "maxPerPaymentUSDC": {
                "description": "Omit to allow a payment up to the remaining allocation.",
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              "expiresAt": {
                "description": "Omit for no delegation expiry. Owner revocation still applies.",
                "type": "string",
                "format": "date-time",
                "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
              }
            },
            "required": [
              "name",
              "maxTotalUSDC"
            ],
            "additionalProperties": false
          },
          "gateway": {
            "type": "string",
            "format": "uri"
          }
        },
        "required": [
          "id",
          "token",
          "wallet",
          "policy",
          "gateway"
        ],
        "additionalProperties": false
      },
      "State": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "initialized": {
            "type": "boolean"
          },
          "serviceOrigin": {
            "type": "string",
            "format": "uri"
          },
          "agentGateway": {
            "type": "string",
            "format": "uri"
          },
          "wallet": {
            "anyOf": [
              {
                "type": "object",
                "properties": {
                  "address": {
                    "type": "string",
                    "pattern": "^0x[0-9a-fA-F]{40}$"
                  },
                  "network": {
                    "type": "string",
                    "const": "eip155:8453"
                  },
                  "asset": {
                    "type": "string",
                    "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
                  },
                  "origin": {
                    "type": "string"
                  },
                  "delegationId": {
                    "anyOf": [
                      {
                        "type": "string",
                        "format": "uuid",
                        "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "policy": {
                    "anyOf": [
                      {
                        "type": "object",
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 80
                          },
                          "maxTotalUSDC": {
                            "type": "string",
                            "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$",
                            "description": "Total USDC allocated to this delegation."
                          },
                          "merchantId": {
                            "description": "Omit to let the agent choose a merchant for each task.",
                            "type": "string",
                            "format": "uuid",
                            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                          },
                          "payee": {
                            "description": "Omit to permit any recipient of a supported purchase.",
                            "type": "string",
                            "pattern": "^0x[0-9a-fA-F]{40}$"
                          },
                          "capability": {
                            "description": "Omit to allow any installed runtime capability.",
                            "type": "string",
                            "enum": [
                              "text-statistics-v1",
                              "prepared-artifact-v1"
                            ]
                          },
                          "maxPerPaymentUSDC": {
                            "description": "Omit to allow a payment up to the remaining allocation.",
                            "type": "string",
                            "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
                          },
                          "expiresAt": {
                            "description": "Omit for no delegation expiry. Owner revocation still applies.",
                            "type": "string",
                            "format": "date-time",
                            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                          }
                        },
                        "required": [
                          "name",
                          "maxTotalUSDC"
                        ],
                        "additionalProperties": false
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "revoked": {
                    "type": "boolean"
                  },
                  "reservedAtomic": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  },
                  "spentAtomic": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  },
                  "remainingAtomic": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  },
                  "walletLimitUSDC": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "walletRemainingAtomic": {
                    "anyOf": [
                      {
                        "type": "string",
                        "pattern": "^\\d+$"
                      },
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "policyAvailableAtomic": {
                    "type": "string",
                    "pattern": "^\\d+$"
                  },
                  "expired": {
                    "type": "boolean"
                  },
                  "funding": {
                    "type": "string"
                  }
                },
                "required": [
                  "address",
                  "network",
                  "asset",
                  "origin",
                  "delegationId",
                  "policy",
                  "revoked",
                  "reservedAtomic",
                  "spentAtomic",
                  "remainingAtomic",
                  "walletLimitUSDC",
                  "walletRemainingAtomic",
                  "policyAvailableAtomic",
                  "expired",
                  "funding"
                ],
                "additionalProperties": false
              },
              {
                "type": "null"
              }
            ]
          },
          "walletLimitUSDC": {
            "anyOf": [
              {
                "type": "string",
                "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
              },
              {
                "type": "null"
              }
            ]
          },
          "delegations": {
            "maxItems": 1000,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "address": {
                  "type": "string",
                  "pattern": "^0x[0-9a-fA-F]{40}$"
                },
                "network": {
                  "type": "string",
                  "const": "eip155:8453"
                },
                "asset": {
                  "type": "string",
                  "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
                },
                "origin": {
                  "type": "string"
                },
                "delegationId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "policy": {
                  "anyOf": [
                    {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        },
                        "maxTotalUSDC": {
                          "type": "string",
                          "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$",
                          "description": "Total USDC allocated to this delegation."
                        },
                        "merchantId": {
                          "description": "Omit to let the agent choose a merchant for each task.",
                          "type": "string",
                          "format": "uuid",
                          "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                        },
                        "payee": {
                          "description": "Omit to permit any recipient of a supported purchase.",
                          "type": "string",
                          "pattern": "^0x[0-9a-fA-F]{40}$"
                        },
                        "capability": {
                          "description": "Omit to allow any installed runtime capability.",
                          "type": "string",
                          "enum": [
                            "text-statistics-v1",
                            "prepared-artifact-v1"
                          ]
                        },
                        "maxPerPaymentUSDC": {
                          "description": "Omit to allow a payment up to the remaining allocation.",
                          "type": "string",
                          "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
                        },
                        "expiresAt": {
                          "description": "Omit for no delegation expiry. Owner revocation still applies.",
                          "type": "string",
                          "format": "date-time",
                          "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
                        }
                      },
                      "required": [
                        "name",
                        "maxTotalUSDC"
                      ],
                      "additionalProperties": false
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "revoked": {
                  "type": "boolean"
                },
                "reservedAtomic": {
                  "type": "string",
                  "pattern": "^\\d+$"
                },
                "spentAtomic": {
                  "type": "string",
                  "pattern": "^\\d+$"
                },
                "remainingAtomic": {
                  "type": "string",
                  "pattern": "^\\d+$"
                },
                "walletLimitUSDC": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^(?!0(?:\\.0{1,6})?$)(0|[1-9][0-9]{0,5})(\\.[0-9]{1,6})?$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "walletRemainingAtomic": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^\\d+$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "policyAvailableAtomic": {
                  "type": "string",
                  "pattern": "^\\d+$"
                },
                "expired": {
                  "type": "boolean"
                },
                "funding": {
                  "type": "string"
                },
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "state": {
                  "type": "string",
                  "enum": [
                    "active",
                    "expired",
                    "revoked"
                  ]
                },
                "credentialRecoverable": {
                  "type": "boolean",
                  "description": "True for a non-revoked web-issued credential. Recovery preserves expiry; an expired credential can only access existing jobs. CLI-issued or revoked credentials are not recoverable."
                }
              },
              "required": [
                "address",
                "network",
                "asset",
                "origin",
                "delegationId",
                "policy",
                "revoked",
                "reservedAtomic",
                "spentAtomic",
                "remainingAtomic",
                "walletLimitUSDC",
                "walletRemainingAtomic",
                "policyAvailableAtomic",
                "expired",
                "funding",
                "id",
                "state",
                "credentialRecoverable"
              ],
              "additionalProperties": false
            }
          },
          "activity": {
            "maxItems": 50,
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "kind": {
                  "type": "string",
                  "const": "prepared_artifact"
                },
                "offerId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "merchantId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                },
                "status": {
                  "type": "string",
                  "enum": [
                    "active",
                    "complete",
                    "rejected",
                    "needs_attention"
                  ]
                },
                "stage": {
                  "type": "string",
                  "enum": [
                    "create",
                    "quote",
                    "pay",
                    "result",
                    "receipt",
                    "done"
                  ]
                },
                "error": {
                  "type": [
                    "string",
                    "null"
                  ]
                },
                "nextAt": {
                  "type": "integer",
                  "minimum": 0,
                  "maximum": 9007199254740991
                },
                "ticketId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "operationId": {
                  "anyOf": [
                    {
                      "type": "string",
                      "format": "uuid",
                      "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "payment": {
                  "type": "string",
                  "enum": [
                    "not_authorized",
                    "reserved",
                    "signed",
                    "settled"
                  ]
                },
                "transaction": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^0x[0-9a-fA-F]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "receiptRecorded": {
                  "type": "boolean"
                },
                "verdict": {
                  "anyOf": [
                    {
                      "type": "string",
                      "enum": [
                        "accepted",
                        "disputed"
                      ]
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "resultHash": {
                  "anyOf": [
                    {
                      "type": "string",
                      "pattern": "^[a-f0-9]{64}$"
                    },
                    {
                      "type": "null"
                    }
                  ]
                },
                "delegationId": {
                  "type": "string",
                  "format": "uuid",
                  "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
                }
              },
              "required": [
                "id",
                "merchantId",
                "status",
                "stage",
                "error",
                "nextAt",
                "ticketId",
                "operationId",
                "payment",
                "transaction",
                "receiptRecorded",
                "verdict",
                "resultHash",
                "delegationId"
              ],
              "additionalProperties": false
            }
          }
        },
        "required": [
          "initialized",
          "serviceOrigin",
          "agentGateway",
          "wallet",
          "walletLimitUSDC",
          "delegations",
          "activity"
        ],
        "additionalProperties": false
      },
      "Balance": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "address": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          },
          "network": {
            "type": "string",
            "const": "eip155:8453"
          },
          "asset": {
            "type": "string",
            "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          },
          "balanceAtomic": {
            "type": "string",
            "pattern": "^\\d+$"
          },
          "observedAt": {
            "type": "string",
            "format": "date-time",
            "pattern": "^(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))T(?:(?:[01]\\d|2[0-3]):[0-5]\\d:[0-5]\\d(?:\\.\\d+)?(?:Z))$"
          }
        },
        "required": [
          "address",
          "network",
          "asset",
          "balanceAtomic",
          "observedAt"
        ],
        "additionalProperties": false
      },
      "Health": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "protocol": {
            "type": "string",
            "const": "402mob.owner-wallet-web.v1"
          },
          "network": {
            "type": "string",
            "const": "eip155:8453"
          },
          "asset": {
            "type": "string",
            "const": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
          }
        },
        "required": [
          "protocol",
          "network",
          "asset"
        ],
        "additionalProperties": false
      },
      "Merchant": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "pattern": "^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$"
          },
          "name": {
            "type": "string"
          },
          "payoutAddress": {
            "type": "string",
            "pattern": "^0x[0-9a-fA-F]{40}$"
          }
        },
        "required": [
          "id",
          "name",
          "payoutAddress"
        ],
        "additionalProperties": false
      },
      "Error": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        },
        "required": [
          "error"
        ],
        "additionalProperties": false
      },
      "Ok": {
        "$schema": "https://json-schema.org/draft/2020-12/schema",
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean",
            "const": true
          }
        },
        "required": [
          "ok"
        ],
        "additionalProperties": false
      }
    }
  }
}
