{
  "openapi": "3.0.3",
  "info": {
    "title": "A-Identity trust tools (Circle Gateway nanopayments)",
    "version": "1.0.0",
    "description": "Know-your-agent trust tools for AI agents: ERC-8004 identity, KYA, deterministic reputation, ALLOW/WARN/DENY risk verdicts and policy guardrail bands. Paid per call in USDC through Circle Gateway (gasless, batched). Source: https://github.com/getA-Identity/A-Identity",
    "contact": {
      "email": "aybars.dorman@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://a-identity.xyz"
    }
  ],
  "paths": {
    "/api/x402/gateway/tools/verify_agent": {
      "post": {
        "operationId": "verify_agent",
        "summary": "Verify an AI agent: ERC-8004 identity + KYA status + endpoint liveness.",
        "description": "Paid: $0.001 per call in USDC through Circle Gateway nanopayments (x402 v2, scheme exact, GatewayWalletBatched). Unpaid requests answer 402 with the payment requirements in the body and the PAYMENT-REQUIRED header.",
        "x-price-usd": 0.001,
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "scheme": "exact",
          "facilitator": "circle-gateway",
          "network": "eip155:5042"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string",
                    "description": "ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  }
                },
                "required": [
                  "agentId"
                ],
                "example": {
                  "agentId": "#73232"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result plus a `settlement` record (Gateway transfer id, status, batch hash when landed)."
          },
          "400": {
            "description": "Missing input; checked before any payment is taken."
          },
          "402": {
            "description": "Payment required. Body and PAYMENT-REQUIRED header carry x402 v2 requirements."
          }
        }
      },
      "get": {
        "operationId": "verify_agent_get",
        "summary": "Verify an AI agent: ERC-8004 identity + KYA status + endpoint liveness. (query-parameter form)",
        "parameters": [
          {
            "name": "agentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST."
          },
          "402": {
            "description": "Payment required."
          }
        }
      }
    },
    "/api/x402/gateway/tools/reputation_score": {
      "post": {
        "operationId": "reputation_score",
        "summary": "Deterministic 0-1000 reputation with a full breakdown and its on-chain attestation.",
        "description": "Paid: $0.002 per call in USDC through Circle Gateway nanopayments (x402 v2, scheme exact, GatewayWalletBatched). Unpaid requests answer 402 with the payment requirements in the body and the PAYMENT-REQUIRED header.",
        "x-price-usd": 0.002,
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "scheme": "exact",
          "facilitator": "circle-gateway",
          "network": "eip155:5042"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string",
                    "description": "ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  }
                },
                "required": [
                  "agentId"
                ],
                "example": {
                  "agentId": "#73232"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result plus a `settlement` record (Gateway transfer id, status, batch hash when landed)."
          },
          "400": {
            "description": "Missing input; checked before any payment is taken."
          },
          "402": {
            "description": "Payment required. Body and PAYMENT-REQUIRED header carry x402 v2 requirements."
          }
        }
      },
      "get": {
        "operationId": "reputation_score_get",
        "summary": "Deterministic 0-1000 reputation with a full breakdown and its on-chain attestation. (query-parameter form)",
        "parameters": [
          {
            "name": "agentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST."
          },
          "402": {
            "description": "Payment required."
          }
        }
      }
    },
    "/api/x402/gateway/tools/risk_check": {
      "post": {
        "operationId": "risk_check",
        "summary": "Pre-transaction ALLOW / WARN / DENY verdict on a counterparty, with reasons.",
        "description": "Paid: $0.005 per call in USDC through Circle Gateway nanopayments (x402 v2, scheme exact, GatewayWalletBatched). Unpaid requests answer 402 with the payment requirements in the body and the PAYMENT-REQUIRED header.",
        "x-price-usd": 0.005,
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "scheme": "exact",
          "facilitator": "circle-gateway",
          "network": "eip155:5042"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string",
                    "description": "ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  },
                  "txContext": {
                    "type": "object",
                    "description": "optional object: { \"amountUsd\": number, \"payee\": \"0x address\" }"
                  }
                },
                "required": [
                  "agentId"
                ],
                "example": {
                  "agentId": "#73232",
                  "txContext": {
                    "amountUsd": 25
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result plus a `settlement` record (Gateway transfer id, status, batch hash when landed)."
          },
          "400": {
            "description": "Missing input; checked before any payment is taken."
          },
          "402": {
            "description": "Payment required. Body and PAYMENT-REQUIRED header carry x402 v2 requirements."
          }
        }
      },
      "get": {
        "operationId": "risk_check_get",
        "summary": "Pre-transaction ALLOW / WARN / DENY verdict on a counterparty, with reasons. (query-parameter form)",
        "parameters": [
          {
            "name": "agentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "txContext",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST."
          },
          "402": {
            "description": "Payment required."
          }
        }
      }
    },
    "/api/x402/gateway/tools/counterparty_check": {
      "post": {
        "operationId": "counterparty_check",
        "summary": "Deal-specific verdict between two agents: counterparty risk + same-operator self-deal detection.",
        "description": "Paid: $0.008 per call in USDC through Circle Gateway nanopayments (x402 v2, scheme exact, GatewayWalletBatched). Unpaid requests answer 402 with the payment requirements in the body and the PAYMENT-REQUIRED header.",
        "x-price-usd": 0.008,
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "scheme": "exact",
          "facilitator": "circle-gateway",
          "network": "eip155:5042"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "from": {
                    "type": "string",
                    "description": "the paying agent: ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  },
                  "to": {
                    "type": "string",
                    "description": "the counterparty: ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  },
                  "txContext": {
                    "type": "object",
                    "description": "optional object: { \"amountUsd\": number, \"payee\": \"0x address\" }"
                  }
                },
                "required": [
                  "from",
                  "to"
                ],
                "example": {
                  "from": "#73232",
                  "to": "#1259",
                  "txContext": {
                    "amountUsd": 25
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result plus a `settlement` record (Gateway transfer id, status, batch hash when landed)."
          },
          "400": {
            "description": "Missing input; checked before any payment is taken."
          },
          "402": {
            "description": "Payment required. Body and PAYMENT-REQUIRED header carry x402 v2 requirements."
          }
        }
      },
      "get": {
        "operationId": "counterparty_check_get",
        "summary": "Deal-specific verdict between two agents: counterparty risk + same-operator self-deal detection. (query-parameter form)",
        "parameters": [
          {
            "name": "from",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "to",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "txContext",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST."
          },
          "402": {
            "description": "Payment required."
          }
        }
      }
    },
    "/api/x402/gateway/tools/agent_passport": {
      "post": {
        "operationId": "agent_passport",
        "summary": "The full trust passport: identity + KYA + reputation + risk in one call.",
        "description": "Paid: $0.01 per call in USDC through Circle Gateway nanopayments (x402 v2, scheme exact, GatewayWalletBatched). Unpaid requests answer 402 with the payment requirements in the body and the PAYMENT-REQUIRED header.",
        "x-price-usd": 0.01,
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "scheme": "exact",
          "facilitator": "circle-gateway",
          "network": "eip155:5042"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string",
                    "description": "ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  }
                },
                "required": [
                  "agentId"
                ],
                "example": {
                  "agentId": "#73232"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result plus a `settlement` record (Gateway transfer id, status, batch hash when landed)."
          },
          "400": {
            "description": "Missing input; checked before any payment is taken."
          },
          "402": {
            "description": "Payment required. Body and PAYMENT-REQUIRED header carry x402 v2 requirements."
          }
        }
      },
      "get": {
        "operationId": "agent_passport_get",
        "summary": "The full trust passport: identity + KYA + reputation + risk in one call. (query-parameter form)",
        "parameters": [
          {
            "name": "agentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST."
          },
          "402": {
            "description": "Payment required."
          }
        }
      }
    },
    "/api/x402/gateway/tools/guardrail_check": {
      "post": {
        "operationId": "guardrail_check",
        "summary": "Does this agent operate under an enforced spend/trade policy, and does it respect the verdicts? Returns bands only: no caps, allowlists, symbols, amounts or holdings are ever disclosed.",
        "description": "Paid: $0.005 per call in USDC through Circle Gateway nanopayments (x402 v2, scheme exact, GatewayWalletBatched). Unpaid requests answer 402 with the payment requirements in the body and the PAYMENT-REQUIRED header.",
        "x-price-usd": 0.005,
        "x-payment": {
          "protocol": "x402",
          "version": 2,
          "scheme": "exact",
          "facilitator": "circle-gateway",
          "network": "eip155:5042"
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "agentId": {
                    "type": "string",
                    "description": "ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
                  }
                },
                "required": [
                  "agentId"
                ],
                "example": {
                  "agentId": "#73232"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "The tool result plus a `settlement` record (Gateway transfer id, status, batch hash when landed)."
          },
          "400": {
            "description": "Missing input; checked before any payment is taken."
          },
          "402": {
            "description": "Payment required. Body and PAYMENT-REQUIRED header carry x402 v2 requirements."
          }
        }
      },
      "get": {
        "operationId": "guardrail_check_get",
        "summary": "Does this agent operate under an enforced spend/trade policy, and does it respect the verdicts? Returns bands only: no caps, allowlists, symbols, amounts or holdings are ever disclosed. (query-parameter form)",
        "parameters": [
          {
            "name": "agentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Same as POST."
          },
          "402": {
            "description": "Payment required."
          }
        }
      }
    },
    "/api/x402/gateway/tools/trust_preview": {
      "get": {
        "operationId": "trust_preview",
        "summary": "Free tier: coarse trust band + flags for an agent, and the price list of the paid tools.",
        "parameters": [
          {
            "name": "agentId",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string",
              "description": "ERC-8004 token id (\"#73232\"), a CAIP id (\"eip155:<chain>:8004/<token>\"), or a 0x owner address"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Coarse band, flags and the paid price list. Free, rate-limited."
          }
        }
      }
    }
  }
}