{
  "openapi": "3.1.0",
  "info": {
    "title": "Rubric Protocol - Attested x402 Services",
    "version": "1.0.0",
    "description": "Post-quantum attestation and evidence services for AI agents. Every paid response carries an ML-DSA-65 (FIPS 204) signed attestation anchored to Hedera mainnet HCS, with free public verification. Payment: x402 (USDC on Base, eip155:8453). Unpaid requests return HTTP 402 with payment terms. A failed operation is never charged. Manifest: /.well-known/x402.json - llms.txt: /llms.txt",
    "contact": {
      "email": "Scott@Rubric-Protocol.com",
      "url": "https://rubric-protocol.com"
    }
  },
  "servers": [
    {
      "url": "https://rubric-protocol.com"
    }
  ],
  "paths": {
    "/v1/x402/tiered-attest": {
      "post": {
        "operationId": "attestDecision",
        "summary": "Attest one AI decision (0.005 USD)",
        "description": "Mints one post-quantum-signed attestation, anchored to Hedera HCS within ~60s. Payment verified before mint, settled after.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string"
                  },
                  "data": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Attestation minted and settled"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/tiered-attest-batch": {
      "post": {
        "operationId": "attestBatch",
        "summary": "Bulk anchor up to 1000 records (0.035 USD)",
        "responses": {
          "200": {
            "description": "Batch anchored"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/tiered-attest-batch-xl": {
      "post": {
        "operationId": "attestBatchXL",
        "summary": "Bulk anchor up to 5000 records (0.135 USD)",
        "responses": {
          "200": {
            "description": "Batch anchored"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/attested-inference": {
      "post": {
        "operationId": "attestedInference",
        "summary": "Attested gpt-4o-mini completion (0.01 USD)",
        "description": "Chat completion plus attestation binding prompt hash, response hash, exact model version, timestamp.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "messages"
                ],
                "properties": {
                  "messages": {
                    "type": "array"
                  },
                  "max_tokens": {
                    "type": "number",
                    "maximum": 1000
                  },
                  "temperature": {
                    "type": "number"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Completion with evidence"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/attested-screening": {
      "post": {
        "operationId": "attestedScreening",
        "summary": "Multi-list sanctions screening (0.01 USD)",
        "description": "Screens OFAC SDN + Consolidated, UN, UK OFSI, EU, BIS lists (76K+ entries). Response is audit evidence: per-list results, list file hashes, query hash, anchored attestation. Normalized exact/substring match; not a compliance determination.",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 500
                  },
                  "queryId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Screening result with evidence"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/agent-record/{agentId}": {
      "get": {
        "operationId": "agentRecord",
        "summary": "Unforgeable agent operating history (0.005 USD)",
        "parameters": [
          {
            "name": "agentId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "History summary with attestation"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/verify-audit": {
      "post": {
        "operationId": "verifyAudit",
        "summary": "Independent attestation audit (0.002 USD)",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "attestationId"
                ],
                "properties": {
                  "attestationId": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Audit verdict with attestation"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/hedera-facts": {
      "get": {
        "operationId": "factsMenu",
        "summary": "Free fact menu",
        "responses": {
          "200": {
            "description": "Available facts, windows, prices"
          }
        }
      }
    },
    "/v1/x402/hedera-facts/{fact}": {
      "get": {
        "operationId": "hederaFact",
        "summary": "One attested Hedera fact (0.001 USD)",
        "parameters": [
          {
            "name": "fact",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "exchange-rate",
                "gas-fees",
                "supply",
                "nodes",
                "throughput",
                "topic-state"
              ]
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Attested fact snapshot"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/hedera-facts/all": {
      "get": {
        "operationId": "hederaFactsBundle",
        "summary": "All six facts (0.003 USD)",
        "responses": {
          "200": {
            "description": "Bundle with per-fact attestation IDs"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/regwatch-feed": {
      "get": {
        "operationId": "regwatchFeed",
        "summary": "Regulatory changes feed (0.05 USD)",
        "responses": {
          "200": {
            "description": "Structured feed, items attested on ingest"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/verify/{attestationId}": {
      "get": {
        "operationId": "verify",
        "summary": "FREE public verification",
        "parameters": [
          {
            "name": "attestationId",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verification result"
          }
        }
      }
    },
    "/v1/x402/wallet-record/{address}": {
      "get": {
        "operationId": "walletRecord",
        "summary": "Attested wallet payment history (0.005 USD)",
        "description": "Settlement count, first/last seen, total spent, services used - from an append-only settlement ledger, attested and Hedera-anchored. Scope: Rubric settlement ledger, disclosed in response. Evidence, not opinion.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Attested history summary"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    },
    "/v1/x402/check-counterparty/{address}": {
      "get": {
        "operationId": "checkCounterparty",
        "summary": "Attested pre-transaction counterparty check (0.01 USD)",
        "description": "OFAC SDN digital-currency address match + Base on-chain profile + transparent verdict with reasons, attested and anchored.",
        "parameters": [
          {
            "name": "address",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "pattern": "^0x[a-fA-F0-9]{40}$"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Verdict with evidence"
          },
          "402": {
            "description": "Payment required"
          }
        }
      }
    }
  }
}