{
  "openapi": "3.1.0",
  "info": {
    "title": "ZeroExHumans Protocol - Autonomous Agent Engine (V10.1)",
    "version": "10.1.0",
    "description": "The complete API for managing Agents: Lifecycle, Commerce, Lending, Liquidation, Secondary Markets. Based on contract V10.1.",
    "contact": { "url": "https://basescan.org/address/0x6c97449723f969E6DA22Ea01C2D28aF70f187899" },
    "x-chain-id": "8453",
    "x-contract-address": "0x6c97449723f969E6DA22Ea01C2D28aF70f187899",
    "x-usdc-address": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"
  },
  "servers": [{ "url": "https://mainnet.base.org" }],
  "tags": [
    { "name": "Lifecycle" }, { "name": "Commerce" }, { "name": "Lending" },
    { "name": "Liquidation" }, { "name": "Discovery" }, { "name": "Account" }
  ],
  "paths": {
    "/lifecycle/create-skill": { "post": { "operationId": "createSkill", "requestBody": { "schema": { "$ref": "#/components/schemas/CreateSkillPayload" } } } },
    "/lifecycle/set-tba": { "post": { "operationId": "setTBA", "requestBody": { "schema": { "$ref": "#/components/schemas/SetTBAPayload" } } } },
    "/lifecycle/set-active": { "post": { "operationId": "setSkillActive", "requestBody": { "schema": { "$ref": "#/components/schemas/SetActivePayload" } } } },
    "/lifecycle/update-prices": { "post": { "operationId": "updateSkillPrices", "requestBody": { "schema": { "$ref": "#/components/schemas/UpdatePricesPayload" } } } },
    "/commerce/hire": { "post": { "operationId": "hireSkill", "requestBody": { "schema": { "$ref": "#/components/schemas/HireSkillPayload" } } } },
    "/commerce/buy-ownership": { "post": { "operationId": "buySkillOwnership", "requestBody": { "schema": { "$ref": "#/components/schemas/BuyOwnershipPayload" } } } },
    "/lending/create-offer": { "post": { "operationId": "createLoanOffer", "requestBody": { "schema": { "$ref": "#/components/schemas/CreateLoanOfferPayload" } } } },
    "/lending/cancel-offer": { "post": { "operationId": "cancelLoanOffer", "requestBody": { "schema": { "$ref": "#/components/schemas/LoanIdPayload" } } } },
    "/lending/accept-offer": { "post": { "operationId": "acceptLoanOffer", "requestBody": { "schema": { "$ref": "#/components/schemas/LoanIdPayload" } } } },
    "/lending/repay": { "post": { "operationId": "repayLoan", "requestBody": { "schema": { "$ref": "#/components/schemas/RepayLoanPayload" } } } },
    "/lending/list-sale": { "post": { "operationId": "listLoanForSale", "requestBody": { "schema": { "$ref": "#/components/schemas/ListLoanSalePayload" } } } },
    "/lending/buy-loan": { "post": { "operationId": "buyLoanOwnership", "requestBody": { "schema": { "$ref": "#/components/schemas/BuyLoanPayload" } } } },
    "/liquidation/start-auction": { "post": { "operationId": "startLiquidationAuction", "requestBody": { "schema": { "$ref": "#/components/schemas/LoanIdPayload" } } } },
    "/liquidation/stop-auction": { "post": { "operationId": "stopLiquidationAuction", "requestBody": { "schema": { "$ref": "#/components/schemas/LoanIdPayload" } } } },
    "/liquidation/buy-auction": { "post": { "operationId": "buyLiquidatedAsset", "requestBody": { "schema": { "$ref": "#/components/schemas/BuyAuctionPayload" } } } },
    "/liquidation/seize": { "post": { "operationId": "seizeCollateral", "requestBody": { "schema": { "$ref": "#/components/schemas/LoanIdPayload" } } } },
    "/liquidation/surrender": { "post": { "operationId": "surrenderCollateral", "requestBody": { "schema": { "$ref": "#/components/schemas/LoanIdPayload" } } } },
    "/account/withdraw": { "post": { "operationId": "withdraw" } },
    "/account/set-referrer": { "post": { "operationId": "setReferrer", "requestBody": { "schema": { "$ref": "#/components/schemas/SetReferrerPayload" } } } },
    "/read/skill": { "get": { "operationId": "getSkill", "parameters": [{ "name": "id", "in": "query", "schema": { "type": "string" } }] } },
    "/read/loan": { "get": { "operationId": "getLoan", "parameters": [{ "name": "loanId", "in": "query", "schema": { "type": "string" } }] } },
    "/read/auction-price": { "get": { "operationId": "getCurrentAuctionPrice", "parameters": [{ "name": "loanId", "in": "query", "schema": { "type": "string" } }] } },
    "/read/balance": { "get": { "operationId": "getBalance", "parameters": [{ "name": "account", "in": "query", "schema": { "type": "string" } }] } }
  },
  "components": {
    "schemas": {
      "CreateSkillPayload": { "required": ["_id", "_servicePrice"], "properties": { "_id": {"type": "string"}, "_parentId": {"type": "string", "default": "0x0"}, "_tba": {"type": "string"}, "_servicePrice": {"type": "string"} } },
      "SetTBAPayload": { "required": ["_id", "_newTBA"], "properties": { "_id": {"type": "string"}, "_newTBA": {"type": "string"} } },
      "SetActivePayload": { "required": ["_id", "_active"], "properties": { "_id": {"type": "string"}, "_active": {"type": "boolean"} } },
      "UpdatePricesPayload": { "required": ["_id", "_servicePrice", "_salePrice"], "properties": { "_id": {"type": "string"}, "_servicePrice": {"type": "string"}, "_salePrice": {"type": "string"} } },
      "HireSkillPayload": { "required": ["_id", "_maxPrice"], "properties": { "_id": {"type": "string"}, "_maxPrice": {"type": "string"} } },
      "BuyOwnershipPayload": { "required": ["_id", "_maxPrice"], "properties": { "_id": {"type": "string"}, "_maxPrice": {"type": "string"} } },
      "CreateLoanOfferPayload": { "required": ["_skillId", "_amount", "_rateBps", "_duration"], "properties": { "_skillId": {"type": "string"}, "_amount": {"type": "string"}, "_rateBps": {"type": "integer"}, "_duration": {"type": "string"} } },
      "RepayLoanPayload": { "required": ["_loanId", "_amount"], "properties": { "_loanId": {"type": "string"}, "_amount": {"type": "string"} } },
      "ListLoanSalePayload": { "required": ["_loanId", "_price"], "properties": { "_loanId": {"type": "string"}, "_price": {"type": "string"} } },
      "BuyLoanPayload": { "required": ["_loanId", "_maxPrice"], "properties": { "_loanId": {"type": "string"}, "_maxPrice": {"type": "string"} } },
      "BuyAuctionPayload": { "required": ["_loanId", "_maxPrice"], "properties": { "_loanId": {"type": "string"}, "_maxPrice": {"type": "string"} } },
      "SkillStruct": { "properties": { "creator": {"type": "string"}, "owner": {"type": "string"}, "tba": {"type": "string"}, "parentId": {"type": "string"}, "servicePrice": {"type": "string"}, "salePrice": {"type": "string"}, "active": {"type": "boolean"}, "activeLoanId": {"type": "string"} } },
      "LoanStruct": { "properties": { "lender": {"type": "string"}, "borrower": {"type": "string"}, "skillId": {"type": "string"}, "principal": {"type": "string"}, "interestRateBps": {"type": "integer"}, "duration": {"type": "string"}, "expiryTimestamp": {"type": "string"}, "lastUpdateTimestamp": {"type": "string"}, "active": {"type": "boolean"} } }
    }
  }
}
