Skip to Content
API ReferenceSearch & LocationsLocations & Buildings

Locations & Buildings

/api/locations and /api/buildings are thin proxies: the route validates the query with Joi, a service method forwards it to one Repliers endpoint, and the response is returned as Repliers sent it. There is no reshaping, no scrubbing decorator and no restricted-listing filter on either path. Terms are in the Glossary.

Endpoints · Autosuggest · Caching · Repliers API

Locations

LocationsService (src/services/locations.ts) wraps RepliersLocations (src/services/repliers/locations.ts). Both routes use passthrough auth, but neither reads the user: the token only decides whether an invalid one is a 401.

Location sources

source selects the dataset. The client type lists four values; the proxy validates source only as a string array (.single(), so one value is accepted), so any other value is passed to Repliers as sent.

SourceProxy behaviourSource
MLS, UserDefined, LiveBynone beyond passing the value on; the dataset is chosen by Replierssrc/services/repliers/locations.ts (RplLocationSourceValues)
PublicRecordnone beyond passing the value on; the response type describes property parcels: type property, a map.boundary that may be a MultiPolygon (map.geometryType), and the assessor fields in publicRecord, returned untouchedsrc/services/repliers/locations.ts (RplLocation)

When source is absent the proxy sends none, and Repliers searches across sources (AutosuggestService.search omits source from the locations call when the request has none).

GET /locations

Validated by locationsGetSchema (src/validate/locations.ts) and cached.

ParameterRule
typearray of area, city, city-alternate, neighborhood, neighborhood-alternate, postalCode, schoolDistrict, district, school, property (.single())
state, area, city, neighborhood, locationId, source, classificationstring arrays (.single())
resultsPerPage1 to 1000, default 100
pageNumat least 1, default 1
mapJSON string or coordinate array (rplMapFlexibleSchema)
lat, long, radiuslat -90..90, long -180..180, radius at least 1; radius requires both lat and long
sortBytypedesc or typeasc
hasBoundary"true" or "false"
minSize, maxSizepositive numbers
fieldsstring

The cache entry (locations:get) is keyed by the validated parameter object and lives for CACHE_LOCATIONS_TTL (24 h). The response is written with sendCached, so a hit or a miss carries Cache-Control: private, max-age=<remaining seconds>.

GET /locations/autocomplete

Validated by locationsAutocompleteSchema. search is required with at least 3 characters; resultsPerPage is 1 to 10 with no default (Repliers applies its own); the other filters match /locations except that sortBy is absent and boundary is accepted next to hasBoundary. The call is not cached and the body is written directly.

The combined autosuggest locations block calls the same client method but does not pass through this schema: its page size is bounded by REPLIERS_AUTOSUGGEST_MAX_RESULTS and search is the autosuggest q.

Buildings

BuildingsService (src/services/buildings.ts) wraps RepliersBuildings (src/services/repliers/buildings.ts). The router resolves no JWT middleware: a token is never read or checked on any of the three routes.

RouteValidated byUpstreamCache
GET /api/buildingsbuildingsSchema on the queryGET /buildingsbuildings:search, CACHE_BUILDINGS_SEARCH_TTL (24 h)
POST /api/buildingsbuildingsSchema on the query plus bodyPOST /buildings; body is sent as the request bodybuildings:search, same TTL; usePost is part of the key
GET /api/buildings/{addressKey}buildingsSingleSchemaGET /buildings/{addressKey}buildings:single, CACHE_BUILDINGS_SINGLE_TTL (1 h)

buildingsSchema accepts paging (pageNum, resultsPerPage, both positive integers with no upper bound), area filters (city, neighborhood, area, map), listing filters (class, type, price, bedroom, bathroom, story and propertyType ranges, displayPublic), name and street filters (buildingName, streetName, streetNumber), sortBy, and lat / long / radius (radius requires both). On POST the only body key is map (rplMapSchema), which lets a large polygon travel in the body.

Single building

addressKey is a non-empty string of at most 255 characters (addressKey). The route assigns the @cached result to ctx.body without sendCached, so the response body is the cache wrapper { result, expires } and no Cache-Control header is set; the list routes use sendCached and return the bare payload (src/routes/buildings.ts).

Cache namespaces

NamespaceMethodEnv, default
locations:getLocationsService.getCACHE_LOCATIONS_TTL, 24 h
buildings:searchBuildingsService.searchCACHE_BUILDINGS_SEARCH_TTL, 24 h
buildings:singleBuildingsService.singleCACHE_BUILDINGS_SINGLE_TTL, 1 h

Keys, values and the shared @cached mechanics are in Cache state. locations/autocomplete has no namespace.

Gotchas

  1. /locations/autocomplete and /locations cap resultsPerPage differently. 10 with no default against 1000 with default 100 (src/validate/locations.ts).
  2. source is validated as any string. The schema is a string array; the four-value list is a TypeScript type only (src/validate/locations.ts, src/services/repliers/locations.ts).
  3. Buildings carry no listing context. The services have no app_state and no @scrubbed decorator, and the router resolves no JWT middleware (src/routes/buildings.ts, src/services/buildings.ts).
  4. GET and POST buildings are separate cache entries. usePost is an argument of the cached method, so the same filters sent both ways are two entries (src/services/buildings.ts, BuildingsService.search).

Verified against portal-backend 997ae3e, 2026-10-20.

Last updated on