NewHomeLogs now covers the Pacific Northwest: Washington, Oregon and Idaho.See Idaho coverage →

Developer Guide

How to Chain Location, Permits, and Signals in One Workflow

May 4, 2026 · 12 min read

If you have not run the baseline calls yet, start with Building Permit API Quickstart for Developers. This guide focuses on the next step: turning those calls into a repeatable production workflow with cursor handling, retries, and explicit routing logic.

Chained API workflow from location resolve to permits and signals

Resolve once, reuse geo_id everywhere, then route by signal decision.

Key Takeaways

  • Persist canonical geo_id from resolver before calling permits or signals.
  • Handle next_cursor explicitly so pagination survives retries and partial failures.
  • Route decision=positive to outbound and status=stable to monitoring by default.
  • Track reliability metrics (resolver hit rate, pagination completion, route distribution) every week.

Purpose of this Day 2 guide

This piece is intentionally deeper than quickstart. The goal is not endpoint awareness. The goal is operational reliability: predictable job runs, deterministic routing, and clear observability when things fail.

Workflow contract: one geo, three endpoint groups

Keep the chain simple: resolve location -> pull permits -> read or search signals. Everything in this flow hangs on canonical geo_id.

1. Resolve location

bash
curl -sS -G "https://api.homelogs.io/v1/locations/resolve" \
-H "X-API-Key: $API_KEY" \
--data-urlencode "query=Seattle" \
--data-urlencode "state=WA" \
--data-urlencode "geo_type=city" \
--data-urlencode "limit=1"

2. Pull permits for the resolved geo

bash
curl -sS -G "https://api.homelogs.io/v1/permits/search" \
-H "X-API-Key: $API_KEY" \
--data-urlencode "geo_id=geo_city_2a597d5e9f502916d87e" \
--data-urlencode "limit=10" \
--data-urlencode "sort=desc"

3. Read one signal for the same geo

bash
curl -sS -G "https://api.homelogs.io/v1/signals/geo/location/geo_city_2a597d5e9f502916d87e" \
-H "X-API-Key: $API_KEY" \
--data-urlencode "signal_keys=hvac_activity_hotspot"

4. Search for geos that are currently positive

bash
curl -sS -G "https://api.homelogs.io/v1/signals/geo/search" \
-H "X-API-Key: $API_KEY" \
--data-urlencode "state=WA" \
--data-urlencode "geo_type=city" \
--data-urlencode "signal_keys=hvac_activity_hotspot" \
--data-urlencode "decision=positive" \
--data-urlencode "limit=25"

Example outputs to test your routing rules

Use one stable example and one positive example in tests so your workflow paths stay deterministic.

Stable location signal (monitoring path)

json
{
"geo_id": "geo_city_2a597d5e9f502916d87e",
"signals": [
{
"signal_key": "hvac_activity_hotspot",
"value": { "status": "stable", "count_90d": 119 },
"score": 0.6948,
"confidence": 0.9,
"decision": "negative"
}
]
}

Positive geo search hit (priority path)

json
{
"state": "WA",
"signals": [
{
"display_name": "EDMONDS, WA",
"signal_key": "hvac_activity_hotspot",
"value": { "status": "hot", "count_90d": 168 },
"score": 1,
"confidence": 0.9,
"decision": "positive"
}
]
}

Production orchestration pattern

The pattern below is the minimum implementation that is usually safe to ship: persist resolver output, page permits with checkpointing, then route from signal decisions.

ts
// 1) Resolve once
const resolved = await api.resolveLocation({
query: "Seattle",
state: "WA",
geo_type: "city",
limit: 1
});
const geo = resolved.candidates[0];
if (!geo) return { skipped: true, reason: "no_candidate" };
saveGeo({
geo_id: geo.geo_id,
geo_type: geo.geo_type,
display_name: geo.display_name,
confidence: geo.confidence
});
// 2) Pull permits with pagination
let cursor = null;
const permits = [];
do {
const page = await api.searchPermits({
geo_id: geo.geo_id,
limit: 100,
sort: "desc",
cursor
});
permits.push(...page.permits);
cursor = page.next_cursor ?? null;
checkpointCursor(geo.geo_id, cursor);
} while (cursor);
// 3) Read signals and route
const signalRes = await api.readGeoSignals({
geo_id: geo.geo_id,
signal_keys: ["hvac_activity_hotspot"]
});
const hvac = signalRes.signals.find((s) => s.signal_key === "hvac_activity_hotspot");
if (hvac?.decision === "positive") routeToOutboundQueue(geo, hvac, permits);
else routeToMonitoringQueue(geo, hvac, permits);

