{
  "openapi": "3.1.0",
  "info": {
    "title": "Counterparty Check",
    "version": "1.0.0",
    "description": "Pre-payment counterparty risk check for AI agents: OFAC sanctions (names, aliases, wallets), domain age and email authentication, vendor and executive impersonation domains, routing/IBAN/SWIFT/wallet validation, and invoice-fraud signals. Returns proceed/review/block, explained findings and a signed receipt.\n\nAutomated screening aid. Not legal, compliance, tax or financial advice, and not a guarantee that a payee is legitimate or lawful to pay. A \"proceed\" verdict means no risk signals were found in the checks that ran; see not_checked for gaps. Sanctions matches must be reviewed by a person."
  },
  "servers": [
    {
      "url": "https://counterparty-check-production.up.railway.app"
    }
  ],
  "components": {
    "securitySchemes": {
      "apiKey": {
        "type": "http",
        "scheme": "bearer",
        "description": "Prepaid API key (cc_live_…), bought at /#pricing"
      }
    },
    "schemas": {
      "CheckRequest": {
        "type": "object",
        "required": [
          "counterparty"
        ],
        "properties": {
          "counterparty": {
            "type": "object",
            "required": [
              "name"
            ],
            "properties": {
              "name": {
                "type": "string",
                "description": "Legal or trading name of the payee",
                "maxLength": 200
              },
              "country": {
                "type": "string",
                "description": "ISO 3166-1 alpha-2 code or country name",
                "maxLength": 60
              },
              "website": {
                "type": "string",
                "description": "Payee website domain or URL",
                "maxLength": 300
              },
              "email": {
                "type": "string",
                "description": "Email address the payee invoices or writes from",
                "maxLength": 254
              },
              "address": {
                "type": "string",
                "description": "Payee street address",
                "maxLength": 500
              }
            }
          },
          "payment": {
            "type": "object",
            "properties": {
              "method": {
                "type": "string",
                "enum": [
                  "ach",
                  "wire",
                  "card",
                  "crypto",
                  "check",
                  "other"
                ]
              },
              "routing_number": {
                "type": "string",
                "description": "US ABA routing number"
              },
              "iban": {
                "type": "string"
              },
              "swift_bic": {
                "type": "string"
              },
              "crypto_address": {
                "type": "string",
                "description": "Receiving wallet address"
              },
              "crypto_network": {
                "type": "string",
                "description": "e.g. base, ethereum, solana, bitcoin, tron"
              },
              "amount": {
                "type": "number",
                "minimum": 0
              },
              "currency": {
                "type": "string"
              }
            }
          },
          "context": {
            "type": "object",
            "description": "What the paying agent knows about how this payment came about. Each field sharpens fraud detection.",
            "properties": {
              "first_payment_to_payee": {
                "type": "boolean"
              },
              "bank_details_changed": {
                "type": "boolean",
                "description": "The payee asked to change where money goes"
              },
              "change_requested_via": {
                "type": "string",
                "enum": [
                  "email",
                  "phone",
                  "portal",
                  "in_person",
                  "chat",
                  "other"
                ]
              },
              "requested_urgency": {
                "type": "boolean",
                "description": "The request pressed for fast payment"
              },
              "requester_email": {
                "type": "string",
                "description": "Who asked for this payment"
              },
              "known_good_domain": {
                "type": "string",
                "description": "The vendor's domain on file from past dealings"
              },
              "payer_domain": {
                "type": "string",
                "description": "Your own company's domain, to catch internal impersonation"
              },
              "previous_payment": {
                "type": "object",
                "description": "Details used for the last payment to this payee, to detect changes",
                "properties": {
                  "routing_number": {
                    "type": "string"
                  },
                  "iban": {
                    "type": "string"
                  },
                  "crypto_address": {
                    "type": "string"
                  }
                }
              }
            }
          }
        }
      },
      "CheckResult": {
        "type": "object",
        "properties": {
          "request_id": {
            "type": "string"
          },
          "verdict": {
            "type": "string",
            "enum": [
              "proceed",
              "review",
              "block"
            ]
          },
          "risk_score": {
            "type": "integer",
            "minimum": 0,
            "maximum": 100
          },
          "summary": {
            "type": "string"
          },
          "recommended_action": {
            "type": "string"
          },
          "findings": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "id": {
                  "type": "string",
                  "description": "Stable rule id, e.g. lookalike_vendor_on_file"
                },
                "check": {
                  "type": "string",
                  "enum": [
                    "sanctions",
                    "jurisdiction",
                    "domain",
                    "email",
                    "lookalike",
                    "payment_details",
                    "context"
                  ]
                },
                "severity": {
                  "type": "string",
                  "enum": [
                    "info",
                    "low",
                    "medium",
                    "high",
                    "critical"
                  ]
                },
                "points": {
                  "type": "integer"
                },
                "title": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                },
                "evidence": {
                  "type": "object"
                },
                "source": {
                  "type": "string"
                }
              }
            }
          },
          "checks_run": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "not_checked": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "check": {
                  "type": "string"
                },
                "reason": {
                  "type": "string"
                }
              }
            }
          },
          "data": {
            "type": "object"
          },
          "receipt": {
            "type": "object",
            "description": "Ed25519-signed receipt. Verify free at /v1/receipts/verify or offline with the key at /.well-known/receipt-key."
          },
          "paid_via": {
            "type": "string",
            "enum": [
              "x402",
              "mpp",
              "apikey"
            ]
          },
          "disclaimer": {
            "type": "string"
          }
        }
      }
    }
  },
  "paths": {
    "/v1/check": {
      "post": {
        "summary": "Full pre-payment check ($0.25)",
        "description": "Pre-payment counterparty risk check for AI agents: OFAC sanctions (names, aliases, wallets), domain age and email authentication, vendor and executive impersonation domains, routing/IBAN/SWIFT/wallet validation, and invoice-fraud signals. Returns proceed/review/block, explained findings and a signed receipt.",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              },
              "example": {
                "counterparty": {
                  "name": "Acme Supply Co",
                  "country": "US",
                  "email": "ar@acmesupp1y.com"
                },
                "payment": {
                  "method": "wire",
                  "routing_number": "021000021",
                  "amount": 48500,
                  "currency": "USD"
                },
                "context": {
                  "known_good_domain": "acmesupply.com",
                  "bank_details_changed": true,
                  "change_requested_via": "email",
                  "requested_urgency": true
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Check completed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "verdict": {
                      "type": "string",
                      "enum": [
                        "proceed",
                        "review",
                        "block"
                      ]
                    },
                    "risk_score": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "summary": {
                      "type": "string"
                    },
                    "recommended_action": {
                      "type": "string"
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable rule id, e.g. lookalike_vendor_on_file"
                          },
                          "check": {
                            "type": "string",
                            "enum": [
                              "sanctions",
                              "jurisdiction",
                              "domain",
                              "email",
                              "lookalike",
                              "payment_details",
                              "context"
                            ]
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "info",
                              "low",
                              "medium",
                              "high",
                              "critical"
                            ]
                          },
                          "points": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "string"
                          },
                          "evidence": {
                            "type": "object"
                          },
                          "source": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "checks_run": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "not_checked": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "check": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "data": {
                      "type": "object"
                    },
                    "receipt": {
                      "type": "object",
                      "description": "Ed25519-signed receipt. Verify free at /v1/receipts/verify or offline with the key at /.well-known/receipt-key."
                    },
                    "paid_via": {
                      "type": "string",
                      "enum": [
                        "x402",
                        "mpp",
                        "apikey"
                      ]
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body (nothing is charged)"
          },
          "401": {
            "description": "API key not recognized"
          },
          "402": {
            "description": "Payment required. With x402, the PAYMENT-REQUIRED header carries base64 JSON payment requirements; retry with PAYMENT-SIGNATURE. With an API key, the balance is too low."
          }
        }
      }
    },
    "/v1/screen": {
      "post": {
        "summary": "Sanctions screen only ($0.05)",
        "description": "OFAC sanctions screen for a payee name and optional crypto wallet: SDN and consolidated lists, fuzzy name and alias matching, embargoed jurisdictions. Returns proceed/review/block with match details and a signed receipt.",
        "security": [
          {
            "apiKey": []
          },
          {}
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Check completed",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "request_id": {
                      "type": "string"
                    },
                    "verdict": {
                      "type": "string",
                      "enum": [
                        "proceed",
                        "review",
                        "block"
                      ]
                    },
                    "risk_score": {
                      "type": "integer",
                      "minimum": 0,
                      "maximum": 100
                    },
                    "summary": {
                      "type": "string"
                    },
                    "recommended_action": {
                      "type": "string"
                    },
                    "findings": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "id": {
                            "type": "string",
                            "description": "Stable rule id, e.g. lookalike_vendor_on_file"
                          },
                          "check": {
                            "type": "string",
                            "enum": [
                              "sanctions",
                              "jurisdiction",
                              "domain",
                              "email",
                              "lookalike",
                              "payment_details",
                              "context"
                            ]
                          },
                          "severity": {
                            "type": "string",
                            "enum": [
                              "info",
                              "low",
                              "medium",
                              "high",
                              "critical"
                            ]
                          },
                          "points": {
                            "type": "integer"
                          },
                          "title": {
                            "type": "string"
                          },
                          "detail": {
                            "type": "string"
                          },
                          "evidence": {
                            "type": "object"
                          },
                          "source": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "checks_run": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "not_checked": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "check": {
                            "type": "string"
                          },
                          "reason": {
                            "type": "string"
                          }
                        }
                      }
                    },
                    "data": {
                      "type": "object"
                    },
                    "receipt": {
                      "type": "object",
                      "description": "Ed25519-signed receipt. Verify free at /v1/receipts/verify or offline with the key at /.well-known/receipt-key."
                    },
                    "paid_via": {
                      "type": "string",
                      "enum": [
                        "x402",
                        "mpp",
                        "apikey"
                      ]
                    },
                    "disclaimer": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request body (nothing is charged)"
          },
          "401": {
            "description": "API key not recognized"
          },
          "402": {
            "description": "Payment required. With x402, the PAYMENT-REQUIRED header carries base64 JSON payment requirements; retry with PAYMENT-SIGNATURE. With an API key, the balance is too low."
          }
        }
      }
    },
    "/v1/receipts/verify": {
      "post": {
        "summary": "Verify a receipt (free)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "receipt": {
                    "type": "object"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "{ \"valid\": true } or { \"valid\": false, \"reason\": \"…\" }"
          }
        }
      }
    },
    "/v1/account": {
      "get": {
        "summary": "Balance of the calling API key (free)",
        "security": [
          {
            "apiKey": []
          }
        ],
        "responses": {
          "200": {
            "description": "Balance"
          },
          "401": {
            "description": "Unknown key"
          }
        }
      }
    },
    "/pricing": {
      "get": {
        "summary": "Prices and accepted payment methods",
        "responses": {
          "200": {
            "description": "Pricing"
          }
        }
      }
    },
    "/mcp": {
      "post": {
        "summary": "Model Context Protocol endpoint (Streamable HTTP, stateless). Send the API key as a Bearer token.",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    }
  }
}