Continuous monitoring: pools of addresses that CipherOwl rescans, and the feed of risk-level changes it records for them.

CipherOwl documents no webhooks for monitoring: changes are polled. Run poll-risk-changes from a schedule, persist the returned page-token (for example in a Hot store) and pass it back next time; an empty page means you are caught up. Treat each record's changeId as an idempotency key, since a resumed poll can return a record twice. Records appear a couple of minutes after detection. When a pool's openCaseRiskLevels are reached, CipherOwl also opens a case (see ::cipherowl::cases).

Risk levels, lowest to highest: LOW (the "no risk" floor), MEDIUM, HIGH, SEVERE.

Values

MAX_ADDRESSES_PER_CALL

MAX_ADDRESSES_PER_CALL: Int 1000

POOLS_PATH

POOLS_PATH: Str "/api/monitoring/v1/pools"

Functions

add-addresses

fn (pool-id: Str, entries: Vec<Map>): Map
fn (pool-id: Str, entries: Vec<Map>, opts: Map): Map

Enrol addresses ([{chain, address}], at most 1000) in a pool. Returns {addedCount, results: [{address, outcome}]} with outcomes ADDED, RESURRECTED, SKIPPED_DUPLICATE or INVALID. The call has a 25-second budget: on a 504, list the pool before retrying.

Example

::cipherowl::monitoring/add-addresses("3f2b9c1e-0000-4000-8000-000000000001", [
  {chain: "evm", address: "0x93df2c9c8786242b8fdca3f96b3914b8b4a9f704"}
])

address-entries

fn (entries: Vec<Map>): Vec<Map>

Validate [{chain, address, riskLevel?}] entries for enrolment calls: each chain must be a known chain and each EVM address well-formed; 1 to 1000 entries. Exposed for testing.

Example

::cipherowl::monitoring/address-entries([{chain: "EVM", address: "0x0000000000000000000000000000000000000001"}])  // [{chain: "evm", address: "0x0000000000000000000000000000000000000001"}]
is-err(::cipherowl::monitoring/address-entries([]))  // true

create-pool

fn (pool: Map): Map
fn (pool: Map, opts: Map): Map

Create a monitoring pool. Returns {pool: {id, name, riskConfigs, openCaseRiskLevels, ...}}.

Example

out ::cipherowl::monitoring/create-pool({
  name: "hot-wallets",
  riskConfigs: [{riskConfig: "co-vasp", riskLevel: "HIGH"}],
  openCaseRiskLevels: ["SEVERE"]
})
out.pool.id

create-pool-request

fn (pool: Map): Map

The spec for creating a pool. pool takes name (required, unique in your organization), description, riskConfigs (1 to 3 {riskConfig, riskLevel} bindings, e.g. {riskConfig: "co-vasp", riskLevel: "HIGH"}) and openCaseRiskLevels (levels that open a case). Exposed for testing.

Example

spec ::cipherowl::monitoring/create-pool-request({name: "hot-wallets", riskConfigs: [{riskConfig: "co-vasp", riskLevel: "HIGH"}]})
spec.path  // "/api/monitoring/v1/pools"
is-err(::cipherowl::monitoring/create-pool-request({name: "hot-wallets", riskConfigs: []}))  // true

delete-pool

fn (pool-id: Str): Map
fn (pool-id: Str, opts: Map): Map

Delete a pool and stop monitoring its addresses. Returns {success}.

Example

out ::cipherowl::monitoring/delete-pool("3f2b9c1e-0000-4000-8000-000000000001")
out.success

drain-pages

fn (fetch: Fn, token: Str?, max-pages: Int, acc: Vec): Map

