{
  "openapi": "3.0.3",
  "info": {
    "title": "ComplianceCN Two-Stage Market Access Check",
    "version": "0.1.0",
    "description": "One market-access check in two automated stages for Chinese cross-border sellers. Stage 1 checks product facts, target markets, evidence gaps, source status and whether human review is recommended. Stage 2 should be called after Stage 1 to generate the next-step pack: supplier/lab/marketplace drafts and official/standardised form-field drafts where relevant. It is a readiness workflow, not certification, not legal advice, and not compliance approval."
  },
  "servers": [
    {
      "url": "https://compliancecn.netlify.app/api/coze"
    }
  ],
  "paths": {
    "/preflight": {
      "post": {
        "operationId": "preflight",
        "summary": "Stage 1: check market-access evidence gaps",
        "description": "Stage 1 of the same ComplianceCN market-access check. Use this first when a Chinese cross-border seller asks how to sell a product into a target market or whether they have enough evidence for marketplace sale, Amazon review, CE/RoHS/RED/UN38.3 checks, battery documentation, connected toy safety, cosmetics, or food-contact goods. Returns missing evidence, supplier questions, next actions, trust/source status, and whether human review is recommended. After this succeeds, call next_step_pack if the seller wants practical supplier/lab/marketplace/form drafts. The result is a readiness screen only, not certification, not legal advice, or compliance approval.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "product_name",
                  "category"
                ],
                "properties": {
                  "product_name": {
                    "type": "string",
                    "description": "Short product name or description. Required so the answer can be framed around the seller's actual product."
                  },
                  "category": {
                    "type": "string",
                    "description": "Product category. Use battery-electronics for battery/Bluetooth electronics, toys for battery-powered or connected toys, cosmetics for cosmetic products, and food-contact for food-contact materials/articles.",
                    "enum": [
                      "battery-electronics",
                      "toys",
                      "cosmetics",
                      "food-contact"
                    ]
                  },
                  "markets": {
                    "type": "array",
                    "default": [
                      "EU"
                    ],
                    "description": "Destination markets. If omitted, the plugin assumes EU. Supported categories expose category-specific coverage across EU, US, UK and AU.",
                    "items": {
                      "type": "string",
                      "enum": [
                        "EU",
                        "US",
                        "UK",
                        "AU"
                      ]
                    }
                  },
                  "language": {
                    "type": "string",
                    "description": "Response language.",
                    "enum": [
                      "zh",
                      "en"
                    ],
                    "default": "zh"
                  },
                  "battery_type": {
                    "type": "string",
                    "description": "Battery type.",
                    "enum": [
                      "button_coin",
                      "lithium_ion",
                      "other",
                      "none",
                      "unknown"
                    ]
                  },
                  "has_radio": {
                    "type": "boolean",
                    "description": "True if the product has Bluetooth, Wi-Fi, or another radio transmitter."
                  },
                  "includes_mains_charger": {
                    "type": "boolean",
                    "description": "True if a mains charger or plug is supplied with the product."
                  },
                  "supply_chain_role": {
                    "type": "string",
                    "description": "Seller role in the supply chain.",
                    "enum": [
                      "manufacturer",
                      "importer",
                      "distributor",
                      "marketplace_seller",
                      "unknown"
                    ],
                    "default": "marketplace_seller"
                  },
                  "sales_channel": {
                    "type": "string",
                    "description": "Sales channel.",
                    "enum": [
                      "amazon",
                      "other_marketplace",
                      "own_site",
                      "unknown"
                    ],
                    "default": "amazon"
                  },
                  "evidence_inventory_complete": {
                    "type": "boolean",
                    "description": "True if the user has listed all evidence currently held.",
                    "default": false
                  },
                  "evidence_held": {
                    "type": "array",
                    "description": "Evidence IDs the user already has. Examples: ce_declaration, rohs_evidence, radio_test_report, un38_3_test_summary, toy_safety_assessment, cosmetic_formula_review, cosmetic_safety_report, food_contact_material_spec, food_contact_migration_report.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "verified_only": {
                    "type": "boolean",
                    "description": "Use true for public answers so partially checked rules are excluded.",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stage 1 market-access readiness result with missing evidence, non-binding testing-route suggestions, next actions, trust envelope, and limitation. Use this result before Stage 2 next_step_pack.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "preflight_status": {
                      "type": "string"
                    },
                    "decision": {
                      "type": "string"
                    },
                    "missing_product_information": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "evidence_summary": {
                      "type": "object"
                    },
                    "evidence_checklist": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "suggested_evidence_testing_route": {
                      "type": "object",
                      "description": "Suggested evidence/testing-route discussion points. These are not additional legal requirements or compliance conclusions."
                    },
                    "next_actions": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "trust": {
                      "type": "object"
                    },
                    "limitation": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request."
          }
        }
      }
    },
    "/next-step-pack": {
      "post": {
        "operationId": "next_step_pack",
        "summary": "Stage 2: generate next-step pack from Stage 1",
        "description": "Stage 2 of the same ComplianceCN market-access check. Use this after Stage 1 preflight succeeds, when the seller needs practical next steps for selling into the target market. It selects one of four routes: missing supplier evidence, lab/testing route, marketplace submission review pack, or specialist referral. It generates supplier evidence requests, lab quote requests, marketplace response drafts, document index, official/standardised form-field drafts where relevant, and human-review brief. Draft templates only; not certification, legal advice, product approval, or marketplace approval.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "product_name",
                  "category"
                ],
                "properties": {
                  "product_name": {
                    "type": "string",
                    "description": "Short product name or description."
                  },
                  "category": {
                    "type": "string",
                    "description": "Product category. Use battery-electronics for battery/Bluetooth electronics, toys for battery-powered or connected toys, cosmetics for cosmetic products, and food-contact for food-contact materials/articles.",
                    "enum": [
                      "battery-electronics",
                      "toys",
                      "cosmetics",
                      "food-contact"
                    ]
                  },
                  "markets": {
                    "type": "array",
                    "default": [
                      "EU"
                    ],
                    "description": "Destination markets. If omitted, the plugin assumes EU.",
                    "items": {
                      "type": "string",
                      "enum": [
                        "EU",
                        "US",
                        "UK",
                        "AU"
                      ]
                    }
                  },
                  "language": {
                    "type": "string",
                    "description": "Response language.",
                    "enum": [
                      "zh",
                      "en"
                    ],
                    "default": "zh"
                  },
                  "battery_type": {
                    "type": "string",
                    "description": "Battery type.",
                    "enum": [
                      "button_coin",
                      "lithium_ion",
                      "other",
                      "none",
                      "unknown"
                    ]
                  },
                  "has_radio": {
                    "type": "boolean",
                    "description": "True if the product has Bluetooth, Wi-Fi, or another radio transmitter."
                  },
                  "includes_mains_charger": {
                    "type": "boolean",
                    "description": "True if a mains charger or plug is supplied with the product."
                  },
                  "supply_chain_role": {
                    "type": "string",
                    "description": "Seller role in the supply chain.",
                    "enum": [
                      "manufacturer",
                      "importer",
                      "distributor",
                      "marketplace_seller",
                      "unknown"
                    ],
                    "default": "marketplace_seller"
                  },
                  "sales_channel": {
                    "type": "string",
                    "description": "Sales channel.",
                    "enum": [
                      "amazon",
                      "other_marketplace",
                      "own_site",
                      "unknown"
                    ],
                    "default": "amazon"
                  },
                  "evidence_inventory_complete": {
                    "type": "boolean",
                    "description": "True if the user has listed all evidence currently held.",
                    "default": false
                  },
                  "evidence_held": {
                    "type": "array",
                    "description": "Evidence IDs the user already has. The pack will request missing or unknown items.",
                    "items": {
                      "type": "string"
                    }
                  },
                  "verified_only": {
                    "type": "boolean",
                    "description": "Use true for public answers so partially checked rules are excluded.",
                    "default": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stage 2 draft market-access next-step pack generated from the same product facts used for Stage 1, with supplier, lab, marketplace, form-field and human-review templates.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "pack_status": {
                      "type": "string"
                    },
                    "decision": {
                      "type": "string"
                    },
                    "preflight_status": {
                      "type": "string"
                    },
                    "post_review_route": {
                      "type": "object"
                    },
                    "evidence_summary": {
                      "type": "object"
                    },
                    "human_review": {
                      "type": "object"
                    },
                    "route_outputs": {
                      "type": "object"
                    },
                    "pack": {
                      "type": "object"
                    },
                    "next_actions": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "limitation": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request."
          }
        }
      }
    },
    "/human-review": {
      "post": {
        "operationId": "request_human_review",
        "summary": "Optional continuation: request human review",
        "description": "Optional continuation of the same ComplianceCN market-access check after Stage 1 or Stage 2, when the seller wants a human-reviewed evidence gap report, wants to submit documents, or asks for ComplianceCN to follow up. Ask for explicit consent and a contact email first. Do not upload certificates or test reports through chat; ComplianceCN will provide a private upload link if the case proceeds.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "client_email",
                  "consent_to_contact",
                  "product_profile"
                ],
                "properties": {
                  "client_email": {
                    "type": "string",
                    "format": "email",
                    "description": "Seller contact email. Only send after the user explicitly agrees to be contacted."
                  },
                  "client_ref": {
                    "type": "string",
                    "description": "Optional seller reference, SKU, or conversation reference."
                  },
                  "consent_to_contact": {
                    "type": "boolean",
                    "enum": [
                      true
                    ],
                    "description": "Must be true. The user has explicitly consented to ComplianceCN contacting them about human review."
                  },
                  "message": {
                    "type": "string",
                    "description": "Brief reason for handoff, e.g. missing UN38.3, unclear CE/RED evidence, documents need review, or seller wants a human-reviewed evidence gap report."
                  },
                  "product_profile": {
                    "type": "object",
                    "required": [
                      "product_name",
                      "category"
                    ],
                    "description": "Use the same product facts sent to the preflight tool. Include markets and evidence_held when known.",
                    "properties": {
                      "product_name": {
                        "type": "string",
                        "description": "Short product name or description."
                      },
                      "category": {
                        "type": "string",
                        "description": "Product category.",
                        "enum": [
                          "battery-electronics",
                          "toys",
                          "cosmetics",
                          "food-contact"
                        ]
                      },
                      "markets": {
                        "type": "array",
                        "default": [
                          "EU"
                        ],
                        "items": {
                          "type": "string",
                          "enum": [
                            "EU",
                            "US",
                            "UK",
                            "AU"
                          ]
                        }
                      },
                      "language": {
                        "type": "string",
                        "enum": [
                          "zh",
                          "en"
                        ],
                        "default": "zh"
                      },
                      "battery_type": {
                        "type": "string",
                        "enum": [
                          "button_coin",
                          "lithium_ion",
                          "other",
                          "none",
                          "unknown"
                        ]
                      },
                      "has_radio": {
                        "type": "boolean"
                      },
                      "includes_mains_charger": {
                        "type": "boolean"
                      },
                      "supply_chain_role": {
                        "type": "string",
                        "enum": [
                          "manufacturer",
                          "importer",
                          "distributor",
                          "marketplace_seller",
                          "unknown"
                        ],
                        "default": "marketplace_seller"
                      },
                      "sales_channel": {
                        "type": "string",
                        "enum": [
                          "amazon",
                          "other_marketplace",
                          "own_site",
                          "unknown"
                        ],
                        "default": "amazon"
                      },
                      "evidence_inventory_complete": {
                        "type": "boolean",
                        "default": false
                      },
                      "evidence_held": {
                        "type": "array",
                        "items": {
                          "type": "string"
                        }
                      },
                      "verified_only": {
                        "type": "boolean",
                        "default": true
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "Human-review lead accepted. Returns a reference and next-step instruction.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "lead_id": {
                      "type": "string"
                    },
                    "reference": {
                      "type": "string"
                    },
                    "preflight_status": {
                      "type": "string"
                    },
                    "evidence_summary": {
                      "type": "object"
                    },
                    "review_gates": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      }
                    },
                    "next_step": {
                      "type": "string"
                    },
                    "agent_instruction": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request, missing consent, or invalid email."
          }
        }
      }
    }
  }
}
