Skip to content

OverviewCore concepts

The same real-world question often trades on several venues at once. Predictefy’s matching system (embedding similarity plus language-model review) groups candidate markets into clusters, and computes indicative price discrepancies between cluster members.

Terminal window
curl -s "$PREDICTEFY_API_URL/v1/clusters?limit=20" \
-H "Authorization: Bearer pk_live_YOUR_KEY"
  • GET /v1/clusters — a page of cross-venue clusters.
  • GET /v1/clusters/:id — one cluster with its per-venue member markets.

Cluster members carry a similarity score — the raw embedding similarity between the matched markets. It is deliberately not called “confidence”: it is not a calibrated probability that the markets are equivalent. Cluster ids are stable — they do not change when a member market delists.

similarity measures embedding closeness. Membership-derived relation: "identity" means the pair shares a stored cluster; it does not prove equivalent resolution rules. Every served pair carries matchQuality, the latest recorded resolution verdict under the same trust rules used before execution. A verdict counts only when it was recorded by the current configuration, against the current evidence, and is still fresh. This is not live verification, including when discrepancy prices are live.

matchQuality contains verdict, judgedAt (ISO date-time or null), confidence (high, medium, low, or null), differenceKinds, and vetoes. Verdict confidence is separate from embedding similarity.

confidence is the confidence in the recorded verdict, not a confidence in the label. differenceKinds contains only the recorded differences, de-duplicated in first-seen order. vetoes lists deterministic execution vetoes that changed the label. Its one kind today is close_dates: the close-date check vetoed an equivalent verdict because the close dates are more than 21 days apart. It is empty for every other label. More kinds may be added later.

VerdictMeaning
insufficient_evidenceComes first: the recorded verdict reports insufficient evidence, even when it also lists a polarity difference.
judged_equivalentMeets the bar execution requires for resolutionEquivalence verified and matchBand verified: equivalent, high confidence, sufficient evidence, rules available, no polarity difference, and close dates no more than 21 days apart.
likely_equivalentEquivalent with sufficient evidence but below the verified bar: lower confidence or unavailable rules. Never a vetoed pair.
judged_not_equivalentA negative verdict with sufficient evidence, a verdict listing a polarity difference, or an equivalent verdict that the deterministic close-date check vetoes (close dates more than 21 days apart; vetoes lists close_dates, and differenceKinds stays verdict-only). The pair stays visible.
not_judgedNo verdict passed the trust rules. This makes no equivalence claim.
unavailableThe label could not be computed. The page is still served.

fetchArbitrage and fetchRelatedMarkets rows carry no matchQuality. fetchArbitrage rows carry their own resolutionEquivalence, matchScore, matchBand and matchDifferences; only hidden-band rows are withheld, so a served non-executable row can be unverified or judged not equivalent. fetchRelatedMarkets serves relation edges with the fixed label value verified outcome implication and carries no matchQuality.

unavailable covers a failure while loading books or verdicts, a labeling time limit on the route, label-code exceptions, pairs beyond the 1,000-pair cap, or an unavailable verdict identity. Label failures never cause a 503 or remove the page’s data or pagination. For both not_judged and unavailable, judgedAt and confidence are null, and differenceKinds and vetoes are empty. Event pairs never receive a resolution verdict and always carry not_judged; market verdicts never transfer to events or entire clusters.

meta.matchQualityTruncated is present and true only when a page contains more than 1,000 pairs to label. Pairs beyond the cap receive unavailable; the field is absent otherwise. Only these operations can set it:

  • fetchMarketMatches and its fetchMatches alias, in lookup or browse mode.
  • fetchMatchedMarkets and its fetchMatchedPrices alias.
  • compareMarketPrices and fetchHedges.
  • fetchMatchedMarketClusters, counting rawMatches across the page when requested.
  • GET /v1/discrepancies, for stored and live pages.

