Black Friday: 25% off for life on any planEnds December 10

Polling and webhooks: how to get results back

The three LocalPipe polling endpoints, the key they use, and why a polling loop must have no time limit. Use callback_url when your tool has a hard timeout.

View .mdUpdated

#Polling Endpoints

Endpoint Purpose
GET /get-job-results?job_id=xxx Poll enrichment results
GET /get-job-status?job_id=xxx Poll enrichment status
GET /get-scrape-results?task_id=xxx Poll maps search results

#🚨 REQUIRED: Use Unlimited Polling

You MUST configure your polling loop with no maximum duration. Stop polling only when the response contains your record/results — never when a timer expires.

LocalPipe operates a fair-share queue: during high-traffic periods, your records may sit in the pending queue for several minutes (occasionally longer) before processing begins. Jobs never expire server-side. If your client gives up early, you will:

  • ❌ Never receive your results (even though we successfully processed them)
  • ❌ Be charged credits for work you never see
  • ❌ Mistakenly believe the API is broken when it's working as designed

Correct polling pattern:

JavaScript
// ✅ CORRECT — polls forever until results arrive
async function waitForResults(jobId) {
  while (true) {
    const res = await fetch(`${API_BASE}/get-job-results?job_id=${jobId}`, {
      headers: { apikey: ANON_KEY }
    });
    const data = await res.json();
    if (data.status === 'completed') return data.records;
    if (data.status === 'failed') throw new Error(data.error_message);
    await new Promise(r => setTimeout(r, 5000)); // 5s between polls
  }
}
JavaScript
// ❌ WRONG — gives up after 5 minutes, loses results
const TIMEOUT_MS = 5 * 60 * 1000;
const start = Date.now();
while (Date.now() - start < TIMEOUT_MS) { /* ... */ }

Polling intervals: every 5s for jobs ≤ 2,000 records, every 10s for larger jobs. The /get-job-status response includes a recommended_poll_interval field — respect it.

For automation tools with hard HTTP timeouts (Clay, Zapier, Make): Use callback_url instead of polling. We POST results to your webhook the moment they're ready, with no client-side waiting required.