Skip to main content
Access is being released to eligible organisations in Console. Activate the required event families before connecting. Live capture, source-verified history and the partial SQL index have separate coverage semantics below.

Access

On-chain Events uses your organisation’s WebSockets key, an active Build plan or above, and explicit grants for the event families you select. Book and fills access does not grant these families. API secrets remain in your backend. In Console, open On-chain Events, choose your WebSockets key and click Enable selected events if access is not configured. Existing permissions for other events remain enabled. The workspace then separates:
  • Live: connect/disconnect and preview events. Expand Event filters & raw data for family/condition filters, raw ABI logs and optional retained replay. Replay is off by default; requesting it consumes usage. Switching tabs disconnects the live stream.
  • History: choose independent event filters and UTC dates, then download finalized NDJSON. Choose one page or up to five pages per action. A page is bounded to 2 MiB, so five pages are bounded to 10 MiB. The Console shows the current tariff and maximum byte/credit budget before downloading.
  • API & examples: protocol references and authentication documentation.
Feed live describes recent durable capture, while Connected describes your browser connection. Historical coverage is separate. Missing health or pricing is shown as unavailable. Quiet event families do not imply capture failure. Historical downloads follow cursors even after empty pages. A non-null cursor means more pages remain; use Continue download. Each page retains its metadata line in the combined NDJSON file. Stop after current page saves received pages and preserves continuation. If a later page fails, earlier received pages are saved and continuation retries the next page. Switching organisations, keys or historical filters starts a different download scope. Contract customers see usage recorded under their existing agreement; normal accounts use their credits. An owner or administrator enables new organisation families. Developers may configure keys within the organisation’s enabled families. Billing membership does not grant credential access. The token-registration family targets the legacy CTF exchanges that emit TokenRegistered. The inspected current CTF Exchange V2 ABIs do not declare that event. Native preparation events are a separate family; they must not be relabeled as CTF token-registration logs. Stream and historical grants are independent. Coverage is declared separately for CTF and Protocol V2. Native Protocol V2 does not emit a CTF preparation event for every condition. The decoder covers historical and current declarations for combo condition/event splits and merges, event conversion, and YES-basket conversion/merge. The four inspected implementation epochs use 14 distinct signatures for these operations. It additionally decodes inspected position-migration, compression, extract/inject, wrap/unwrap, bridge, migration-registration and result-reporting declarations. This completes software support for the selected implementation ABI inventory; full native lifecycle coverage over a historical range is not certified. Combo transformations use the existing collateral family with kind equal to split, merge or convert. payload.operation distinguishes split_on_condition, merge_on_condition, split_on_event, merge_on_event, convert_on_event, convert_to_yes_basket and merge_from_yes_basket. Their amount_unit is position_base_units: transforming an existing position does not represent a new collateral deposit, trade volume or fee revenue. condition_id is the parent/full condition carried by the log; parent_condition_id, child YES/NO condition IDs and native_event_id are preserved where declared. Market filtering matches that primary condition; it does not expand the event into underlying legs or child-market activity. Current declarations carry a recipient, two recipients or an ordered recipients array. Arrays preserve repeated addresses and their original order. Historical declarations without recipient fields leave them absent. The candidate limits recipient arrays to 256 entries; an oversized or malformed event halts capture without advancing its checkpoint. This is a decoder limit, not an asserted protocol maximum. With a pinned implementation, a signature not declared for that implementation is rejected. These are software guarantees; the deployment registry, historical range and on-chain occurrences still require certification. The decoder also supports MigrationResolved on the binary and NegRisk modules. These frames use type: "resolution" and kind: "migration_resolved". condition_id identifies the native condition; legacy_condition_id identifies its linked CTF condition. legacy_payouts preserves the two original payout numerators and legacy_payout_denominator their sum. payouts preserves the normalized native numerators with payout_denominator: "1000000". These are resolution ratios, not trade volume or collateral amounts. Distinct logs for the same condition retain distinct event IDs; do not count multiple resolution logs as multiple market settlements. Software acceptance does not certify the historical completeness of these frames.

Additional native lifecycle operations

These operations share the existing family grants; they do not create new token types or change the byte tariff. The operation names below identify payload.operation, rather than always matching the top-level kind:
  • Compression, extract/inject and wrap/unwrap use kind: "convert".
  • Bridge mint/burn use kind: "bridge".
  • Position migration uses kind: "migrate" and operation: "migrate_position".
  • Legacy collateral settlement uses kind: "settle" and operation: "legacy_collateral_settlement".
  • The preparation and result-availability operations below use their operation name as kind.