GET /v1/clusters returns a plain page. When you need to narrow the set, GET /api/{exchange}/fetchMatchedMarketClusters is the filterable projection of the same store:

  • minSimilarity: floor on the stored similarity score.
  • venue allow/deny lists — restrict which venues may appear.
  • category — taxonomy scope.
  • relation filtering: identity, subset or superset, asking only what cross-venue matching actually verified.
  • includeRawMatches — up to 100 pairwise matches per cluster, for auditing why a cluster formed.

Members come back as full UnifiedMarket objects with the same delist-stable clusterId. When member price changes are enabled on this deployment, an open, active member also carries the same priceChange* fields and coverage as fetchMarket, plus priceChangeAsOf; closed members carry none.

status defaults to open, today’s live set. Use status=closed for multi-venue clusters that stopped being rebuilt because a leg closed, resolved, or stopped matching. They are kept for 30 days. Every cluster carries status; only closed clusters carry closedAt. Each leg is its current market record. status=all sorts and pages the open and closed union, with page.total equal to both totals combined. sort=newest uses closedAt for closed clusters. marketId and slug lookups and includeRawMatches apply only to open clusters. relation and relations also apply to open clusters only. With status=closed they are ignored; with status=all they narrow open rows only. Closed rows match updatedSince on their archived updated_at, rather than a relation edge time.

sort=volume orders market clusters by the stored USD sum of the legs’ 24-hour volume, descending, with null sums last and clusterId ascending for ties. A sum is null when any leg lacks a complete USD figure. This order applies before paging to open, closed, and combined views. The stored aggregate is not recomputed from current market records during the request.

Every market cluster carries volume24hUsd, a number or null, and createdAt, an ISO date-time or null. createdAt records the first time the cluster was computed and stays stable across recomputes and revivals. It is null only for clusters archived before the field existed; those clusters age out of the 30-day archive. asOf still records matching freshness.

Terminal window
curl -s "$PREDICTEFY_API_URL/api/router/fetchMatchedMarketClusters?status=closed&limit=20" \
-H "Authorization: Bearer pk_live_YOUR_KEY"

Two omissions are deliberate. volume24h is absent, because native volume units can differ between legs; use the stored volume24hUsd aggregate instead. And there is no per-cluster relations field: the filter can ask what cross-venue matching verified, but the response does not assert a relation it did not compute.

GET /api/{exchange}/fetchMatchedEventClusters is the event-grain equivalent; it has no status views, volume ranking, volume24hUsd, or createdAt.

Clusters match markets. GET /api/{exchange}/fetchEventMatches matches events, which is a different question — “is this the same election?” rather than “is this the same contract?”

It has two modes. Without an eventId it browses, returning cross-venue event pairs from a cluster page as sourceEvent and event. With an eventId it looks up co-member events for the canonical "{venue}:{eventId}" anchor.

Scores are similarity, never confidence, and reasoning is null: event matching emits no per-match rationale, so the field is present and empty rather than filled with something invented. There are no prices on this surface; it is discovery, not quoting.

Returns 404 ROUTE_NOT_FOUND when event matching is not enabled on the API deployment you call.

Terminal window
curl -s "$PREDICTEFY_API_URL/v1/discrepancies" \
-H "Authorization: Bearer pk_live_YOUR_KEY"

Pass ?live=true to recompute each discrepancy from live order-book mids instead of the latest snapshot prices (the response’s meta.live tells you which you got).

Use expand=markets to add the catalog market object to every low and high leg: title, venue, status, close time, image URL when stored, imageResolved and imageSource (both nullable), liquidity, and volume. The optional volume24hSource key is present only when the market’s volume source is known. The CSV expand query parameter supports only markets today; any other value returns 400. The expansion adds no extra metering weight.

Stored mode has a limit default of 20 and a maximum of 100. live=true has a maximum of 10, because every live cluster recomputes against real order books.