Follow the risk-change feed from token, collecting changes, until an empty page or max-pages. Returns {changes, page-token}, where page-token is the position to resume from next time (the last non-empty page's nextPageToken, or the starting token when nothing was new). fetch takes a token and returns one page. Exposed for testing.

Example

fetch (token) { if(is-null(token), {changes: [{changeId: "c1"}], nextPageToken: "p2"}, {changes: []}) }
::cipherowl::monitoring/drain-pages(fetch, null, 5, [])  // {changes: [{changeId: "c1"}], page-token: "p2"}

get-pool

fn (pool-id: Str): Map
fn (pool-id: Str, opts: Map): Map

A pool by id: {pool}.

Example

out ::cipherowl::monitoring/get-pool("3f2b9c1e-0000-4000-8000-000000000001")
out.pool.name

list-addresses

fn (pool-id: Str): Map
fn (pool-id: Str, options: Map): Map
fn (pool-id: Str, options: Map, opts: Map): Map

One page of a pool's members: {members: [{chain, address, addedAt, initialRisk, currentRisk}], nextPageToken, totalCount}. options takes pageSize (default 50, max 1000) and pageToken.

Example

page ::cipherowl::monitoring/list-addresses("3f2b9c1e-0000-4000-8000-000000000001", {pageSize: 100})
page.totalCount
map(page.members, (m) { m.currentRisk })

list-all-addresses

fn (pool-id: Str, limit: Int): Vec
fn (pool-id: Str, limit: Int, opts: Map): Vec

Collect up to limit members of a pool across pages.

Example

members ::cipherowl::monitoring/list-all-addresses("3f2b9c1e-0000-4000-8000-000000000001", 5000)
length(members)

list-all-pools

fn (limit: Int): Vec
fn (limit: Int, opts: Map): Vec

Collect up to limit pools across pages.

Example

pools ::cipherowl::monitoring/list-all-pools(500)
length(pools)

list-pools

fn (): Map
fn (options: Map): Map
fn (options: Map, opts: Map): Map

One page of pools: {pools, nextPageToken}. options takes pageSize and pageToken.

Example

page ::cipherowl::monitoring/list-pools({pageSize: 50})
map(page.pools, (p) { p.name })
page.nextPageToken

list-risk-changes

fn (pool-id: Str, options: Map): Map
fn (pool-id: Str, options: Map, opts: Map): Map

One page of risk-change records, oldest first: {changes: [{changeId, chain, address, kind (SCAN | ENROLL | REBASELINE), previousRisk, currentRisk, initialRisk, detectedAt}], nextPageToken}.

Example

page ::cipherowl::monitoring/list-risk-changes("3f2b9c1e-0000-4000-8000-000000000001", {since: "2026-11-01T00:00:00Z", pageSize: 100})
map(page.changes, (c) { c.currentRisk })
page.nextPageToken

members-request

fn (pool-id: Str, leaf: Str, entries: Vec<Map>): Map

The spec for an enrolment call (addresses, addresses:batchDelete or addresses:rebaseline; the colon is part of the path) with validated entries. Exposed for testing.

Example

spec ::cipherowl::monitoring/members-request("pool-1", "addresses:batchDelete", [{chain: "evm", address: "0x0000000000000000000000000000000000000001"}])
spec.path  // "/api/monitoring/v1/pools/pool-1/addresses:batchDelete"

poll-risk-changes

fn (pool-id: Str, page-token: Str?, max-pages: Int): Map
fn (pool-id: Str, page-token: Str?, max-pages: Int, opts: Map): Map

Read everything new in a pool's risk-change feed since page-token (null the first time), up to max-pages pages of 1000. Returns {changes, page-token}: handle changes, then persist page-token for the next poll.

Example

out ::cipherowl::monitoring/poll-risk-changes("3f2b9c1e-0000-4000-8000-000000000001", null, 5)
escalations filter(out.changes, (c) { in(c.currentRisk, ["HIGH", "SEVERE"]) })

rebaseline-addresses

fn (pool-id: Str, entries: Vec<Map>): Map
fn (pool-id: Str, entries: Vec<Map>, opts: Map): Map

Move the baseline risk of members ([{chain, address, riskLevel?}]) so only future changes are reported. Returns {rebaselinedCount, results: [{outcome: APPLIED | NOT_FOUND | NO_OP, newBaseline}]}.

Example

// Accept the current risk, so only later changes are reported
out ::cipherowl::monitoring/rebaseline-addresses("3f2b9c1e-0000-4000-8000-000000000001", [{chain: "evm", address: "0x0000000000000000000000000000000000000001", riskLevel: "HIGH"}])
out.rebaselinedCount

remove-addresses

fn (pool-id: Str, entries: Vec<Map>): Map
fn (pool-id: Str, entries: Vec<Map>, opts: Map): Map

Stop monitoring addresses ([{chain, address}]). Returns {removedCount, results}.

Example

out ::cipherowl::monitoring/remove-addresses("3f2b9c1e-0000-4000-8000-000000000001", [{chain: "evm", address: "0x0000000000000000000000000000000000000001"}])
out.removedCount

risk-changes-request

fn (pool-id: Str, options: Map): Map

The spec for one page of a pool's risk-change feed. options takes pageSize (default 50, max 1000), pageToken (resume position) and since (RFC 3339; ignored when a page token is given). Exposed for testing.

Example

::cipherowl::monitoring/risk-changes-request("pool-1", {pageSize: 100}).path  // "/api/monitoring/v1/pools/pool-1/risk-changes?pageSize=100"

risk-history

fn (pool-id: Str, chain: Str, address: Str, options: Map): Map
fn (pool-id: Str, chain: Str, address: Str, options: Map, opts: Map): Map

The risk history of one pool member. options takes pageSize and pageToken.

Example

::cipherowl::monitoring/risk-history("3f2b9c1e-0000-4000-8000-000000000001", "evm", "0x0000000000000000000000000000000000000001", {pageSize: 20})

update-pool

fn (pool-id: Str, changes: Map): Map
fn (pool-id: Str, changes: Map, opts: Map): Map

Rename a pool or replace its openCaseRiskLevels. Returns {pool}.

Example

out ::cipherowl::monitoring/update-pool("3f2b9c1e-0000-4000-8000-000000000001", {openCaseRiskLevels: ["HIGH", "SEVERE"]})
out.pool.openCaseRiskLevels

update-pool-request

fn (pool-id: Str, changes: Map): Map

The spec for renaming a pool and/or replacing its openCaseRiskLevels (sent as {levels: [...]}); omitted fields are unchanged. Exposed for testing.

Example

::cipherowl::monitoring/update-pool-request("pool-1", {openCaseRiskLevels: ["HIGH", "SEVERE"]}).body  // {openCaseRiskLevels: {levels: ["HIGH", "SEVERE"]}}