Use both fields when classifying transformations. A conversion frame does not, by itself, prove a NegRisk conversion or a collateral deposit. The decoder uses 18 additional exact signatures from 80 inspected declarations, including historical recipient-less forms. Historical combo ABIs declare bridge events that the current combo ABI does not; implementation/ABI guards preserve that distinction. Bridge arrays are canonical, paired and bounded to 256 entries. Malformed, mismatched, oversized or unrecognized-epoch input halts capture. Condition filtering matches explicit condition attribution. A log carrying only position IDs does not acquire an inferred Polymarket market identity. Such logs remain in the firehose and, where an actor/recipient is declared, wallet output; complete per-market coverage also requires a verified position-to-market registry. Likewise, logs without a declared wallet cannot be presented as wallet flows. Administrative role/ownership/initialization events are outside these lifecycle families; ERC1155 transfers are not implicitly included. Do not interpret absence from a filtered response as proof of no activity.

Connection contract

The API accepts a signed GET /mempool/token?families=... request and returns a short-lived grant. Use the edge address configured for the same environment, at /ws/onchain. Reconnecting requires a fresh grant. Never reuse production destinations as a staging fallback.
The versioned socket is separate from legacy /ws so legacy collateral frames cannot be confused with the new schema. A revoked or expired credential loses access. The implementation uses a maximum 30-second revocation recheck interval; expiry has a deadline timer.

Capabilities and API reference

Use the same signed request format as the other Bravado market-data endpoints: GET /v1/polymarket/onchain/capabilities. The response reports your current plan access, independent stream/history permissions for all four families, the effective bytes tariff, canonical endpoint paths and whether recent replay is enabled. An unknown tariff or an unavailable capability is not permission to assume free access. The Console reads this contract through its server-side organisation scope; API secrets are never returned to your browser. Changing keys refreshes permissions and stops the previous connection. The API publishes its market-data OpenAPI contract at /stream/openapi.json and the interactive reference at /docs/market-data. Internal ingestion and Console administration routes are excluded. On-chain customer routes are omitted when the corresponding release flags are disabled.

Run a signed connection

This example requires the production destinations to be enabled for your environment and organisation. It uses Node.js 22 or above with no dependencies. Run it on your backend, with a WebSockets key (ws_stream, stream.read) whose selected stream families are enabled. Your secret signs the grant request and is never sent to the feed. Save the connection example as polymarket-feed.mjs, then set BRAVADO_API_KEY and BRAVADO_API_SECRET in your environment. Run:
The example requests all four families and prints real received frames for 60 seconds. For collateral and resolutions only, set BRAVADO_EVENT_FAMILIES=collateral,resolutions. To test the separate fills socket, set BRAVADO_FEED_MODE=fills. No trades or on-chain operations are submitted. Quiet families may produce no events during a short observation. Sign the canonical path: query keys are sorted and values use RFC 3986 percent encoding. In this single-parameter example, the commas are encoded as %2C:
For staging, set both BRAVADO_API_ORIGIN and BRAVADO_FEED_ORIGIN to that environment. Do not exchange a staging grant against the production edge. Never paste a secret or a token into a support message. A 404 on /ws/onchain means that route has not been deployed there; it is not fixed by rotating a key. A 403 during grant issuance requires checking scope, family grants, plan and available credits. Reconnect with a new signed grant after expiry or a gap.

Recent replay

When capabilities report replay available, add "replay": 100 to the subscription message or replay=100 to the initial connection query. The candidate retains the latest 500 transitions across all families, reconstructed from its local durable retained journal on restart. Verified local-cache retirement can leave fewer than 500 transitions available after a restart; the current implementation does not load old bucket objects into the live replay buffer. The requested count is applied to transitions matching your subscriptions; overlapping subscriptions do not duplicate a transition. Replay frames carry replay: true. A nonbillable replay_end control reports requested, delivered, retained_transitions, earliest_cursor and barrier_cursor. The replay/live barrier prevents a new live publication from being interleaved with that replay. A queue overflow closes the connection. This bounded replay does not certify recovery of every missed event. Fewer matching transitions than requested may be available. Use the historical endpoint for older windows, subject to its separate permission and coverage status. An unsupported replay request fails explicitly instead of silently appearing to recover a gap.

Streams

Native condition IDs are kept at their ABI width in payloads. The existing 32-byte channel boundary right-pads native IDs with zero bytes. A condition filter does not include group-level converts without that condition ID.

Interpret amounts and identity