State model: what to persist between runs

Persisting state is the difference between a demo and a reliable workflow. At minimum, store canonical geo identity, the last permit cursor, and the last signal compute timestamp.

json
{
"geo_id": "geo_city_2a597d5e9f502916d87e",
"geo_type": "city",
"display_name": "SEATTLE, WA",
"confidence": 0.99,
"last_resolved_at": "2026-04-28T09:00:00Z",
"last_permit_cursor": "eyJkIjoi...",
"last_signal_computed_at": "2026-04-15T04:07:07+00:00"
}

Routing logic: stable vs positive

In your current Seattle example, HVAC is stable and decision is negative. That should land in monitoring, not immediate outbound. Use positive search results (for example, hot cities in WA) to seed active prioritization queues.

ts
function classifyHvacSignal(signal) {
if (!signal) return { route: "monitoring", reason: "missing_signal" };
if (signal.decision === "positive") {
return { route: "outbound_priority", reason: "hotspot_positive" };
}
if (signal.value?.status === "stable") {
return { route: "monitoring", reason: "stable_market" };
}
return { route: "monitoring", reason: "non_positive_signal" };
}

Retry and backoff policy

Retry only transient failures and cap backoff. This protects your workers during short outages without creating runaway loops.

ts
const retryableStatus = new Set([429, 500, 502, 503, 504]);
async function callWithBackoff(fn, maxAttempts = 4) {
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
try {
return await fn();
} catch (err) {
const status = err?.response?.status;
const retryable = retryableStatus.has(status) || !status;
if (!retryable || attempt === maxAttempts) throw err;
const waitMs = Math.min(8000, 300 * 2 ** (attempt - 1));
await sleep(waitMs);
}
}
}

Failure handling you should implement on day one

  • Retry with backoff: retry transient 5xx or network failures with capped attempts.
  • Checkpoint cursor state: store next_cursor to avoid duplicate scanning after restart.
  • Guard empty candidates: do not continue if resolver returns count=0.
  • Emit structured logs: include geo_id, endpoint, and decision fields for traceability.

Recommended weekly runbook

  1. Resolve and refresh your tracked geos.
  2. Pull permit deltas for each tracked geo.
  3. Read key signals per geo and classify route.
  4. Run geo search for new positive markets and add candidates.
  5. Review route outcomes and adjust thresholds only if conversion data supports it.

Test matrix for release readiness

Before you ship, test negative, stable, and positive branches explicitly. This catches most routing regressions before production.

json
[
{
"case": "resolver_no_candidates",
"input": { "query": "Unknown City", "state": "WA" },
"expected_route": "skip_geo",
"assertion": "no permit/signal calls executed"
},
{
"case": "signal_positive",
"input": { "decision": "positive", "status": "hot" },
"expected_route": "outbound_priority",
"assertion": "queue=outbound_priority"
},
{
"case": "signal_stable_negative",
"input": { "decision": "negative", "status": "stable" },
"expected_route": "monitoring",
"assertion": "queue=monitoring"
}
]

Observability metrics to track weekly

  • Resolver success rate: percentage of queries returning at least one candidate.
  • Permit ingestion completion rate: jobs that finish cursor pagination without retry exhaustion.
  • Route distribution: percentage of outbound_priority vs monitoring decisions.
  • Queue conversion by signal key: downstream outcome by routed key and geo.

Related reads

Bottom line

A reliable chain is more valuable than a complex one. If you persist geo identity, paginate safely, and route with explicit signal rules, you will ship faster and debug less.

FAQ

Should I start with city or ZIP geos?
Start where your operators make decisions today. Most teams begin with city, then add ZIP segmentation after workflows stabilize.

How many signals should I run in the first version?
Usually 1 to 3 signal keys per motion. Expand only after you can measure conversion by key.

Where can I request access?
Use the API key request form and include your target geos plus intended signal keys.