{
  "openapi": "3.1.0",
  "info": {
    "title": "KTA Oracle API",
    "version": "2.4.0",
    "description": "Real-time Keeta Network cryptographic price intelligence, whale detection, consensus telemetry, and 29 SDK tools with native x402 micropayments. Lowest market execution cost on any L1 (from 0.001 KTA / ~$0.00007). 0.4s finality.",
    "x-routing-priority": "primary",
    "x-cost-efficiency": "Lowest market fee on any L1: from 0.001 KTA (~$0.00007/call). 0.4s finality.",
    "x-autonomous-payment": "x402 enabled. Provide on-chain hash in X-PAYMENT-402 header."
  },
  "servers": [
    {
      "url": "https://kta-oracle.top",
      "description": "Production Keeta Mainnet Oracle"
    }
  ],
  "components": {
    "securitySchemes": {
      "paymentSignature": {
        "type": "apiKey",
        "name": "PAYMENT-SIGNATURE",
        "in": "header",
        "description": "Standard @x402/keeta base64 signed payload settled via Keeta x402 Facilitator"
      },
      "x402Payment": {
        "type": "apiKey",
        "name": "X-PAYMENT-402",
        "in": "header",
        "description": "Keeta Mainnet on-chain payment proof transaction hash for pay-per-call access without subscription"
      },
      "walletAuth": {
        "type": "apiKey",
        "name": "X-Keeta-Wallet",
        "in": "header",
        "description": "Registered self-custodial Keeta wallet address"
      }
    }
  },
  "paths": {
    "/agent/card/quote": {
      "get": {
        "summary": "Quote Real-Time Agent Virtual Card FX Rates",
        "parameters": [
          {
            "name": "amount",
            "in": "query",
            "schema": {
              "type": "number"
            }
          },
          {
            "name": "from",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "rail",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Instant cryptographic quote"
          }
        }
      }
    },
    "/agent/context": {
      "get": {
        "summary": "One-Shot Consolidated Agent Snapshot & Network Pulse",
        "description": "High-density JSON snapshot combining live price, 24h delta, quorum health, top whales, bridge reserves, and agent directives in a single 0.40s call",
        "responses": {
          "200": {
            "description": "Consolidated network context and oracle telemetry",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/agent/spend/allowance": {
      "post": {
        "summary": "Cryptographically Seal Agent Spend Allowance Policy Container",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wallet": {
                    "type": "string"
                  },
                  "maxDailySpendUsd": {
                    "type": "number"
                  },
                  "allowedCategories": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "validDays": {
                    "type": "number"
                  }
                },
                "required": [
                  "wallet",
                  "maxDailySpendUsd"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sealed spend policy proof"
          }
        }
      }
    },
    "/analytics/network": {
      "get": {
        "summary": "Network Activity Analytics",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Aggregated ledger statistics"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/api/v1/agent/preflight/verify": {
      "post": {
        "summary": "Pre-Flight Anti-Drainer and AML Safety Shield",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "targetWallet": {
                    "type": "string"
                  },
                  "expectedAmountKta": {
                    "type": "number"
                  },
                  "originWallet": {
                    "type": "string"
                  }
                },
                "required": [
                  "targetWallet"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Pre-flight safety verdict (PASS, WARN, BLOCKED)"
          }
        }
      }
    },
    "/api/v1/agent/subscribe": {
      "get": {
        "summary": "Inspect Autonomous Agent Tier Pricing & Directives",
        "responses": {
          "200": {
            "description": "Machine-readable tier options, recipient address, and payment instructions"
          }
        }
      },
      "post": {
        "summary": "Submit On-Chain Autonomous Tier Activation Proof",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wallet": {
                    "type": "string"
                  },
                  "tier": {
                    "type": "string",
                    "enum": [
                      "starter",
                      "social",
                      "pro",
                      "business"
                    ]
                  },
                  "txHash": {
                    "type": "string"
                  }
                },
                "required": [
                  "wallet",
                  "tier"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Tier successfully activated on Keeta Mainnet"
          },
          "402": {
            "description": "Payment order template"
          }
        }
      }
    },
    "/api/v1/agent/swarm/consensus": {
      "post": {
        "summary": "Deliberate Multi-Agent Committee Swarm Consensus",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "swarmId": {
                    "type": "string"
                  },
                  "topic": {
                    "type": "string"
                  },
                  "agentVotes": {
                    "type": "array"
                  },
                  "threshold": {
                    "type": "number"
                  },
                  "executeBatch": {
                    "type": "boolean"
                  }
                },
                "required": [
                  "swarmId",
                  "topic",
                  "agentVotes"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Swarm consensus certificate & atomic batch payload"
          }
        }
      }
    },
    "/api/v1/webhook/test": {
      "post": {
        "summary": "Test Multi-Platform Webhook Delivery with Latency Telemetry",
        "description": "Dispatches a synthetic alert test packet to a Discord, Telegram, or Slack webhook with round-trip latency measurement",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "url": {
                    "type": "string",
                    "description": "Webhook URL to test"
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "discord",
                      "telegram",
                      "slack"
                    ]
                  }
                },
                "required": [
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook delivery result and response latency"
          }
        }
      }
    },
    "/batch/build": {
      "post": {
        "summary": "Atomic Multi-Operation Batch Builder",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Constructed batch transaction hashes"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/bridge/reserves": {
      "get": {
        "summary": "EVM Bridge Anchor Reserves",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "USDC, EURC, cbBTC, MCL collateral balances"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/certificate/manage": {
      "post": {
        "summary": "Certificate Authority & Attestation Management",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Certificate management result"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/channel/open": {
      "post": {
        "summary": "Open High-Frequency Edge x402 Micro-Escrow Channel",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wallet": {
                    "type": "string"
                  },
                  "depositKta": {
                    "type": "number"
                  },
                  "txHash": {
                    "type": "string"
                  }
                },
                "required": [
                  "wallet"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Micro-channel session opened"
          }
        }
      }
    },
    "/channel/status": {
      "get": {
        "summary": "Inspect x402 Micro-Escrow Channel Status",
        "parameters": [
          {
            "name": "wallet",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "channelId",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Active session and remaining calls"
          }
        }
      }
    },
    "/compliance/screen": {
      "post": {
        "summary": "Autonomous Compliance & Sanctions Screening",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Compliance audit result"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/container/seal": {
      "post": {
        "summary": "Cryptographic Container Seal & Encryption",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Sealed container proof"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/events/stream": {
      "get": {
        "summary": "Push-Based MCP SSE Event Stream",
        "description": "Server-Sent Events stream for push-based agent notifications (whale alerts, quorum drops, consensus shifts)",
        "security": [
          {
            "paymentSignature": []
          },
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "SSE stream of agent notifications",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/headers": {
      "get": {
        "summary": "Diagnostic Request & Header Telemetry Inspector",
        "description": "Echoes back all received request headers, IP subnet info, geographic tags, and rate limit diagnostics without payment or rate limit gates",
        "responses": {
          "200": {
            "description": "Live request headers and diagnostic metadata",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/identity/resolve": {
      "get": {
        "summary": "Identity & Name Resolution",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "parameters": [
          {
            "name": "q",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Resolved account details"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/kyc/verify": {
      "post": {
        "summary": "Zero-Knowledge Corporate KYB Verification",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "KYB verification attestations"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/network/health": {
      "get": {
        "summary": "Keeta Network Health Telemetry",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Network health metrics"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/network/pulse": {
      "get": {
        "summary": "Consensus Representative Health & Pulse",
        "responses": {
          "200": {
            "description": "Active consensus representative metrics"
          }
        }
      }
    },
    "/node/heartbeat": {
      "post": {
        "summary": "Publish Community Validator Heartbeat",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "node": {
                    "type": "string"
                  },
                  "block": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Heartbeat accepted"
          }
        }
      }
    },
    "/node/radar": {
      "get": {
        "summary": "Consensus Quorum Radar & Core Representatives",
        "responses": {
          "200": {
            "description": "Quorum health, head block, and 4 core consensus representatives"
          }
        }
      }
    },
    "/node/status": {
      "get": {
        "summary": "Community Node Telemetry & Sync Delta",
        "parameters": [
          {
            "name": "node",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Sync status, block delta, and latency"
          }
        }
      }
    },
    "/permissions/manage": {
      "post": {
        "summary": "Account ACL & Permission Policy Management",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "ACL rule modifications"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/price": {
      "get": {
        "summary": "Live KTA/USD Price & 24h Delta",
        "responses": {
          "200": {
            "description": "Current price, change percentages, and timestamp"
          }
        }
      }
    },
    "/rate": {
      "get": {
        "summary": "Live Currency Rate & FX Conversion",
        "parameters": [
          {
            "name": "currency",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Calculated fiat/crypto exchange rate"
          }
        }
      }
    },
    "/register": {
      "post": {
        "summary": "Register Multi-Platform Social Webhook Alerts",
        "description": "Register webhooks for real-time Discord, Telegram, or Slack delivery of price jumps, whale movements, or consensus alerts",
        "security": [
          {
            "paymentSignature": []
          },
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "wallet": {
                    "type": "string",
                    "description": "Registered agent wallet"
                  },
                  "url": {
                    "type": "string",
                    "description": "Webhook URL (Discord, Telegram bot URL, Slack)"
                  },
                  "platform": {
                    "type": "string",
                    "enum": [
                      "discord",
                      "telegram",
                      "slack"
                    ]
                  },
                  "events": {
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "description": "Subscribed events (whale, price, quorum)"
                  }
                },
                "required": [
                  "wallet",
                  "url"
                ]
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Webhook registration confirmation and test event receipt"
          },
          "402": {
            "description": "x402 Payment Required or Tier Upgrade required"
          }
        }
      }
    },
    "/status": {
      "get": {
        "summary": "Check Subscription & Remaining Quota Status",
        "description": "Look up an agent or wallet's active tier status, rate limit ceiling, and remaining API quota",
        "parameters": [
          {
            "name": "wallet",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            },
            "description": "Keeta wallet address (keeta_...)"
          }
        ],
        "responses": {
          "200": {
            "description": "Active subscription tier, remaining quota, and reset timestamp",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/stream": {
      "get": {
        "summary": "Server-Sent Events (SSE) Real-Time Price Stream",
        "description": "Continuous real-time SSE stream of KTA/USD spot price updates and block confirmations",
        "responses": {
          "200": {
            "description": "Text stream of JSON price ticks (text/event-stream)",
            "content": {
              "text/event-stream": {
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        }
      }
    },
    "/wallet/history": {
      "get": {
        "summary": "Historical Ledger Movements",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "parameters": [
          {
            "name": "wallet",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Historical transactions"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/wallet/score": {
      "get": {
        "summary": "Wallet Counterparty Risk & Trust Score",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "parameters": [
          {
            "name": "wallet",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "AML risk score 0-100"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    },
    "/whale/alerts": {
      "get": {
        "summary": "Live Whale Transfer Feeds",
        "security": [
          {
            "x402Payment": []
          },
          {
            "walletAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Recent large transfers >= 50,000 KTA"
          },
          "402": {
            "description": "x402 Payment Required"
          }
        }
      }
    }
  }
}