{"openapi":"3.1.0","info":{"title":"PropertyValue SG API","version":"1.0.0","summary":"Estimated market values for Singapore HDB resale flats, with their range, accuracy and reasons.","description":"Every estimate comes with its range, the model's tested accuracy, the model month and a notice that it is an estimated market value, not a valuation or a sale price. If you show our estimates to your users, show the range and the words \"estimated market value\" with them, and credit PropertyValue SG and HDB's data (see the API terms)."},"servers":[{"url":"https://csit-321-weld.vercel.app"}],"security":[{"bearer":[]}],"paths":{"/v1/estimate":{"post":{"operationId":"estimate","summary":"Estimate one flat","description":"The estimated market value of one flat, its range, the model's tested accuracy and the factors that moved it by S$5,000 or more. Counts as one call.","x-counted":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flat"}}}},"responses":{"200":{"description":"The estimate.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/EstimateResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooMany"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/explain":{"post":{"operationId":"explain","summary":"Every factor behind an estimate","description":"The same estimate with all of the model's factors: how much each raised or lowered the estimated market value. The baseline plus every amount adds up to the estimate. Counts as one call.","x-counted":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flat"}}}},"responses":{"200":{"description":"The estimate and its factors.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExplainResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooMany"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/comparables":{"post":{"operationId":"comparables","summary":"Similar recent sales","description":"The same estimate with five recorded resales of similar flats, nearest and most recent first. Counts as one call.","x-counted":true,"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Flat"}}}},"responses":{"200":{"description":"The estimate and similar sales.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ComparablesResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooMany"},"503":{"$ref":"#/components/responses/Unavailable"}}}},"/v1/blocks":{"get":{"operationId":"blocks","summary":"The flats we can estimate","description":"One level at a time: no parameters gives the towns; town gives its streets; town and street_name give the blocks; all three give the block's flat types, models, sizes and storey ranges. Use these values in the estimate's body. Not counted.","x-counted":false,"parameters":[{"name":"town","in":"query","required":false,"schema":{"type":"string"},"example":"ANG MO KIO"},{"name":"street_name","in":"query","required":false,"schema":{"type":"string"},"example":"ANG MO KIO AVE 1"},{"name":"block","in":"query","required":false,"schema":{"type":"string"},"example":"205"}],"responses":{"200":{"description":"One level of the list.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BlocksResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooMany"}}}},"/v1/lookup":{"get":{"operationId":"lookup","summary":"Postal code to block","description":"The town, street and block of a 6-digit postal code, for blocks we can estimate. Not counted.","x-counted":false,"parameters":[{"name":"postal","in":"query","required":true,"schema":{"type":"string","pattern":"^\\d{6}$"},"example":"560205"}],"responses":{"200":{"description":"The block.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/LookupResponse"}}}},"400":{"$ref":"#/components/responses/BadRequest"},"401":{"$ref":"#/components/responses/Unauthorized"},"404":{"$ref":"#/components/responses/NotFound"},"429":{"$ref":"#/components/responses/TooMany"}}}},"/v1/usage":{"get":{"operationId":"usage","summary":"This period's calls","description":"Calls counted so far this period, the allowance, and whether the cap is on. Not counted.","x-counted":false,"responses":{"200":{"description":"Usage.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/UsageResponse"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"429":{"$ref":"#/components/responses/TooMany"}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"Your key from /account/api, as \"Authorization: Bearer pv_live_...\". Keep it on your server; never put it in a web page, an app or an address."}},"responses":{"BadRequest":{"description":"The request isn't one we can answer: a missing or wrong field, or a flat that isn't in our list (GET /v1/blocks). Not counted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unauthorized":{"description":"The key is missing, wrong or revoked.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"NotFound":{"description":"Nothing matches.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"TooMany":{"description":"More than 60 calls in a minute with this key (code rate_limited, with a Retry-After header in seconds), or this period's allowance is used and the cap is on (code quota_exceeded).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"Unavailable":{"description":"The estimating service isn't answering. Try again after the Retry-After header's seconds. Not counted.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}},"schemas":{"Flat":{"type":"object","description":"One flat, as GET /v1/blocks lists it. Text is matched without regard to case.","additionalProperties":false,"required":["town","street_name","block","flat_type","flat_model","floor_area_sqm","storey_range"],"properties":{"town":{"type":"string","example":"ANG MO KIO"},"street_name":{"type":"string","example":"ANG MO KIO AVE 1"},"block":{"type":"string","example":"205"},"flat_type":{"type":"string","enum":["1 ROOM","2 ROOM","3 ROOM","4 ROOM","5 ROOM","EXECUTIVE","MULTI-GENERATION"]},"flat_model":{"type":"string","example":"NEW GENERATION"},"floor_area_sqm":{"type":"number","minimum":20,"maximum":400,"example":98},"storey_range":{"type":"string","pattern":"^\\d{2} TO \\d{2}$","example":"07 TO 09"}}},"Estimate":{"type":"object","additionalProperties":false,"required":["kind","value","range_low","range_high","range_percent","range_note","price_per_sqm","currency"],"properties":{"kind":{"const":"estimated_market_value","description":"Always an estimated market value: not a valuation, and not the price the flat will sell for."},"value":{"type":"integer","description":"The estimate in Singapore dollars. Show it with the range."},"range_low":{"type":"integer"},"range_high":{"type":"integer"},"range_percent":{"type":"number","description":"Half the range's width as a percentage of the estimate (10.9 means ±10.9%)."},"range_note":{"type":"string"},"price_per_sqm":{"type":"integer"},"currency":{"const":"SGD"}}},"Accuracy":{"type":"object","additionalProperties":false,"required":["mean_absolute_error","r2","tested_on"],"properties":{"mean_absolute_error":{"type":"integer","description":"The model's average miss in S$ on sales it never saw."},"r2":{"type":"number"},"tested_on":{"type":"string"}}},"Model":{"type":"object","additionalProperties":false,"required":["name","version","produced_at"],"properties":{"name":{"type":"string"},"version":{"type":"string","description":"The model month, e.g. 2026-12."},"produced_at":{"type":"string","format":"date-time"}}},"FlatEcho":{"type":"object","additionalProperties":false,"required":["town","street_name","block","flat_type","flat_model","floor_area_sqm","storey_range"],"properties":{"town":{"type":"string"},"street_name":{"type":"string"},"block":{"type":"string"},"flat_type":{"type":"string"},"flat_model":{"type":"string"},"floor_area_sqm":{"type":"number"},"storey_range":{"type":"string"}}},"Factor":{"type":"object","additionalProperties":false,"required":["factor","model_label","amount","effect","description"],"properties":{"factor":{"type":"string","example":"Lease left"},"model_label":{"type":"string","description":"The model's own name for the factor.","example":"Remaining lease"},"amount":{"type":"integer","description":"S$ the factor raised (positive) or lowered (negative) the estimated market value by."},"effect":{"type":"string","enum":["raised","lowered"]},"description":{"type":"string"}}},"Sale":{"type":"object","additionalProperties":false,"required":["address","block","street_name","flat_type","flat_model","floor_area_sqm","storey_range","remaining_lease_years","price","price_per_sqm","month","distance_m","same_block"],"properties":{"address":{"type":"string"},"block":{"type":"string"},"street_name":{"type":"string"},"flat_type":{"type":"string"},"flat_model":{"type":"string"},"floor_area_sqm":{"type":"number"},"storey_range":{"type":"string"},"remaining_lease_years":{"type":"number"},"price":{"type":"integer","description":"The recorded resale price in S$."},"price_per_sqm":{"type":"integer"},"month":{"type":"string","description":"The month of sale, YYYY-MM."},"distance_m":{"type":"integer"},"same_block":{"type":"boolean"}}},"EstimateResponse":{"type":"object","additionalProperties":false,"required":["flat","estimate","accuracy","model","not_considered","notice","attribution","reasons"],"properties":{"flat":{"$ref":"#/components/schemas/FlatEcho"},"estimate":{"$ref":"#/components/schemas/Estimate"},"accuracy":{"$ref":"#/components/schemas/Accuracy"},"model":{"$ref":"#/components/schemas/Model"},"not_considered":{"type":"array","items":{"type":"string"},"description":"Things the model can't see that move real prices."},"notice":{"type":"string"},"attribution":{"type":"string"},"reasons":{"type":"object","additionalProperties":false,"required":["factors","smaller_factors","note"],"properties":{"factors":{"type":"array","items":{"$ref":"#/components/schemas/Factor"}},"smaller_factors":{"type":"integer"},"note":{"type":"string"}}}}},"ExplainResponse":{"type":"object","additionalProperties":false,"required":["flat","estimate","accuracy","model","not_considered","notice","attribution","explanation"],"properties":{"flat":{"$ref":"#/components/schemas/FlatEcho"},"estimate":{"$ref":"#/components/schemas/Estimate"},"accuracy":{"$ref":"#/components/schemas/Accuracy"},"model":{"$ref":"#/components/schemas/Model"},"not_considered":{"type":"array","items":{"type":"string"}},"notice":{"type":"string"},"attribution":{"type":"string"},"explanation":{"type":"object","additionalProperties":false,"required":["baseline","factors","note"],"properties":{"baseline":{"type":"integer"},"factors":{"type":"array","items":{"$ref":"#/components/schemas/Factor"}},"note":{"type":"string"}}}}},"ComparablesResponse":{"type":"object","additionalProperties":false,"required":["flat","estimate","accuracy","model","not_considered","notice","attribution","comparables"],"properties":{"flat":{"$ref":"#/components/schemas/FlatEcho"},"estimate":{"$ref":"#/components/schemas/Estimate"},"accuracy":{"$ref":"#/components/schemas/Accuracy"},"model":{"$ref":"#/components/schemas/Model"},"not_considered":{"type":"array","items":{"type":"string"}},"notice":{"type":"string"},"attribution":{"type":"string"},"comparables":{"type":"object","additionalProperties":false,"required":["sales","widened_nationwide","note"],"properties":{"sales":{"type":"array","items":{"$ref":"#/components/schemas/Sale"}},"widened_nationwide":{"type":"boolean","description":"True when there were too few similar sales nearby and the search took in all of Singapore."},"note":{"type":"string"}}}}},"BlocksResponse":{"oneOf":[{"type":"object","additionalProperties":false,"required":["level","towns"],"properties":{"level":{"const":"towns"},"towns":{"type":"array","items":{"type":"string"}}}},{"type":"object","additionalProperties":false,"required":["level","town","streets"],"properties":{"level":{"const":"streets"},"town":{"type":"string"},"streets":{"type":"array","items":{"type":"string"}}}},{"type":"object","additionalProperties":false,"required":["level","town","street_name","blocks"],"properties":{"level":{"const":"blocks"},"town":{"type":"string"},"street_name":{"type":"string"},"blocks":{"type":"array","items":{"type":"string"}}}},{"type":"object","additionalProperties":false,"required":["level","town","street_name","block","flats"],"properties":{"level":{"const":"flats"},"town":{"type":"string"},"street_name":{"type":"string"},"block":{"type":"string"},"flats":{"type":"array","items":{"type":"object","additionalProperties":false,"required":["flat_type","flat_model","floor_area_sqm","suggested_floor_area_sqm","storey_ranges","suggested_storey_range","sales_recorded"],"properties":{"flat_type":{"type":"string"},"flat_model":{"type":"string"},"floor_area_sqm":{"type":"array","items":{"type":"number"}},"suggested_floor_area_sqm":{"type":"number"},"storey_ranges":{"type":"array","items":{"type":"string"}},"suggested_storey_range":{"type":"string"},"sales_recorded":{"type":"integer","description":"Resales of this type and model in the block; 0 means the options are the town's typical flats."}}}}}}]},"LookupResponse":{"type":"object","additionalProperties":false,"required":["postal_code","town","street_name","block"],"properties":{"postal_code":{"type":"string"},"town":{"type":"string"},"street_name":{"type":"string"},"block":{"type":"string"}}},"UsageResponse":{"type":"object","additionalProperties":false,"required":["plan","period_start","period_end","calls","allowance","cap_on","overage_price_sgd","overage_so_far_sgd"],"properties":{"plan":{"type":"string","enum":["free_trial","api"]},"period_start":{"type":"string","format":"date-time"},"period_end":{"type":"string","format":"date-time"},"calls":{"type":"integer"},"allowance":{"type":"integer"},"cap_on":{"type":"boolean","description":"On: calls past the allowance are refused. Off (paid plan only): they go on at overage_price_sgd each."},"overage_price_sgd":{"type":["number","null"]},"overage_so_far_sgd":{"type":["number","null"]}}},"Error":{"type":"object","additionalProperties":false,"required":["error"],"properties":{"error":{"type":"object","additionalProperties":false,"required":["code","message"],"properties":{"code":{"type":"string","enum":["bad_request","unauthorized","forbidden","not_found","rate_limited","quota_exceeded","model_unavailable","internal_error"]},"message":{"type":"string"}}}}}}}}