{
  "openapi": "3.0.3",
  "info": {
    "title": "Ticcar Public Lead API",
    "version": "1.0.0",
    "summary": "Capture store-creation and callback leads for the Ticcar e-commerce platform.",
    "description": "Ticcar is a Turkish internet commerce platform for tradespeople (esnaf). These endpoints accept lead forms from ticcar.com. Humans complete store provisioning after the lead is received. No payment is taken through this API.",
    "contact": {
      "name": "Ticcar Destek",
      "email": "info@ticcar.com",
      "url": "https://ticcar.com/iletisim"
    }
  },
  "servers": [
    {
      "url": "https://ticcar.com",
      "description": "Production"
    }
  ],
  "x-service-info": {
    "categories": ["ecommerce", "saas", "lead-capture"],
    "docs": {
      "homepage": "https://ticcar.com",
      "llms": "https://ticcar.com/llms.txt",
      "agents": "https://ticcar.com/.well-known/agents.json"
    }
  },
  "paths": {
    "/api/lead": {
      "post": {
        "operationId": "submitLead",
        "summary": "Submit a store or contact lead",
        "description": "Creates a lead record. For store creation use type=store with name, phone, and storeName. The team calls the phone number.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/LeadPayload"
              },
              "examples": {
                "store": {
                  "value": {
                    "type": "store",
                    "source": "agent",
                    "name": "Ayşe Yılmaz",
                    "phone": "0532 000 00 00",
                    "storeName": "Ayşe Butik",
                    "preferredDomain": "aysebutik.com",
                    "kvkk": true
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Lead accepted",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/LeadAccepted" }
              }
            }
          },
          "400": {
            "description": "Validation error",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    },
    "/api/domains/search": {
      "post": {
        "operationId": "searchDomains",
        "summary": "Search domain availability",
        "description": "Checks .com / .com.tr / .co style availability for a store name query.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
                "schema": { "$ref": "#/components/schemas/DomainSearchRequest" }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Domain suggestions",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/DomainSearchResponse" }
              }
            }
          },
          "400": {
            "description": "Missing query",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          },
          "429": {
            "description": "Rate limited",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ErrorResponse" }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "LeadPayload": {
        "type": "object",
        "description": "Store, callback or contact lead submitted from ticcar.com or an agent.",
        "required": ["type", "name", "phone", "kvkk"],
        "properties": {
          "type": {
            "type": "string",
            "description": "Lead kind.",
            "enum": ["store", "callback", "contact", "chat", "newsletter", "register"]
          },
          "name": { "type": "string", "description": "Person name." },
          "phone": { "type": "string", "description": "Turkish mobile phone." },
          "email": { "type": "string", "format": "email", "description": "Optional email." },
          "storeName": { "type": "string", "description": "Requested store name." },
          "preferredDomain": { "type": "string", "description": "Preferred domain if known." },
          "sector": { "type": "string", "description": "Retail sector." },
          "message": { "type": "string", "description": "Free-text note." },
          "source": { "type": "string", "description": "Form or agent source id." },
          "kvkk": { "type": "boolean", "description": "Caller confirms the privacy notice was accepted." }
        }
      },
      "LeadAccepted": {
        "type": "object",
        "description": "Lead was stored for a human callback.",
        "required": ["ok"],
        "properties": {
          "ok": { "type": "boolean", "description": "True when the lead was stored." }
        }
      },
      "DomainSearchRequest": {
        "type": "object",
        "description": "Domain availability query.",
        "required": ["query"],
        "properties": {
          "query": { "type": "string", "description": "Store name or label to search.", "example": "aysebutik" }
        }
      },
      "DomainSearchResponse": {
        "type": "object",
        "description": "Suggested domains and availability flags.",
        "required": ["results"],
        "properties": {
          "results": {
            "type": "array",
            "items": {
              "type": "object",
              "required": ["domain", "available"],
              "properties": {
                "domain": { "type": "string", "description": "Candidate domain." },
                "available": { "type": "boolean", "description": "Whether the name looks available." }
              }
            }
          }
        }
      },
      "ErrorResponse": {
        "type": "object",
        "description": "Typed API error.",
        "required": ["error"],
        "properties": {
          "error": {
            "type": "object",
            "required": ["code", "message"],
            "properties": {
              "code": { "type": "string", "description": "Stable machine code such as validation_error or rate_limited." },
              "message": { "type": "string", "description": "Human-readable explanation." }
            }
          }
        }
      }
    }
  }
}
