Skip to content

API Polling

API polling lets your agent periodically fetch data from external REST APIs. Unlike webhooks, which receive pushes from external systems, polling pulls data on a schedule — your browser makes the HTTP requests directly.

All configuration, credentials, and scheduling run entirely in the browser. The server has zero awareness that polling exists.

API Poll data flow: Browser fetches external API, applies mapping and diff check, then sends to AnySoul server via Bridge Webhook
  1. A setInterval timer fires in your browser
  2. The browser calls the external API directly (credentials never touch the AnySoul server)
  3. The response is mapped to event fields (same template engine as webhooks)
  4. An optional SHA-256 diff check skips duplicate data
  5. The mapped result is sent to the server through an auto-created Bridge Webhook — reusing the existing webhook ingest endpoint with zero server-side changes
  1. Open Agent Settings → API Poll
  2. Click Add
  3. Fill in:
    • Name — a label for this poll (e.g. tokyo-weather, btc-price)
    • URL — the API endpoint to call (http:// and localhost are OK)
    • MethodGET or POST
    • Authentication — see Authentication Modes
    • Interval — how often to poll (1 second – 24 hours)
    • JSON Path — extract a nested object from the response (e.g. data.items)
    • Dedup ModeFull (every poll creates an event) or Diff (only when data changes)
  4. Click Create

New polls start in testing mode. Use Test Now to verify the response, then configure mapping before going live.

When a poll is in testing mode:

  1. Click Test Now on the poll card
  2. The browser calls the external API and displays the raw response
  3. Open the Mapping dialog to configure how the response maps to event fields
  4. Review the live preview
  5. Click Go Live to activate — the poll timer starts and events are created on each successful poll

Testing mode lets you iterate on your configuration without creating events.

ModeHeader / ParamUse Case
NonePublic APIs, localhost services
Bearer TokenAuthorization: Bearer <token>APIs using OAuth tokens or static bearer tokens
API Key (Header)Custom header (e.g. X-API-Key)APIs requiring a key in a specific header
API Key (Query)Query param (e.g. ?appid=xxx)APIs like OpenWeatherMap that use query-string keys

All credentials are stored in IndexedDB and never leave your browser.

The mapping dialog is identical to the webhook mapping editor:

  • Left panel — JSON tree of the test response. Click a field to auto-insert the mapping expression.
  • Right panel — Five target fields:
FieldKeyRequiredExample
PlatformplatformNoapi-poll
ElementelementNoweather
Event Typeevent_typeNoupdate
TitletitleYes{{ payload.weather.0.description }} — {{ payload.main.temp }}°C
PayloadpayloadNo{{ payload.main }}

The same template syntax applies — see Template Syntax.

Use JSON Path to extract a nested value from the API response before mapping. For example, if the response is:

{
"status": "ok",
"data": {
"temperature": 12.5,
"humidity": 80
}
}

Setting JSON Path to data extracts { "temperature": 12.5, "humidity": 80 } as the mapping input.

Leave empty to use the entire response object.

ModeBehavior
FullEvery successful poll creates an event
DiffA SHA-256 hash of the mapped result is compared to the previous poll. An event is only created when the mapped output changes.

Diff mode is useful for APIs that return the same data most of the time (e.g. weather, system status). Because the hash is computed on the mapped result rather than the raw response, changes in fields you don’t map (such as timestamps or request IDs) won’t trigger duplicate events.

StatusBadgeBehavior
TestingAmberTest Now works; timer does not run; no events created
ActiveGreenTimer runs on schedule; events created on each successful poll
DisabledGrayTimer stopped; no requests made

Available transitions:

  • Testing → Go Live (active) or Disable
  • Active → Pause (disabled) or Test mode (testing)
  • Disabled → Enable (active)

If a poll fails 5 consecutive times, it is automatically disabled. You’ll see an error message on the poll card. Fix the issue (URL, credentials, CORS) and re-enable manually.

Because requests originate from the browser, they are subject to CORS policies:

TargetCORS BehaviorStatus
localhost / LANUsually no CORS restrictionsWorks
Public APIs (CoinGecko, OpenWeatherMap, etc.)Most set Access-Control-Allow-Origin: *Usually works
Restricted APIsMay block browser requestsMay not work

When a Test Now request fails due to CORS, the error message will indicate this. Workarounds:

  1. Use a webhook instead — if the API supports webhook callbacks
  2. Run a CORS proxy — a lightweight local proxy that adds CORS headers
  3. Browser extension — extensions are not subject to CORS restrictions

Poll configurations can be exported as JSON and imported on another device or browser.

  • Export: Downloads a JSON file containing all poll configurations for the current agent. Runtime state (last polled time, errors) is stripped; credentials are included.
  • Import: Reads a JSON file and creates new poll entries. Imported polls start in testing mode. Existing polls are not overwritten.
LimitValue
Min poll interval1 second
Max poll interval86400 seconds (24 hours)
Max polls per agent10
Request timeout10 seconds
Max response size (for mapping)50 KB
Max event payload size10 KB
Webhook (Push)API Poll (Pull)
DirectionExternal → ServerBrowser → External → Browser → Server
TriggerExternal system sends POSTBrowser timer (setInterval)
Runs whenServer is running (always)Browser/Electron is open
Config storedServer (D1 database)Browser (IndexedDB)
CredentialsServer verifies senderBrowser sends to external API
localhostNot reachableNatively reachable
Cross-deviceAuto-syncedImport/Export JSON
MappingSame template engineSame template engine
Server changesWebhook table + routesNone