const POLL_INTERVAL_MS = 60000;// Poll for completionwhile (true) { const status = await client.jobs.getJobStatus({ job_id: jobId }); if (status.status === "completed") { break; } await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));}// Get resultsconst results = await client.jobs.getJobResults({ job_id: jobId });console.log(`Found ${results.valid_records} valid records`);
Jobs process asynchronously and typically complete in 10-15 minutes. See the
Quickstart for a complete walkthrough.
Working with jobs
Get suggestions
Create and track
Continue jobs
Early results
List jobs
Get suggested validators, enrichments, and date ranges before creating a job:
import { CatchAllApiClient } from "newscatcher-catchall-sdk";const client = new CatchAllApiClient({ apiKey: "YOUR_API_KEY" });const suggestions = await client.jobs.initialize({ query: "AI company acquisitions", context: "Focus on deal size and acquiring company details"});console.log(JSON.stringify(suggestions, null, 2));
Show suggestions response
{ "validators": [ { "name": "is_acquisition_event", "description": "true if article describes a completed or announced acquisition", "type": "boolean" }, { "name": "involves_ai_company", "description": "true if acquiring or acquired company is in AI sector", "type": "boolean" } ], "enrichments": [ { "name": "acquirer_company", "description": "Extract the acquiring company name", "type": "company" }, { "name": "acquired_company", "description": "Extract the acquired company name", "type": "company" }, { "name": "deal_value", "description": "Extract acquisition price if mentioned", "type": "number" }, { "name": "announcement_date", "description": "Extract date of announcement", "type": "date" }, { "name": "acquirer_details", "description": "Extract details about the acquiring company", "type": "text" } ], "start_date": "2026-02-01T14:12:57.292205+00:00", "end_date": "2026-02-06T14:12:57.292205+00:00", "date_modification_message": [ "No dates were provided; using a default window of 5 days (2026-02-01 to 2026-02-06)." ]}
const POLL_INTERVAL_MS = 60000;// Create job with custom validators and enrichmentsconst job = await client.jobs.createJob({ query: "AI company acquisitions", context: "Focus on deal size and acquiring company details", limit: 10, validators: [ { name: "is_acquisition_event", description: "true if article describes a completed or announced acquisition", type: "boolean" } ], enrichments: [ { name: "acquirer_company", description: "Extract the acquiring company name", type: "company" }, { name: "acquired_company", description: "Extract the acquired company name", type: "company" }, { name: "deal_value", description: "Extract acquisition price if mentioned", type: "number" } ]});console.log(`Job created: ${job.job_id}`);// Monitor progressconst jobId = job.job_id;while (true) { const status = await client.jobs.getJobStatus({ job_id: jobId }); if (status.status === "completed") { break; } const currentStep = status.steps.find((s) => !s.completed); if (currentStep) { console.log(`Step ${currentStep.order}/7: ${currentStep.status}`); } await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));}// Retrieve resultsconst results = await client.jobs.getJobResults({ job_id: jobId });console.log(`\nFound ${results.valid_records} valid records`);for (const record of results.all_records) { console.log(` ${record.record_title}`);}
Validators and enrichments are optional. If not provided, the system
generates them automatically based on your query.
Extend processing limits for completed jobs:
const POLL_INTERVAL_MS = 60000;// Continue job to process more recordsconst continued = await client.jobs.continueJob({ job_id: jobId, new_limit: 50,});console.log( `Continued: ${continued.previous_limit} -> ${continued.new_limit} records`);// Wait for completionwhile (true) { const status = await client.jobs.getJobStatus({ job_id: jobId }); if (status.status === "completed") { break; } await new Promise((resolve) => setTimeout(resolve, POLL_INTERVAL_MS));}// Get final resultsconst finalResults = await client.jobs.getJobResults({ job_id: jobId });console.log(`Total: ${finalResults.valid_records} valid records`);
Use limit parameter when creating jobs to start with fewer records for quick testing.
Continue the job if you need more records after reviewing initial results.
Retrieve partial results during the enriching stage:
const monitors = await client.monitors.listMonitors();console.log(`Total event monitors: ${monitors.total_monitors}`);for (const m of monitors.monitors) { const status = m.enabled ? "active" : "paused"; console.log(`${m.monitor_id}: ${status}`);}
Access aggregated results from all event monitor executions:
// List execution historyconst jobs = await client.monitors.listMonitorJobs({ monitor_id: monitor.monitor_id, sort: "desc",});console.log(`Event monitor executed ${jobs.total_jobs} jobs`);// Get all collected recordsconst results = await client.monitors.pullMonitorResults({ monitor_id: monitor.monitor_id,});console.log(`Total records: ${results.records}`);for (const record of results.all_records) { console.log(` ${record.record_title}`); console.log(` Added: ${record.added_on}`);}
Complete event monitor example
import { CatchAllApiClient, CatchAllApiError } from "newscatcher-catchall-sdk";const client = new CatchAllApiClient({ apiKey: "YOUR_API_KEY" });try { // Create event monitor from completed job const jobId = "af7a26d6-cf0b-458c-a6ed-4b6318c74da3"; const monitor = await client.monitors.createMonitor({ reference_job_id: jobId, schedule: "every day at 12 PM UTC", webhook_ids: ["a1b2c3d4-e5f6-7890-abcd-ef1234567890"], }); const monitorId = monitor.monitor_id; console.log(`Event monitor created: ${monitorId}`); // Update webhook await client.monitors.updateMonitor({ monitor_id: monitorId, webhook_ids: ["b2c3d4e5-f6a7-8901-bcde-f12345678901"], limit: 100, }); // List all event monitors const allMonitors = await client.monitors.listMonitors(); for (const m of allMonitors.monitors) { const status = m.enabled ? "active" : "paused"; console.log(`${m.monitor_id}: ${status}`); } // Control execution await client.monitors.disableMonitor({ monitor_id: monitorId }); await client.monitors.enableMonitor({ monitor_id: monitorId }); // List execution history const jobs = await client.monitors.listMonitorJobs({ monitor_id: monitorId, sort: "desc", }); console.log(`\nEvent monitor executed ${jobs.total_jobs} jobs`); for (const job of jobs.jobs) { console.log(` Job ${job.job_id}: ${job.start_date} to ${job.end_date}`); } // Get aggregated results const results = await client.monitors.pullMonitorResults({ monitor_id: monitorId, }); console.log(`\nCollected ${results.records} total records`); for (const record of results.all_records) { console.log(` ${record.record_title}`); }} catch (err) { if (err instanceof CatchAllApiError) { console.error(`Status: ${err.statusCode}`); console.error(`Error: ${err.message}`); }}
Company monitors
Company monitors let you track specific companies across jobs. Create entities,
group them into a dataset, then connect the dataset to any job to get per-company
relevance scores in results.