Amounts, token IDs, payout numerators and masks are exact decimal strings. Keep them as strings or integers; do not parse them as floating-point numbers.
  • Split and merge amounts describe the operation, not exchange volume.
  • Redemption amount is the payout, including zero. Native redemption also preserves position_amount; the two quantities are different.
  • Convert preserves neg_risk_market_id for CTF NegRisk, or native_event_id and condition_index for Protocol V2. Neither is a CTF condition ID.
  • CTF resolution payout is numerator divided by payout_denominator. Native module results use their verified denominator, not an assumed binary winner.
  • wallet is the on-chain initiator/stakeholder/redeemer. Native frames also preserve recipients. It is not automatically the owner EOA or transaction sender.
  • Asset address and verified decimals are explicit. Parent-position units must not be labelled as dollars. Missing metadata stays unknown.
These lifecycle logs alone do not reconstruct wallet balances. Transfers and fills also change balances, and related adapter/CTF logs must not be summed as independent economic flows.

Provenance and corrections

Schema version 2 carries event_id, event_version, chain, contract/ABI version, block hash, transaction, log index and decoded payload. Full mode also includes raw topics/data; compact mode omits those raw fields. It also carries venue_membership; unknown is not certified Polymarket membership. The occurrence identity includes the block hash. A reorg produces an explicit reorged transition with removed: true. Re-inclusion has a new occurrence ID. A finalization transition confirms the canonical occurrence. Free live corrections carry identity and state only, with delivery_kind: "correction"; they omit the economic payload and raw ABI fields. Merge them into a previously received event by event_id, applying a newer event_version. If you did not receive the initial event, keep its economic fields unknown and retrieve them through granted history. Requested replay supplies the full selected event shape and remains billable, including replayed finalization or reorg transitions. Deduplicate by (event_id, event_version), never by (tx_hash, status) for these families. Overlapping firehose, wallet and market subscriptions deliver an occurrence once per connection. The stream label uses the first matching route in deterministic order: firehose, condition, wallet, then group/token. Recent replay and historical queries remain release-gated; neither implies complete reconnect recovery or certified historical coverage.

Compact frame examples

These seven examples are synthetic fixtures with invented addresses, IDs and blocks. They document the compact wire shape; they are not production observations or audited economic flows. Full mode adds raw ABI topics/data.

Historical REST

Use GET /v1/polymarket/onchain/events with the existing signed partner request format and independent history grants. Supply UTC from and to values and selected families. Windows are [from,to), at most 31 days. limit defaults to 500 and cannot exceed 1,000. Optional wallet, condition_id and neg_risk_market_id filters combine with AND.

Verified source reads

The finalized-history path (source=chain) verifies the requested blocks against two independently operated chain sources using the same versioned contract decoder as the live feed. It can read periods outside the application index without requiring an operator to import that period first. Both sources must agree on logs and headers; proxy implementation checks reject unregistered upgrades. A successful page reports coverage.complete=true, audit_state=source_verified and scope=versioned_contract_registry, together with source/registry fingerprints, scanned block bounds and a frozen finalized anchor. This covers the supported contracts and requested filters. It is not a claim about every contract on Polygon. Complete the pagination to finish the requested window. Each page scans a bounded block range and may contain fewer events than limit, including zero events with a non-null cursor. Always follow next_cursor until it is null. The signed cursor binds the organisation, filters, contract registry and finalized anchor; another organisation or changed filters cannot reuse it. consistency=finalized is required for source reads. An end time beyond the finalized head returns 409 HISTORY_RANGE_NOT_FINALIZED; choose an older exclusive end time or use the live stream for current activity. A changed anchor, divergent sources or unavailable archival state returns 503 HISTORY_SOURCE_UNAVAILABLE. The API does not silently turn that failure into a partial success. A registry update invalidates an outstanding source cursor with 409 HISTORY_REGISTRY_CHANGED. Start a fresh download so all pages use the same contract versions. Source cursors expire after 24 hours of inactivity; each successful page renews that lifetime.

Indexed partial reads

source=index&allow_partial=true retains the indexed-history path, including mined observations with consistency=mined. It reports coverage.complete=false while index certification is pending. Its signed cursors bind the insertion snapshot and retain their original behaviour. Existing indexed cursors continue on that path; they do not turn into source cursors midway through a download.

Page limits and downloads

Responses have a 2 MiB limit (history_max_response_bytes in capabilities). Each API instance admits two concurrent history requests per organisation and four in total; the source worker has its own bounded capacity. Capacity exhaustion returns 429 ONCHAIN_HISTORY_BUSY with Retry-After: 1. Source reads have a 20-second work deadline. Indexed SQL has a 15-second deadline and can return 503 ONCHAIN_HISTORY_QUERY_TIMEOUT. Retry the same cursor after the indicated delay. These limits also apply to flat contracts. Set format=ndjson to download one page as application/x-ndjson. The first line is export_metadata with cursor, coverage and billing; subsequent lines contain decoded events. Every line ends with a newline. JSON and NDJSON can use the same filter-bound cursor. Metadata, evidence and newline bytes count as delivered usage. Console uses this same endpoint through its session-checked HMAC bridge, with 100 events per page. Your API secret stays on the server. Choose UTC start and exclusive end dates and the event families. The download reports whether the actual returned range is verified or partial. API delivery to Console is accounted even if your browser subsequently fails to save the file. This is a paginated download; durable archive-backed WebSocket replay and background export jobs are separate features.

