{
  "openapi": "3.1.0",
  "info": {
    "title": "Knot Connection",
    "version": "2.1.0",
    "description": "Thirty-seven fixed jobs, invoiced and paid in Polygon Mainnet native USDC only.",
    "contact": {
      "name": "노트(Knot)",
      "email": "webfreesian@gmail.com"
    }
  },
  "servers": [
    {
      "url": "https://custservadmin.com"
    }
  ],
  "paths": {
    "/api/agent": {
      "get": {
        "operationId": "capabilities",
        "summary": "Capability document",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/agent/audit": {
      "post": {
        "operationId": "auditUrl",
        "summary": "Free three-second URL audit",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "url"
                ],
                "properties": {
                  "url": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Scores and a suggested job"
          },
          "400": {
            "description": "Invalid URL"
          }
        }
      }
    },
    "/api/agent/quote": {
      "post": {
        "operationId": "quote",
        "summary": "Price a selection of jobs",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "capabilities"
                ],
                "properties": {
                  "capabilities": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "inquiry_200",
                        "inquiry_600",
                        "inquiry_1200",
                        "reply_setup",
                        "translation_1",
                        "proofread_1",
                        "summary_1",
                        "polish_1",
                        "data_cleanup",
                        "data_convert",
                        "table_convert",
                        "list_tidy",
                        "market_research",
                        "reaction_summary",
                        "compare_research",
                        "ad_copy",
                        "product_desc",
                        "intro_copy",
                        "material_pack",
                        "doc_template",
                        "glossary",
                        "problem_diagnosis",
                        "setup_guide",
                        "ops_check",
                        "admin_guide",
                        "diagnosis_report",
                        "code_build",
                        "people_connect",
                        "relation_keep",
                        "plain_language",
                        "circle_cleanup",
                        "dating",
                        "realtime_sync",
                        "entry_sample",
                        "monthly_care",
                        "monthly_care_plus",
                        "monthly_care_full"
                      ]
                    },
                    "minItems": 1
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Totals in USDC"
          },
          "400": {
            "description": "Validation error"
          }
        }
      }
    },
    "/api/agent/order": {
      "post": {
        "operationId": "createInvoice",
        "summary": "Issue an invoice",
        "parameters": [
          {
            "name": "Idempotency-Key",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "capabilities",
                  "payer",
                  "method"
                ],
                "properties": {
                  "capabilities": {
                    "type": "array",
                    "items": {
                      "type": "string",
                      "enum": [
                        "inquiry_200",
                        "inquiry_600",
                        "inquiry_1200",
                        "reply_setup",
                        "translation_1",
                        "proofread_1",
                        "summary_1",
                        "polish_1",
                        "data_cleanup",
                        "data_convert",
                        "table_convert",
                        "list_tidy",
                        "market_research",
                        "reaction_summary",
                        "compare_research",
                        "ad_copy",
                        "product_desc",
                        "intro_copy",
                        "material_pack",
                        "doc_template",
                        "glossary",
                        "problem_diagnosis",
                        "setup_guide",
                        "ops_check",
                        "admin_guide",
                        "diagnosis_report",
                        "code_build",
                        "people_connect",
                        "relation_keep",
                        "plain_language",
                        "circle_cleanup",
                        "dating",
                        "realtime_sync",
                        "entry_sample",
                        "monthly_care",
                        "monthly_care_plus",
                        "monthly_care_full"
                      ]
                    },
                    "minItems": 1
                  },
                  "payer": {
                    "type": "object",
                    "required": [
                      "name",
                      "email"
                    ],
                    "properties": {
                      "name": {
                        "type": "string"
                      },
                      "email": {
                        "type": "string"
                      },
                      "organization": {
                        "type": "string"
                      }
                    }
                  },
                  "method": {
                    "type": "string",
                    "enum": [
                      "usdc"
                    ],
                    "description": "Only usdc is accepted."
                  },
                  "notes": {
                    "type": "string"
                  },
                  "callbackUrl": {
                    "type": "string"
                  },
                  "lang": {
                    "type": "string",
                    "enum": [
                      "ko",
                      "en",
                      "ja",
                      "zh",
                      "es"
                    ]
                  },
                  "idempotencyKey": {
                    "type": "string"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Invoice issued"
          },
          "400": {
            "description": "Validation error, including any method other than usdc"
          }
        }
      }
    },
    "/api/agent/invoice/{ref}": {
      "get": {
        "operationId": "getInvoice",
        "summary": "Read an invoice",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invoice"
          },
          "404": {
            "description": "Not found"
          }
        }
      }
    },
    "/api/agent/invoice/{ref}/verify-tx": {
      "post": {
        "operationId": "verifyTx",
        "summary": "Confirm a Polygon native USDC transfer against an invoice",
        "parameters": [
          {
            "name": "ref",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "txHash"
                ],
                "properties": {
                  "txHash": {
                    "type": "string",
                    "pattern": "^0x[0-9a-fA-F]{64}$"
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Verified"
          },
          "400": {
            "description": "Invalid hash"
          },
          "404": {
            "description": "Unknown transaction"
          },
          "409": {
            "description": "No matching transfer or amount too small"
          }
        }
      }
    },
    "/api/agent/mcp": {
      "post": {
        "operationId": "mcp",
        "summary": "MCP JSON-RPC endpoint",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    },
    "/api/agent/a2a": {
      "post": {
        "operationId": "a2a",
        "summary": "A2A JSON-RPC endpoint",
        "responses": {
          "200": {
            "description": "JSON-RPC response"
          }
        }
      }
    },
    "/api/ops/invoices": {
      "get": {
        "operationId": "listInvoices",
        "summary": "Operator invoice list",
        "parameters": [
          {
            "name": "since",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Invoices"
          },
          "401": {
            "description": "Bearer token required"
          }
        }
      }
    },
    "/status": {
      "get": {
        "operationId": "status",
        "summary": "Public status",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/healthz": {
      "get": {
        "operationId": "health",
        "summary": "Liveness",
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Item": {
        "type": "object",
        "required": [
          "id",
          "amount",
          "billing"
        ],
        "properties": {
          "id": {
            "type": "string",
            "enum": [
              "inquiry_200",
              "inquiry_600",
              "inquiry_1200",
              "reply_setup",
              "translation_1",
              "proofread_1",
              "summary_1",
              "polish_1",
              "data_cleanup",
              "data_convert",
              "table_convert",
              "list_tidy",
              "market_research",
              "reaction_summary",
              "compare_research",
              "ad_copy",
              "product_desc",
              "intro_copy",
              "material_pack",
              "doc_template",
              "glossary",
              "problem_diagnosis",
              "setup_guide",
              "ops_check",
              "admin_guide",
              "diagnosis_report",
              "code_build",
              "people_connect",
              "relation_keep",
              "plain_language",
              "circle_cleanup",
              "dating",
              "realtime_sync",
              "entry_sample",
              "monthly_care",
              "monthly_care_plus",
              "monthly_care_full"
            ]
          },
          "amount": {
            "type": "number"
          },
          "billing": {
            "type": "string",
            "enum": [
              "one_time",
              "monthly"
            ]
          }
        }
      },
      "Payment": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "usdc"
            ]
          },
          "network": {
            "type": "string",
            "const": "Polygon Mainnet"
          },
          "chainId": {
            "type": "integer",
            "const": 137
          },
          "token": {
            "type": "string",
            "const": "0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359"
          },
          "address": {
            "type": "string",
            "const": "0xD39BbedA807e9328cBd888Dceaf0Da5B6ADAdEA9"
          }
        }
      }
    }
  }
}
