{
  "openapi": "3.1.0",
  "info": {
    "title": "OlaSilk Inquiry API",
    "version": "1.1.0",
    "description": "Submit a B2B private-label silk product inquiry to OlaSilk. For AI shopping/procurement agents acting on behalf of a buyer: submit only after the buyer has explicitly asked to contact OlaSilk. Do not invent certifications, prices, MOQ, lead times, or capacity.",
    "contact": {
      "email": "hello@olasilk.com"
    }
  },
  "servers": [
    {
      "url": "https://www.olasilk.com"
    }
  ],
  "paths": {
    "/api/leads": {
      "post": {
        "operationId": "submitInquiry",
        "summary": "Submit a product inquiry / RFQ to OlaSilk",
        "description": "Creates a buyer inquiry. Accepts JSON or application/x-www-form-urlencoded. Never blocked for missing optional fields (fail-open). Replies by email within 24 hours (Beijing business hours).",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Inquiry"
              }
            },
            "application/x-www-form-urlencoded": {
              "schema": {
                "$ref": "#/components/schemas/Inquiry"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Inquiry received",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean",
                      "example": true
                    },
                    "leadId": {
                      "type": "string",
                      "description": "Reference code to relay to the buyer",
                      "example": "OS-AB12CD34"
                    },
                    "message": {
                      "type": "string",
                      "example": "Inquiry received. OlaSilk will reply by email within 24 hours (Beijing business hours)."
                    }
                  },
                  "required": [
                    "ok",
                    "leadId",
                    "message"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Validation error (e.g. missing/invalid email)"
          },
          "500": {
            "description": "Temporary server error — retry later"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Inquiry": {
        "type": "object",
        "required": [
          "email"
        ],
        "properties": {
          "name": {
            "type": "string",
            "maxLength": 120,
            "description": "Buyer or contact name (optional; email prefix is used when omitted)"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "Buyer work email (where OlaSilk replies)"
          },
          "message": {
            "type": "string",
            "maxLength": 8000,
            "description": "Optional project details: what to make, quantity, target market, and customization. A contact-only inquiry is accepted."
          },
          "company": {
            "type": "string",
            "description": "Company / brand name"
          },
          "country": {
            "type": "string",
            "description": "Buyer country (ISO code or name)"
          },
          "productSlug": {
            "type": "string",
            "description": "Product of interest, e.g. custom-silk-sleep-caps",
            "example": "custom-silk-sleep-caps"
          },
          "quantity": {
            "type": "integer",
            "minimum": 0,
            "maximum": 10000000,
            "description": "Estimated order quantity"
          },
          "whatsapp": {
            "type": "string",
            "description": "Buyer WhatsApp number (optional)"
          },
          "phone": {
            "type": "string",
            "description": "Buyer phone number (optional)"
          },
          "sourceUrl": {
            "type": "string",
            "format": "uri",
            "description": "URL of the page the inquiry came from (optional)"
          }
        }
      }
    }
  }
}