{"openapi":"3.1.0","info":{"title":"Bamelak AI Pricing API","version":"1.9.0","description":"Private pricing for Tehran districts 1–4. All monetary values in toman. Read /llms.txt for interpretation, limits and examples."},"servers":[{"url":"https://ai.bamelak.com"}],"paths":{"/api/v1/research-jobs":{"post":{"security":[{"ApiKey":[]}],"operationId":"createPropertyResearch","summary":"Start an autonomous property research job","parameters":[{"name":"Idempotency-Key","in":"header","required":true,"schema":{"type":"string","pattern":"^[A-Za-z0-9_-]{8,128}$"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchInput"}}}},"responses":{"202":{"description":"Accepted; poll statusUrl every 5–10 seconds","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchJobResponse"}}}},"400":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/research-jobs/{id}":{"get":{"security":[{"ApiKey":[]}],"operationId":"getPropertyResearch","summary":"Read an owned job, progress events, evidence and usage","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Current job snapshot","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ResearchJobResponse"}}}},"400":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/research-jobs/{id}/report":{"get":{"security":[{"ApiKey":[]}],"operationId":"getPropertyResearchReport","summary":"Read an owned completed/insufficient-evidence JSON report","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string","format":"uuid"}}],"responses":{"200":{"description":"Report; prices are null if evidence was insufficient","content":{"application/json":{"schema":{"type":"object","required":["requestId","data"],"properties":{"requestId":{"type":"string"},"data":{"$ref":"#/components/schemas/ResearchReport"}}}}}},"400":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"503":{"description":"Inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/estimate":{"post":{"operationId":"estimateProperty","summary":"Calibrated property valuation from geographic coordinates","security":[{"ApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/EstimateInput"}}}},"responses":{"200":{"description":"Pricing result (toman)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EstimateResponse"}}}},"400":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/api/v1/neighborhood-price":{"post":{"operationId":"neighborhoodAveragePrice","summary":"قیمت میانگین محله — observed P10/mean/median/P90 by name","security":[{"ApiKey":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/NeighborhoodInput"}}}},"responses":{"200":{"description":"Pricing result (toman)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/NeighborhoodResponse"}}}},"400":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"413":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"415":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"422":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"500":{"description":"Error; inspect error.code and details","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"ApiKey":{"type":"http","scheme":"bearer","bearerFormat":"mlk_..."}},"schemas":{"ResearchInput":{"type":"object","additionalProperties":false,"required":["property"],"properties":{"property":{"$ref":"#/components/schemas/EstimateInput"},"clientReference":{"type":"string","minLength":1,"maxLength":100}},"description":"Research currently supports apartment/house sale only; land returns UNSUPPORTED_RESEARCH_TYPE. No phone or notification configuration."},"ResearchUsage":{"type":"object","properties":{"apiCalls":{"type":"integer"},"modelCalls":{"type":"integer"},"inputTokens":{"type":"integer"},"outputTokens":{"type":"integer"},"unknownTokenCalls":{"type":"integer"},"estimatedCostUsd":{"type":["number","null"]}}},"ResearchEvidence":{"type":"object","properties":{"listing":{"type":"object","properties":{"token":{"type":"string"},"url":{"type":"string","format":"uri"},"title":{"type":"string"},"area":{"type":"number"},"askingPrice":{"type":"number"},"askingPricePerM2":{"type":"number"},"sourceCategory":{"type":"string"}}},"publishedAt":{"type":"string","format":"date-time"},"publicationPrecision":{"enum":["source-timestamp","relative-upper-bound"]},"publicationText":{"type":"string"},"checkedAt":{"type":"string","format":"date-time"},"accepted":{"type":"boolean"},"reason":{"type":"string"},"addressQuote":{"type":"string"},"fingerprint":{"type":"string"}}},"ResearchReport":{"type":"object","required":["version","outcome","price","pricePerM2","evidence","method","limitations"],"properties":{"version":{"const":"research-v1"},"generatedAt":{"type":"string","format":"date-time"},"outcome":{"enum":["completed","insufficient_evidence"]},"currency":{"const":"toman"},"address":{"type":"object"},"price":{"type":["object","null"],"properties":{"minimum":{"type":"number"},"middle":{"type":"number"},"maximum":{"type":"number"},"average":{"type":"number"}}},"pricePerM2":{"type":["object","null"],"properties":{"minimum":{"type":"number"},"middle":{"type":"number"},"maximum":{"type":"number"},"average":{"type":"number"}}},"confidence":{"enum":["low","medium"]},"effectiveSampleSize":{"type":"number"},"usedCount":{"type":"integer"},"narrative":{"type":"string"},"method":{"type":"string"},"parameters":{"type":"object","additionalProperties":{"type":"number"}},"samples":{"type":"array","items":{"type":"object","properties":{"token":{"type":"string"},"adjustedUnitPrice":{"type":"number"},"adjustment":{"type":"number"},"weight":{"type":"number"},"ageDays":{"type":"number"}}}},"evidence":{"type":"array","items":{"$ref":"#/components/schemas/ResearchEvidence"}},"limitations":{"type":"array","items":{"type":"string"}}}},"ResearchJobResponse":{"type":"object","required":["requestId","data"],"properties":{"requestId":{"type":"string"},"data":{"type":"object","required":["id","status","pricingMode","statusUrl","reportUrl"],"properties":{"id":{"type":"string","format":"uuid"},"pricingMode":{"const":"agent-research"},"status":{"enum":["queued","running","completed","insufficient_evidence","failed","cancelled"]},"input":{"$ref":"#/components/schemas/ResearchInput"},"state":{"type":"object"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"startedAt":{"type":["string","null"]},"finishedAt":{"type":["string","null"]},"error":{"type":["string","null"]},"statusUrl":{"type":"string"},"reportUrl":{"type":"string"},"report":{"anyOf":[{"$ref":"#/components/schemas/ResearchReport"},{"type":"null"}]},"events":{"type":"array","items":{"type":"object","properties":{"seq":{"type":"integer"},"type":{"type":"string"},"message":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}}},"usage":{"$ref":"#/components/schemas/ResearchUsage"},"usageLedger":{"type":"array","items":{"type":"object","properties":{"kind":{"type":"string"},"model":{"type":["string","null"]},"inputTokens":{"type":["number","null"]},"outputTokens":{"type":["number","null"]},"costUsd":{"type":["number","null"]},"durationMs":{"type":"number"},"success":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"}}}}}}}},"EstimateInput":{"type":"object","additionalProperties":false,"required":["latitude","longitude","area","propertyType"],"description":"Property details and shared amenities. Omit unknown optional fields; explicit false means absent. Numbers/booleans must be JSON primitives, not strings. parkingSpaces takes precedence over parking. API keys stay on the calling site's backend.","examples":[{"latitude":35.769,"longitude":51.453,"area":100,"propertyType":"apartment","district":"3","neighborhood":"دروس","buildingAge":10,"bedrooms":2,"bathrooms":2,"floor":3,"totalFloors":6,"parking":true,"parkingSpaces":1,"elevator":true,"storage":true,"renovated":false,"balcony":true,"centralCooling":true,"premiumView":false,"swimmingPool":true,"saunaJacuzzi":false,"gym":true,"lobby":true,"concierge":true,"roofGarden":false}],"properties":{"latitude":{"type":"number","minimum":35.4,"maximum":35.95,"title":"عرض جغرافیایی","description":"موقعیت ملک روی نقشه کجاست؟ مختصات WGS84 ارسال شود."},"longitude":{"type":"number","minimum":50.85,"maximum":51.75,"title":"طول جغرافیایی","description":"طول جغرافیایی همان نقطه انتخاب‌شده روی نقشه چیست؟"},"area":{"type":"number","exclusiveMinimum":0,"maximum":10000,"title":"متراژ","description":"مساحت ملک چند متر مربع است؟"},"district":{"type":"string","enum":["1","2","3","4"],"title":"منطقه","description":"منطقه شهرداری ۱، ۲، ۳ یا ۴ است؟ این فیلد اختیاری است و سرور منطقه را از مختصات تعیین می‌کند."},"propertyType":{"type":"string","enum":["apartment","house","land"],"title":"نوع ملک","description":"نوع ملک چیست؟ apartment = آپارتمان، house = خانه، land = زمین."},"neighborhood":{"type":"string","maxLength":80,"title":"محله","description":"نام محله چیست؟ نام محله جایگزین مختصات در تخمین اختصاصی ملک نمی‌شود."},"buildingAge":{"type":"number","minimum":0,"maximum":150,"title":"سن بنا","description":"سن بنا چند سال است؟ برای نوساز عدد صفر بفرستید."},"bedrooms":{"type":"integer","minimum":0,"maximum":20,"title":"تعداد خواب","description":"واحد چند اتاق خواب دارد؟"},"bathrooms":{"type":"integer","minimum":0,"maximum":20,"title":"تعداد حمام و سرویس","description":"چند حمام یا سرویس بهداشتی دارد؟"},"floor":{"type":"integer","minimum":-10,"maximum":100,"title":"طبقه واحد","description":"واحد در کدام طبقه است؟ همکف صفر، طبقات زیرزمین منفی."},"totalFloors":{"type":"integer","minimum":1,"maximum":100,"title":"تعداد طبقات","description":"ساختمان چند طبقه دارد؟ اطلاعات تکمیلی است؛ فعلاً ضریب مستقل قیمت ندارد."},"parkingSpaces":{"type":"integer","minimum":0,"maximum":20,"title":"تعداد پارکینگ","description":"چند جای پارک دارد؟ عدد صفر یعنی بدون پارکینگ؛ این فیلد بر parking اولویت دارد."},"landArea":{"type":"number","exclusiveMinimum":0,"maximum":100000,"title":"مساحت زمین","description":"مساحت زمین چند متر مربع است؟ برای propertyType=land در قیمت کل بر area اولویت دارد."},"elevator":{"type":"boolean","title":"آسانسور","description":"ساختمان آسانسور دارد؟"},"parking":{"type":"boolean","title":"پارکینگ","description":"ملک پارکینگ دارد؟ اگر تعداد معلوم است، parkingSpaces را هم ارسال کنید."},"storage":{"type":"boolean","title":"انباری","description":"واحد انباری دارد؟"},"renovated":{"type":"boolean","title":"بازسازی","description":"واحد بازسازی شده است؟"},"balcony":{"type":"boolean","title":"بالکن یا تراس","description":"واحد بالکن یا تراس دارد؟"},"swimmingPool":{"type":"boolean","title":"استخر","description":"ساختمان استخر قابل استفاده دارد؟"},"saunaJacuzzi":{"type":"boolean","title":"سونا یا جکوزی","description":"ساختمان سونا یا جکوزی دارد؟"},"gym":{"type":"boolean","title":"باشگاه","description":"باشگاه ورزشی در ساختمان وجود دارد؟"},"lobby":{"type":"boolean","title":"لابی","description":"ساختمان لابی دارد؟"},"concierge":{"type":"boolean","title":"لابی‌من یا نگهبان","description":"ساختمان لابی‌من یا نگهبان دارد؟"},"roofGarden":{"type":"boolean","title":"روف‌گاردن","description":"روف‌گاردن قابل استفاده دارد؟"},"centralCooling":{"type":"boolean","title":"تهویه مرکزی","description":"سیستم تهویه مرکزی دارد؟"},"premiumView":{"type":"boolean","title":"دید ممتاز","description":"واحد دید ممتاز یا باز دارد؟"}}},"NeighborhoodInput":{"type":"object","additionalProperties":false,"required":["neighborhood"],"properties":{"neighborhood":{"type":"string","minLength":2,"maxLength":80,"examples":["دروس"]},"district":{"type":"string","enum":["1","2","3","4"]},"propertyType":{"type":"string","enum":["apartment","house","land"],"default":"apartment"},"area":{"type":"number","exclusiveMinimum":0,"maximum":10000}}},"EstimateResponse":{"type":"object","required":["requestId","data"],"properties":{"requestId":{"type":"string"},"data":{"type":"object","properties":{"calculationId":{"type":"string"},"pricingMode":{"enum":["calibrated-model","sample-based"]},"district":{"type":"string","enum":["1","2","3","4"]},"currency":{"const":"toman"},"area":{"type":"number"},"price":{"type":"object","required":["minimum","middle","maximum"],"properties":{"minimum":{"type":"number"},"middle":{"type":"number"},"maximum":{"type":"number"},"average":{"type":"number"}}},"pricePerM2":{"type":"object","required":["minimum","middle","maximum"],"properties":{"minimum":{"type":"number"},"middle":{"type":"number"},"maximum":{"type":"number"},"average":{"type":"number"}}},"confidence":{"enum":["low","medium","high"]},"calibrationSampleCount":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"disclaimer":{"type":"string"}}}}},"NeighborhoodResponse":{"type":"object","required":["requestId","data"],"properties":{"requestId":{"type":"string"},"data":{"type":"object","properties":{"neighborhood":{"type":"string"},"canonicalNeighborhood":{"type":"string"},"requestedNeighborhood":{"type":"string"},"district":{"type":"string","enum":["1","2","3","4"]},"propertyType":{"type":"string","enum":["apartment","house","land"]},"matchedBy":{"enum":["catalog","spelling-correction"]},"currency":{"const":"toman"},"pricePerM2":{"type":"object","required":["minimum","middle","maximum"],"properties":{"minimum":{"type":"number"},"middle":{"type":"number"},"maximum":{"type":"number"},"average":{"type":"number"}}},"totalPrice":{"anyOf":[{"type":"object","required":["minimum","middle","maximum"],"properties":{"minimum":{"type":"number"},"middle":{"type":"number"},"maximum":{"type":"number"},"average":{"type":"number"}}},{"type":"null"}]},"area":{"type":["number","null"]},"location":{"type":"object","properties":{"latitude":{"type":"number"},"longitude":{"type":"number"},"precision":{"const":"sample-centroid"}}},"evidence":{"type":"object","properties":{"sampleCount":{"type":"integer"},"excludedOutliers":{"type":"integer"},"verifiedCount":{"type":"integer"},"askingPriceCount":{"type":"integer"},"oldestDate":{"type":"string"},"latestDate":{"type":"string"},"maximumAgeDays":{"const":180}}},"confidence":{"enum":["low","medium","high"]},"method":{"type":"string"},"createdAt":{"type":"string","format":"date-time"}}}}},"Error":{"type":"object","required":["requestId","error"],"properties":{"requestId":{"type":"string"},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}}}}}