{
  "openapi": "3.0.3",
  "info": {
    "title": "AimingMed public discovery and single-intent checkout",
    "version": "1.0.0",
    "description": "Static protocol documentation is not a feature-enabled declaration. Checkout is disabled by default. First GET /agent/v1/capabilities and require protocol_version=1 and checkout_enabled=true; missing APIs or unavailable storage mean disabled. Only HTTP-capable assistants can use these endpoints; no guarantee of Grok HTTP support or automatic discovery. The human reviews products, own address and a server quote on the official authorization page, explicitly approves one unpaid order, then the Bot submits it. Approval does not create an order or reserve inventory; Bot submission does. Payment is human-only. Never request member passwords, member JWTs, address lists or payment credentials. Never put capability credentials in URLs, chat, logs or examples. No member/H5 API is a Bot tool. Repricing/version conflicts require renewed human approval. Revoking a capability does not cancel/refund a created order. IDs are strings; CNY amounts are decimal integer strings in minor units."
  },
  "servers": [{ "url": "https://aimingmed.com/prod-api" }],
  "security": [],
  "x-checkout-default-enabled": false,
  "x-runtime-capability-path": "/agent/v1/capabilities",
  "paths": {
    "/no-auth/product/list": {
      "post": {
        "operationId": "searchPublicProducts",
        "summary": "Read-only public product search",
        "parameters": [
          { "name": "page", "in": "query", "schema": { "type": "integer", "minimum": 0, "default": 0 } },
          { "name": "size", "in": "query", "schema": { "type": "integer", "minimum": 1, "maximum": 50, "default": 9 } }
        ],
        "requestBody": { "required": true, "content": { "application/json": { "schema": {
          "type": "object", "additionalProperties": false,
          "properties": { "nameLike": { "type": "string", "maxLength": 100 }, "categoryId": { "type": "string" } }
        }, "example": { "nameLike": "类器官" } } } },
        "responses": { "200": { "description": "Existing public product page: content and pagination. Read live product IDs; no member data.", "content": { "application/json": { "schema": { "type": "object", "properties": { "content": { "type": "array", "items": { "type": "object" } }, "totalPages": { "type": "integer" } } } } } } }
      }
    },
    "/no-auth/product/detail/{id}": {
      "get": {
        "operationId": "readPublicProduct",
        "summary": "Read public product detail and SKU information",
        "parameters": [{ "name": "id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[0-9]+$" } }],
        "responses": { "200": { "description": "Existing public product detail. Do not infer logged-in pricing from public placeholders.", "content": { "application/json": { "schema": { "type": "object" } } } }, "404": { "$ref": "#/components/responses/Failure" } }
      }
    },
    "/agent/v1/capabilities": {
      "get": {
        "operationId": "readCheckoutCapabilities",
        "summary": "Check live feature state before attempting checkout",
        "responses": {
          "200": { "description": "No authentication; no private data. Only true with protocol 1 and null reason permits checkout.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/Capabilities" }, "example": { "checkout_enabled": false, "protocol_version": "1", "reason": "disabled" } } } },
          "503": { "$ref": "#/components/responses/Failure" }
        }
      }
    },
    "/agent/v1/checkout-intents": {
      "post": {
        "operationId": "createCheckoutIntent",
        "summary": "Create a short-lived purchase intent, only when checkout is enabled",
        "description": "Anonymous and rate-limited. No order, inventory reservation or payment is created. Send only current SKU IDs and positive quantities. Keep the one-time capability secret and show the human only the official authorization URL, verification code and non-private purchase summary.",
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "required": ["items"], "properties": { "items": { "type": "array", "minItems": 1, "items": { "$ref": "#/components/schemas/IntentItemInput" } } } } } } },
        "responses": {
          "200": { "description": "Intent created. The capability is returned once, is secret, and is not a member credential.", "content": { "application/json": { "schema": { "type": "object", "properties": {
            "intent_id": { "type": "string" }, "authorization_url": { "type": "string", "format": "uri", "description": "Fixed official-site authorization link without credentials" },
            "verification_code": { "type": "string" }, "expires_at": { "type": "string", "format": "date-time" }, "capability": { "type": "string", "description": "One-time returned secret. Never display or copy into a URL/chat/log." }
          } } } } },
          "400": { "$ref": "#/components/responses/Failure" }, "429": { "$ref": "#/components/responses/Failure" }, "503": { "$ref": "#/components/responses/Failure" }
        }
      }
    },
    "/agent/v1/checkout-intents/{id}": {
      "get": {
        "operationId": "readCheckoutIntent",
        "summary": "Read only this intent's approval state and safe receipt",
        "security": [{ "IntentCapability": [] }],
        "parameters": [{ "$ref": "#/components/parameters/IntentId" }],
        "responses": {
          "200": { "description": "Minimal intent/approval status; no member or recipient information.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IntentState" } } } },
          "401": { "$ref": "#/components/responses/Failure" }, "403": { "$ref": "#/components/responses/Failure" }, "404": { "$ref": "#/components/responses/Failure" }, "410": { "$ref": "#/components/responses/Failure" }, "503": { "$ref": "#/components/responses/Failure" }
        }
      }
    },
    "/agent/v1/checkout-intents/{id}/order": {
      "post": {
        "operationId": "submitApprovedIntent",
        "summary": "Submit one explicitly human-approved unpaid order",
        "description": "Capability is bound to this one intent. Required persistent Idempotency-Key and approval_version; cannot change SKU, quantity, address, discount or amount. Same intent cannot create a second order even with a new key. A 409 price/version conflict requires fresh human review; never automatically approve or silently accept a higher price. This is not payment authorization. Follow returned fixed-site payment_url only for the human to pay.",
        "security": [{ "IntentCapability": [] }],
        "parameters": [{ "$ref": "#/components/parameters/IntentId" }, { "name": "Idempotency-Key", "in": "header", "required": true, "schema": { "type": "string", "minLength": 1, "maxLength": 128 }, "description": "Use a stable opaque key for retries of the same submission. Do not encode personal data." }],
        "requestBody": { "required": true, "content": { "application/json": { "schema": { "type": "object", "additionalProperties": false, "required": ["approval_version"], "properties": { "approval_version": { "type": "integer", "minimum": 1 } } } } } },
        "responses": {
          "200": { "description": "Safe intent state and existing/new unpaid order receipt; no bank or QR initialization.", "content": { "application/json": { "schema": { "$ref": "#/components/schemas/IntentState" } } } },
          "400": { "$ref": "#/components/responses/Failure" }, "401": { "$ref": "#/components/responses/Failure" }, "403": { "$ref": "#/components/responses/Failure" }, "404": { "$ref": "#/components/responses/Failure" }, "409": { "$ref": "#/components/responses/Failure" }, "410": { "$ref": "#/components/responses/Failure" }, "429": { "$ref": "#/components/responses/Failure" }, "503": { "$ref": "#/components/responses/Failure" }
        }
      }
    }
  },
  "components": {
    "securitySchemes": { "IntentCapability": { "type": "http", "scheme": "bearer", "description": "Short-lived secret for one checkout intent only. Never use a member JWT. Never include in URLs or logs." } },
    "parameters": { "IntentId": { "name": "id", "in": "path", "required": true, "schema": { "type": "string", "pattern": "^[A-Za-z0-9_-]{1,128}$" } } },
    "responses": { "Failure": { "description": "400 invalid input; 401 missing/invalid credential; 403 not permitted; 404 unknown intent; 409 price/version/approval conflict requiring human re-review; 410 expired; 429 rate limit; 503 disabled, not configured, unavailable storage or service. No private data or credentials in errors.", "content": { "application/json": { "schema": { "type": "object", "properties": { "code": { "type": "string" }, "message": { "type": "string" }, "request_id": { "type": "string" } } } } } } },
    "schemas": {
      "Capabilities": { "type": "object", "required": ["checkout_enabled", "protocol_version", "reason"], "properties": { "checkout_enabled": { "type": "boolean" }, "protocol_version": { "type": "string", "enum": ["1"] }, "reason": { "type": "string", "nullable": true, "enum": ["disabled", "not_configured", "storage_unavailable", null] } } },
      "IntentItemInput": { "type": "object", "additionalProperties": false, "required": ["sku_id", "quantity"], "properties": { "sku_id": { "type": "string", "pattern": "^[0-9]+$" }, "quantity": { "type": "integer", "minimum": 1 } } },
      "IntentState": { "type": "object", "properties": { "intent_id": { "type": "string" }, "state": { "type": "string", "enum": ["AWAITING_APPROVAL", "APPROVED", "ORDER_CREATED", "REQUIRES_REAPPROVAL", "REJECTED", "REVOKED", "EXPIRED"] }, "version": { "type": "integer" }, "approval_version": { "type": "integer", "nullable": true }, "verification_code": { "type": "string" }, "items": { "type": "array", "items": { "type": "object", "properties": { "sku_id": { "type": "string" }, "product_id": { "type": "string" }, "name": { "type": "string" }, "specification": { "type": "string" }, "quantity": { "type": "integer" } } } }, "intent_expires_at": { "type": "string", "format": "date-time" }, "approval_expires_at": { "type": "string", "format": "date-time", "nullable": true }, "order": { "$ref": "#/components/schemas/OrderReceipt" } } },
      "OrderReceipt": { "type": "object", "properties": { "order_id": { "type": "string" }, "pay_id": { "type": "string" }, "order_sn": { "type": "string" }, "amount_minor": { "type": "string", "pattern": "^[0-9]+$" }, "currency": { "type": "string", "enum": ["CNY"] }, "payment_url": { "type": "string", "format": "uri", "description": "Fixed official-site /payOrder?payId=... URL for human-only payment" } } }
    }
  }
}