Usage and price

The selected initial tariff is one credit per 20,000 uncompressed UTF-8 bytes of delivered data. It uses your existing credit balance. No separate monthly subscription is required. The access response must expose the effective tariff; unknown tariff is not free usage. Requested replay and historical downloads are billable deliveries. Controls, heartbeats, live identity-only finalization/correction frames and internal receipt retries are not charged. Requested replayed transitions are delivered data and are charged even when their event status is finalized or reorged. A generated but undelivered export is not a delivered-data charge. The ledger records each streamed family separately: collateral, resolutions, new conditions and token registrations. Console Usage shows delivered credits by product. Failed or ambiguous writes retain their reservation for reconciliation; they do not automatically become a charge or a zero-byte settlement. Repeating an identical delivery receipt does not add consumption. These paths have finite acceptance tests; production invoice acceptance and the customer browser journey remain release gates.

Flat and negotiated contracts

A verified flat monthly contract uses the same WebSockets key, HMAC requests, family permissions, short-lived grants and delivery receipts as other plans. It records the delivered bytes and credit usage without charging an overage or refusing access because those credits are exhausted. Normal rate limits, credential restrictions and family permissions still apply. For these organisations, capabilities, stream-grant billing and historical response metadata include billing_disposition: "contract". For example:
The byte-to-credit ratio remains the usage measurement; it is not an additional monetary charge under the flat contract. Requested replay and historical downloads are also recorded as usage covered by that contract. Console identifies this as included in your contract. The grant response reports the effective terms; an absent or unknown tariff must not be interpreted as free access. Assigned Enterprise subscriptions with unlimited credits use their existing negotiated contract and the same Console activation. No Stripe payment is inferred from a local Enterprise record; this remains an assigned plan. On first activation, Console creates recording-only accounting automatically when needed, without creating a new charge or requiring ops to create tokens. The contract covers the products agreed with your organisation. Event access is still explicitly enabled per family and key; buying a plan does not grant new families implicitly. Reconnects and receipt retries preserve the original commercial identity of the delivery rather than creating another charge.

Storage and recovery

Local capture files are a cache of the durable archive. The retention candidate removes only closed segments after byte-for-byte bucket verification, committed API index confirmation and recorded finality. It preserves bucket objects and the occurrence index; it does not shorten the historical API’s coverage by deleting historical records. Cache retirement is separate from coverage certification. It cannot prove that every contract, event family or block was captured. A lost or lagging index can be rebuilt from verified archive manifests with a finite repair budget; the same source identity and contiguous cursors are required. Older missing data is never silently replaced by a new starting cursor. These operations remain under release acceptance. Their internal credentials and storage permissions are not granted to a customer WebSockets key.

Coverage and availability

Finalized historical reads verify each scanned page against two independent archival sources, using the supported versioned contract registry. Follow every cursor to cover your requested window. The SQL index remains partial; its row count is never evidence of complete history. A registry gap, unknown upgrade or source disagreement refuses the request rather than certifying an empty result. A quiet event family can be healthy; evaluate block/index watermarks and coverage rather than the time of the last redemption. Capture pins proxy ABI epochs by block and global log index. An uncertified upgrade halts the dataset checkpoint instead of extending the old ABI. A failed capture refuses new on-chain connections and closes existing sessions with CAPTURE_UNAVAILABLE during its bounded access recheck. Legacy fill access is a separate flow. Release validation includes a two-source comparison of a finalized test day, a managed-consumer comparison, independent public-stream samples and exact usage reconciliation. These bounded checks do not establish a universal latency SLA or a continuous 24-hour public capture. The under-ten-minute journey from a fresh signup has not yet been independently timed.

Feed status and uptime

Open the live operational status to inspect the current feed instance. This public, read-only endpoint returns 200 while capture is healthy and has committed a block within 30 seconds. It returns 503 while starting, stale or failed, and 404 before the managed on-chain route is enabled. Responses are not cached.
The sample is illustrative. Times ending in _ms are Unix milliseconds; uptime is seconds since this service instance started, not a historical SLA percentage. Capture progress is published only after the block’s durable journal commit. Before the first observed block, capture fields are null, not zero. A healthy live status does not certify complete historical coverage or venue attribution.