Rules review applies to the served surface. A cluster whose cross-venue pairs are still awaiting review is withheld from the normal rows; includeHeld=true also returns it as a diagnostic row carrying judgeHoldReason: "judge_verdict_pending", and page.total counts those diagnostic rows too. includeHeld=true with live=true returns 400. meta.judgeBeforeServe reports heldClusters inside your category and sandbox scope with reason: "judge_verdict_pending"; heldClusters can be zero.

GET /v1/discrepancies is a snapshot of now. GET /v1/discrepancies/history is the record of how it got there — change-only snapshots, newest first, so a run of identical readings does not pad the response. History is an unfiltered record of observations: the price checks that keep empty order books and large stored-price gaps out of GET /v1/discrepancies never filter or rewrite it.

Terminal window
curl -s "$PREDICTEFY_API_URL/v1/discrepancies/history?clusterId=CLUSTER&from=2026-08-01" \
-H "Authorization: Bearer pk_live_YOUR_KEY"

from and to accept ISO-8601 timestamps or epoch milliseconds. to defaults to now, from defaults to 24 hours before to, and every range is capped at 90 days. Filter to one cluster with clusterId.

Metered with the history weight rather than the cheaper catalog weight.

fetchArbitrage (GET /api/router/fetchArbitrage) is router-only and assesses a bounded contract size against live asks:

Terminal window
curl -s "$PREDICTEFY_API_URL/api/router/fetchArbitrage?contracts=100&limit=500&executableOnly=true&venues=polymarket,kalshi&minEdge=0.02" \
-H "Authorization: Bearer pk_live_YOUR_KEY"

The endpoint supports limit up to 500 and an opaque cursor for subsequent pages (page.nextCursor). A published cursor pins the exact surface version (meta.seq). Cursors expire 60 seconds after issuance by default, measured per page hop. Set snapshotTTL in milliseconds on page 1: on the computed path (filtered or non-default requests) a value up to 86,400,000 ms is honored, and 0 disables the per-hop expiry. On the published arbitrage surface the server keeps a replaced page’s snapshot for up to ten minutes (600,000 ms) by default; the service may keep a page for less under load, and the expiry error states the actual lifetime it had. On this path snapshotTTL is capped at the configured retention TTL (default: 600,000 ms) and 0 means that cap, not forever. On 400 VALIDATION_ERROR with Cursor has expired: this page's snapshot was kept for <N> s; fetch the next page sooner, raise snapshotTTL on page 1 (up to <cap> ms), or restart without a cursor (cap: the configured retention TTL, default 600000 ms, on the published path, 86400000 ms on the computed path), the caller must discard the partial walk and restart from page 1 without a cursor. The TypeScript SDK’s iterateArbitrage lets the caller control the pace: it fetches the next page only after the caller drains the current one. If the pinned version expires, the iterator throws ValidationError with the expiry message above, potentially after yielding rows. The caller must discard the partial walk and restart from page 1 without a cursor. iterateArbitrage requests 500-row pages by default (100 with a stake) and preserves a caller’s limit.

