// 14 Broadway Market, scored on the Young family profile: what the page opens on
const response = await fetch('https://data.traveltimeapp.com/v1/custom-scores', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'X-Application-Id': process.env.TRAVELTIME_APP_ID,
'X-Api-Key': process.env.TRAVELTIME_API_KEY,
},
body: JSON.stringify({
homes: [{ id: 'home', lat: 51.5365, lng: -0.0618 }],
profile: {
checks: {
dry: { field: 'neighbourhood.flood.zone', max: 1, must: true },
school: { field: 'proximity.walk_s.school', max: 600, weight: 20 },
nursery: { field: 'proximity.walk_s.preschool', max: 600, weight: 10 },
playground: { field: 'proximity.walk_s.playground', max: 300, weight: 10 },
big_park: { field: 'proximity.bands.walk.600.over_1ha_count', min: 1, weight: 15 },
green: { field: 'proximity.bands.walk.600.green_share', min: 0.15, weight: 5 },
gp: { field: 'proximity.walk_s.doctor', max: 600, weight: 10 },
shop: { field: 'proximity.walk_s.supermarket', max: 600, weight: 5 },
quiet: { field: 'neighbourhood.noise.road_lden_db', max: 55, weight: 10 },
air: { field: 'neighbourhood.air_quality.no2_ugm3', max: 25, weight: 5 },
crime: { field: 'neighbourhood.crime.per_1000', max: 80, weight: 10 },
},
},
}),
})
// The score, whether every must held, and each check's value and verdict
const [{ score, musts_met, checks }] = (await response.json()).results
The same call from your own code: the Data API over HTTPS, with your TravelTime keys. Read the docs