{"openapi":"3.0.3","info":{"title":"DealAnalyzerAI Developer API","version":"1.0.0","description":"Integrate property data, comparable sales, ARV analysis, renovation estimates, market signals, and deal records into any application."},"servers":[{"url":"/api"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer"},"apiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key"}},"schemas":{"ApiError":{"type":"object","required":["error"],"properties":{"error":{"type":"object","required":["code","message"],"properties":{"code":{"type":"string"},"message":{"type":"string"},"details":{}}}}},"AddressRequest":{"type":"object","required":["address"],"properties":{"address":{"type":"string","minLength":5}}},"ArvRequest":{"type":"object","required":["address"],"properties":{"address":{"type":"string","minLength":5},"beds":{"type":"integer","minimum":0},"baths":{"type":"number","minimum":0},"sqft":{"type":"integer","minimum":1},"yearBuilt":{"type":"integer"},"saveAsDeal":{"type":"boolean"},"async":{"type":"boolean","description":"Return a durable job immediately; poll the returned pollUrl."}}},"ArvQuickRequest":{"type":"object","required":["address","price","sqft"],"properties":{"address":{"type":"string","minLength":5},"price":{"type":"number","minimum":0},"sqft":{"type":"integer","minimum":1,"maximum":100000},"bedrooms":{"type":"integer","minimum":0,"maximum":20},"bathrooms":{"type":"number","minimum":0,"maximum":20},"yearBuilt":{"type":"integer","minimum":1800},"garageSize":{"type":"integer","minimum":0,"maximum":20},"investmentStrategy":{"type":"string"}}},"ArvComp":{"type":"object","properties":{"address":{"type":"string","nullable":true},"price":{"type":"number","nullable":true},"sqft":{"type":"number","nullable":true},"bedrooms":{"type":"number","nullable":true},"bathrooms":{"type":"number","nullable":true},"soldDate":{"type":"string","nullable":true},"distanceMiles":{"type":"number","nullable":true},"use":{"type":"boolean","nullable":true,"description":"Whether the evaluated review used this sale in the weighted ARV; null when the sale was not reviewed."},"role":{"type":"string","enum":["primary","supplemental","excluded"],"nullable":true,"description":"Evaluated review role; null when not reviewed."},"weight":{"type":"number","nullable":true,"description":"Weight (0–1) of this sale in the weighted ARV base; 0 for unused sales."},"adjustedPrice":{"type":"number","nullable":true,"description":"Sale price after the disclosed feature, time and vintage adjustments."}}},"ArvResult":{"type":"object","properties":{"requestId":{"type":"string"},"address":{"type":"string"},"arv":{"type":"object","properties":{"low":{"type":"number","nullable":true},"base":{"type":"number","nullable":true},"high":{"type":"number","nullable":true}}},"confidence":{"type":"string","enum":["High","Moderate","Low"],"nullable":true,"description":"Qualitative evidence confidence from the comparable-sales review (not a calibrated probability). Downgraded one total level when avmDivergence or subjectFactsMismatch is present."},"subjectFactsMismatch":{"type":"object","description":"Warning only: request sqft differs more than 25% or yearBuilt differs more than 10 years from existing property-record facts. Does not block or alter ARV.","properties":{"flagged":{"type":"boolean","enum":[true]},"sqft":{"type":"object","properties":{"requested":{"type":"number"},"recorded":{"type":"number"},"differencePercent":{"type":"number"}}},"yearBuilt":{"type":"object","properties":{"requested":{"type":"number"},"recorded":{"type":"number"},"differenceYears":{"type":"number"}}}}},"avmDivergence":{"type":"object","description":"Present only when arv.base differs from the subject's identity-matched provider AVM by more than 25%. ARV values are not changed.","properties":{"providerAvm":{"type":"number"},"pctDiff":{"type":"number","description":"(arv.base − providerAvm) / providerAvm × 100"},"flagged":{"type":"boolean","enum":[true]}}},"typeSize":{"type":"string","nullable":true},"condition":{"type":"string","nullable":true},"market":{"type":"object","properties":{"absorption":{"nullable":true},"pricePerSqft":{"nullable":true},"medianDaysOnMarket":{"nullable":true}}},"comps":{"type":"array","maxItems":10,"items":{"$ref":"#/components/schemas/ArvComp"}},"roiAnalysis":{"type":"object","nullable":true},"exitStrategies":{"nullable":true}}},"DealCreate":{"type":"object","required":["address"],"properties":{"address":{"type":"string"},"arv":{"type":"integer","nullable":true},"status":{"type":"string","enum":["lead","under_contract","assigned","closed"]},"notes":{"type":"string","nullable":true}}},"DealUpdate":{"type":"object","properties":{"address":{"type":"string"},"arv":{"type":"integer","nullable":true},"status":{"type":"string","enum":["lead","under_contract","assigned","closed"]},"notes":{"type":"string","nullable":true}},"minProperties":1}}},"security":[{"bearerAuth":[]},{"apiKeyAuth":[]}],"paths":{"/v1/health":{"get":{"summary":"Verify an API key","responses":{"200":{"description":"API is available"},"401":{"description":"Missing or invalid API key"}}}},"/v1/address/verify":{"post":{"summary":"Verify and standardize an address","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["street"],"properties":{"street":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zipcode":{"type":"string"}}}}}},"responses":{"200":{"description":"Verification result"},"400":{"description":"Invalid request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/v1/address/autocomplete":{"get":{"summary":"Suggest US addresses","parameters":[{"in":"query","name":"q","required":true,"schema":{"type":"string","minLength":3}},{"in":"query","name":"selected","schema":{"type":"string"}}],"responses":{"200":{"description":"Address suggestions"}}}},"/v1/property/lookup":{"post":{"summary":"Look up available property facts","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AddressRequest"}}}},"responses":{"200":{"description":"Property data"},"400":{"description":"Invalid request"},"404":{"description":"Property not found"}}}},"/v1/property/photos":{"post":{"summary":"Retrieve available public listing photos","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"address":{"type":"string"},"zipCode":{"type":"string","pattern":"^[0-9]{5}$"},"limit":{"type":"integer","minimum":1,"maximum":50}}}}}},"responses":{"200":{"description":"Available photo URLs"},"400":{"description":"Invalid request"}}}},"/v1/comps":{"post":{"summary":"Retrieve comparable-property results","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArvRequest"}}}},"responses":{"200":{"description":"Comparable properties"},"400":{"description":"Invalid request"}}}},"/v1/arv":{"post":{"summary":"Run a comprehensive ARV analysis","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArvRequest"}}}},"responses":{"200":{"description":"ARV analysis","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArvResult"}}}},"202":{"description":"Job accepted (async=true or analysis exceeds 240 seconds)","headers":{"Retry-After":{"schema":{"type":"integer","example":15}}},"content":{"application/json":{"schema":{"type":"object","required":["requestId","status","pollUrl"],"properties":{"requestId":{"type":"string"},"status":{"type":"string","enum":["processing"]},"pollUrl":{"type":"string"}}}}}},"400":{"description":"Invalid request"},"429":{"description":"Rate limit exceeded"}}}},"/v1/arv/{requestId}":{"get":{"summary":"Poll an ARV job owned by this user and API key","parameters":[{"in":"path","name":"requestId","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Job status; result is the unchanged synchronous ARV response when completed","headers":{"Retry-After":{"description":"Present while processing","schema":{"type":"integer","example":15}}},"content":{"application/json":{"schema":{"type":"object","required":["requestId","status","createdAt","completedAt","result"],"properties":{"requestId":{"type":"string"},"status":{"type":"string","enum":["processing","completed","failed"]},"createdAt":{"type":"string","format":"date-time"},"completedAt":{"type":"string","format":"date-time","nullable":true},"result":{"type":"object","nullable":true},"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"}}}}}}}},"401":{"description":"Missing or invalid API key"},"404":{"description":"Unknown request or different API-key owner"},"429":{"description":"Rate limit exceeded"}}}},"/v1/arv/quick":{"post":{"summary":"Run a quick ARV estimate from supplied property facts","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ArvQuickRequest"}}}},"responses":{"200":{"description":"ARV estimate"},"400":{"description":"Invalid request"}}}},"/v1/renovation/estimate":{"post":{"summary":"Estimate renovation costs","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["roomType","renovationType","zipCode"],"properties":{"roomType":{"type":"string"},"renovationType":{"type":"string"},"zipCode":{"type":"string"},"squareFootage":{"type":"integer","minimum":1}}}}}},"responses":{"200":{"description":"Renovation estimate"},"400":{"description":"Invalid request"}}}},"/v1/market/flip-analysis":{"post":{"summary":"Analyze observed ZIP-level flip activity","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["city","state","zipCode"],"properties":{"city":{"type":"string"},"state":{"type":"string"},"zipCode":{"type":"string","pattern":"^[0-9]{5}$"}}}}}},"responses":{"200":{"description":"Market flip analysis"},"400":{"description":"Invalid request"}}}},"/v1/deals":{"get":{"summary":"List saved deal records","responses":{"200":{"description":"Deal records"}}},"post":{"summary":"Create a deal record","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealCreate"}}}},"responses":{"201":{"description":"Deal created"},"400":{"description":"Invalid request"}}}},"/v1/deals/{id}":{"patch":{"summary":"Update a deal record","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DealUpdate"}}}},"responses":{"200":{"description":"Deal updated"},"404":{"description":"Deal not found"}}},"delete":{"summary":"Delete a deal record","parameters":[{"in":"path","name":"id","required":true,"schema":{"type":"integer"}}],"responses":{"200":{"description":"Deal deleted"},"404":{"description":"Deal not found"}}}},"/v1/usage":{"get":{"summary":"View API usage","responses":{"200":{"description":"Usage summary"}}}}}}