Per-leg freshness. See the per-leg book freshness change. Each leg (legs.buyYes, legs.buyNo) carries asOf, its ISO-8601 book observation time, or null when the book is missing. Each timestamp comes from the exact input book used for that leg’s assessment. REST responses return asOf: null for each unknown older leg observation. Those timestamps stay null until the service replaces the row with observed evidence. Older servers and stream frames can omit these keys. Treat null or absent observations as unknown. bookSource identifies predictefy-live (live feed) or venue-rest (direct venue read); it is null when missing or unknown. live reports the service’s assessment, not the venue’s capability. true means the service read the book from a live subscription it assessed as live at that time. false means a direct venue read (bookSource: "venue-rest") or a feed snapshot accepted under the 60-second rule (bookSource: "predictefy-live"). That feed case includes upstreams without liveness reporting, such as Gemini, Opinion and SX Bet, and scheduled Polymarket feed recycle windows. live: null means the book is missing or unavailable; asOf and bookSource are also null. Older frames omit these keys. Consumers needing a venue read must check bookSource, not live. The row’s assessedAt is the ISO-8601 time when the service computed it, never null. The row’s existing asOf stays the earlier leg time, or null when either book is missing: a last observation, not an expiry. A live leg keeps its asOf until the book changes. The service accepts live-subscription books up to a configured maximum age since their last observation. The limit in use is 7,200,000 ms (2 hours). Other feed snapshots use a 60,000 ms (1 minute) limit. Beyond the applicable ceiling, the service attempts a venue read or marks the leg unavailable. Gate each row’s currency on its assessedAt on published pages, computed-fallback pages and streamed frames alike. A row without assessedAt, such as one from an older build, has unknown currency and must not be treated as fresh. On published and streamed rows, allow for at least the 30-second snapshot interval before treating assessedAt as stale. meta.asOf is the surface publish time, not a row clock; computed-fallback pages omit it. A published row keeps the assessedAt of the pass that priced it, which can be a minute or more before meta.asOf. A leg’s live: true means the service had a live subscription for that leg at assessedAt, not at meta.asOf. Use per-leg asOf for your own book freshness policy. A recent response or live: true does not prove recent observations. For a strict 60-second policy, apply this extra gate to each returned row:

const now = Date.now();
const observations = [row.legs.buyYes.asOf, row.legs.buyNo.asOf];
const hasRecentBooks = observations.every((asOf) => {
if (typeof asOf !== 'string') return false;
const observedAt = Date.parse(asOf);
const ageMs = now - observedAt;
return Number.isFinite(observedAt) && ageMs >= 0 && ageMs <= 60_000;
});

This rejects null, absent, invalid, future, or older observations. Both legs must pass. Check assessedAt separately. Keep every execution gate, including the resolution-equivalence check. This consumer policy does not change the service’s book-age ceilings. See Data freshness for the separate observation, assessment, and publication clocks. Older servers and stream frames can omit these keys. Treat any of these fields that is absent as unknown. They are present on computed-fallback, published and streamed rows. Published and streamed assessedAt and per-leg asOf refresh with the 30-second snapshot or a material row change, like row asOf. The row change key intentionally excludes those clocks.

Each base cluster expands into every ordered cross-venue pair (buyYes on venue A and buyNo on venue B), with 90 rows as a pathology guard. If that guard truncates a pathological cluster, every emitted row is marked truncated: true. The service makes one batched live-book read per venue for the selected outcome books and reuses those results across the pairs.

Each row’s clusterId is a composite key: ${clusterId}:${venueA}:${venueB}. The base cluster id can contain :, so recover it by stripping the last two colon-delimited segments. Do not split at the first colon.

fetchArbitrage rows carry a separate rules-comparison matchScore, matchBand, and matchDifferences list of { kind, detail, points }, including verdict-confidence deductions. This score is distinct from candidate similarity: 100 means verified rules equivalence, 85 to 99 is minor, 60 to 84 is material, and lower scores or rule vetoes hide the pair. Unjudged pairs remain unscored unless close dates differ by more than 21 days. Only the existing verified and live-execution gates can authorize the arbitrage label. Qualification carries the same score explanation in checks.resolutionEquivalence.matchDeductions, with differenceKinds reserved for resolution verdict kinds. See the match score tables.

The match score is a rules comparison produced by an automated review of the two venues’ published resolution rules; it is not a probability that the markets settle identically, and trading a pair below 100 is your own risk.

The first three query filters match the WebSocket filters. pairsPerCluster is REST-only:

  • executableOnly=true — return only rows that passed every executable gate. The default returns qualifying rows and visible rejected candidates, excluding hidden match bands, with per-leg and pair-level reasons such as synthetic_book, insufficient_depth, unverified_fees, market_not_open, or an equivalence conflict.
  • venues (or venue) — comma-separated venue filter. A row remains when either its buyYes or buyNo leg uses one of those venues; the other leg may use a venue outside the list.
  • minEdge — filter by minimum net edge.
  • pairsPerCluster — optional positive integer limiting rows per base cluster. Invalid values return 400; omitting it keeps all generated pairs. On the published surface, the cap is applied after executableOnly, venues, and minEdge, then before cursor pagination.

The response meta includes { asOf, seq, source } where source is 'published' (served from the continuously published surface, fresh within its publish cadence: about 30 seconds, with a 3-second floor) or 'computed-fallback' (bounded on-demand computation over at most 10 candidate clusters, without the precomputed set). An initial page uses the fallback for a non-default contracts value, any category, or an unavailable or stale published surface.

Rules review applies to the served surface. A cluster whose cross-venue pairs are still awaiting review is left out of data on both the published and computed paths. meta.judgeBeforeServe reports heldClusters inside your category and sandbox scope with reason: "judge_verdict_pending"; heldClusters can be zero.

Re-check the live result immediately before acting because books, depth, and market status can change after the response.

The optional stake= parameter on fetchArbitrage is not available on every account. While it is unavailable, supplying it returns 400 VALIDATION_ERROR with stake is not enabled.

When enabled, stake is a USD budget greater than 0 and at most 1,000,000. Supply a single decimal number with at most two decimal places; repeated values, signs and exponents are rejected. With stake, limit must be at most 100. It adds no credits to the existing request weight.

The calculator finds the largest affordable whole-contract allocation from the row’s recorded executable price levels. It never exceeds the assessed contracts, changes the assessed size, or fetches deeper books. Each row gains a stake object with requested (the USD budget), reason and allocation. A priced allocation has reason: null and these fields:

FieldMeaning
contractsWhole contracts allocated to each leg, no more than the row’s assessed size.
legs.buyYes, legs.buyNoEach leg’s venue, canonicalMarketId, side, optional sports selection, whole contracts, ask cost before fees and verified taker fee, including any per-order minimum. Monetary amounts are USD.
settlementFeeWorst-case winning-leg settlement commission in USD.
totalCostBoth legs’ costs, taker fees and worst-case settlement commission in USD.
payoutAllocated contracts times the locked USD 1 payout.
profitpayout - totalCost, in USD.
profitabletrue only when profit is positive. Small allocations can lose money because of per-order minimum fees.
roiprofit / totalCost, floored to four decimal places; null when totalCost is zero.
unallocatedrequested - totalCost, in USD.
exactThe allocation equals the assessed contract size. It does not mean the budget was spent exactly.
cappedThe requested budget exceeds the assessed total cost, so recorded depth caps the allocation.

When an allocation cannot be priced, allocation is null and reason is:

ReasonMeaning
not_executableThe row did not pass the executable gates.
fills_unavailableThe recorded price levels or fee evidence needed to price the allocation were unavailable or could not be verified.
below_one_contractThe budget cannot afford a whole contract on each leg, including fees.

On the published path, fills_unavailable means the recorded price levels or fee evidence needed for the projection were unavailable or could not be verified; the assessment row is still served. If the read of those stored levels fails, meta.degraded is true and meta.degradedReason is fills_sidecar_unavailable. meta.stake echoes the requested budget. Without stake, the row’s stake object and meta.stake are omitted.

Why “indicative” — and never anything stronger

Section titled “Why “indicative” — and never anything stronger”

A price gap between two venues is only tradeable if executable asks (not midpoints), order-book depth at those prices, per-venue fees and gas, market open-status, and resolution equivalence (the two markets truly settle on the same terms) all check out — live, at execution time. The discrepancy endpoints do not apply those gates.

They tell you where to look, not what to trade:

  • By default, prices compared are each cluster member’s stored Yes price from the catalog snapshot; live=true instead overlays current order-book mid-prices, and on some venues the book itself is reconstructed (synthetic: true) — indicative either way.
  • Two markets in a cluster may resolve on subtly different terms.
  • Fees, gas, spread, and depth routinely exceed a small headline gap.

Treat the output as a research signal and do your own verification. Existing cross-match lookups cost 5 credits; price-gap queries and cross-venue comparisons cost 10 credits.