Back to home

Partner API

v1 25 Endpoints

One API key. Two integration models. Zero PII. Everything you need to embed conviction markets into your platform.

Core Concepts

How it works

Three things to understand before you start integrating.

One API Key

Your API key encodes your partner identity. No separate headers, no partner ID in payloads. We decode the key and know who's calling.

pk_live_<hash> pk_test_<hash>

Two-Tier Security

Non-financial (search, feed, prices) — API key validates, execute. Fast path.

Financial (join, withdraw, resale) — API key + DB ownership check. Prevents cross-partner access.

Zero PII

Users are identified by opaque external_id only. Emails, names, and personal data are rejected at validation.

Format: ^[a-zA-Z0-9_-]{4,128}$

Account Lifecycle

Five steps from zero to trading

Create an account, fund the wallet, join markets. That's the core loop.

1

Create Account

Partner calls POST /v1/accounts with an external_id. AnyBid returns account_id + deterministic wallet address.

2

Fund Wallet

Partner sends USDC on-chain to the wallet address. AnyBid detects deposits automatically.

3

Join Markets

User picks a side and backs it with funds. Wallet balance checked, funds locked, matched peer-to-peer.

4

Market Resolves

Outcome determined by data sources. Winnings deposited to wallet automatically.

5

Withdraw

Partner requests withdrawal to any valid ERC20 address. USDC sent on-chain.

Integration Models

Two ways to integrate

Same API, same key, same endpoints. Choose the model that fits your team.

Model A: Headless API

Server-to-server contract. Your backend is the trust boundary. Build your own UI, your own UX, your own experience. Every endpoint in this doc is available to you.

Your frontend → Your backend → AnyBid API

Full control. Full flexibility.

Model C: Companion App

A white-labeled, pre-built prediction market UI deployed under your domain. Themed to your brand — colors, logo, radius, fonts. Open source, so you can inspect every line.

Your platform → Token redirect → Companion App → AnyBid API

Fastest path to production.

How the Companion App works

Architecture
  • SvelteKit frontend + thin proxy backend
  • Backend uses the same Headless API — no privileged access
  • Auth via one-time token redirect from your platform
  • Real-time updates via Server-Sent Events (webhook → SSE push)
Theming
  • Config-driven — one file per partner
  • Brand color, surface, text, radius, logo
  • Maps to CSS custom properties at runtime
  • No build step for rebranding — one config change, one deploy
partner.config.ts
export const theme = {
  brand: '#FF6B00',
  surface: '#FFFFFF',
  text: '#1A1A1A',
  radius: '8px',
  logo: '/brand/logo.svg'
};

The companion app is open source. Without an API key, it's an empty shell — the value is in the infrastructure, not the UI code.

Group 1

Accounts

Create user accounts and wallets. Idempotent — same external_id returns the existing record.

POST /v1/accounts
API Key

Create account — returns account_id + wallet address

GET /v1/accounts/{account_id}
API Key

Get account info + wallet + balance

POST /v1/accounts/batch
API Key

Batch create accounts (migration)

Request — POST /v1/accounts
{
  "external_id": "usr_abc123"
}
Response 200
{
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "external_id": "usr_abc123",
  "wallet_address": "0x7a3b...f4e2",
  "balance_usdc": "0.00",
  "created": true
}
Response 400 — invalid external_id
{
  "error": "invalid_external_id",
  "message": "external_id must be 4-128 characters, alphanumeric with _ and - only. No emails, no personal data."
}

Group 2

Discovery

Search, browse, and get personalized recommendations. Non-financial — fast path, no ownership checks.

POST /v1/markets/search
API Key

Semantic vector search across markets

GET /v1/markets/{market_id}
API Key

Single market detail

POST /v1/markets/{market_id}/prices
API Key

Lightweight price refresh

GET /v1/feed
API Key

Personalized recommendations (requires account_id)

POST /v1/accounts/{account_id}/onboard
API Key

Initialize interest profile

GET /v1/health
API Key

Service status

Group 3

Market Creation

Two-step process: generate a quote, then create the market. Quote locks all parameters — tamper-proof.

POST /v1/quotes
API Key

Generate settlement quote for a claim

GET /v1/quotes/{quote_id}
API Key

Check quote status

POST /v1/markets/create/{quote_id}
Financial

Create market from approved quote

Step 1: Generate Quote

Request — POST /v1/quotes
{
  "statement": "Bitcoin will exceed $150,000 by December 31, 2026",
  "settlement_date": "2027-01-01T00:00:00Z"
}
Response 200
{
  "quote_id": "quo_2026_abc123_def456",
  "settleable": true,
  "tier": "AAA",
  "market_class": "HIGH_LOW",
  "fee": { "amount": "0.50", "currency": "USD" },
  "expires_at": "2026-02-06T12:15:00Z",
  "parsed_claim": {
    "subject": "Bitcoin price",
    "predicate": "above",
    "threshold": 150000,
    "threshold_unit": "USD"
  },
  "data_coverage": {
    "total_endpoints": 5,
    "unique_providers": 3,
    "coverage_level": "excellent"
  }
}

Step 2: Create Market

Request — POST /v1/markets/create/{quote_id}
{
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "fee_percent": 2.5
}
Response 200
{
  "market_id": "f8590e95-5037-4564-8acb-43abed05c149",
  "status": "active",
  "quote_id": "quo_2026_abc123_def456",
  "fee_percent": 2.5,
  "title": "Bitcoin will exceed $150,000 by December 31, 2026",
  "outcome_a": "Yes",
  "outcome_b": "No",
  "deadline": "2027-01-01T00:00:00Z"
}

Group 4

Join Market

The money action. User picks a side and backs it with funds from their wallet.

POST /v1/markets/{market_id}/join
Financial

Join a market (side + amount)

GET /v1/accounts/{account_id}/entries
API Key

List markets account has joined

GET /v1/accounts/{account_id}/entries/{entry_id}
API Key

Single entry detail

Request — POST /v1/markets/{market_id}/join
{
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "side": "yes",
  "amount_usdc": "50.00"
}
Response 200
{
  "entry_id": "a29f4e71-8c3d-4b5a-9e6f-7d8c9b0a1e2f",
  "market_id": "f8590e95-5037-4564-8acb-43abed05c149",
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "side": "yes",
  "amount_usdc": "50.00",
  "odds_at_entry": 0.65,
  "potential_payout": "76.92",
  "fee_charged": "1.25",
  "status": "open"
}

Status lifecycle: openmatchedwon | lost

Response 400 — insufficient balance
{
  "error": "insufficient_balance",
  "available_usdc": "25.00",
  "required_usdc": "51.25",
  "breakdown": {
    "amount": "50.00",
    "fee": "1.25"
  }
}

Group 5

Resale

Selling a betting slip. Not trading. Conviction-compatible exit.

POST /v1/resale
Financial

List an entry for resale

DELETE /v1/resale/{listing_id}
Financial

Cancel a listing

POST /v1/resale/{listing_id}/buy
Financial

Buy someone's listed entry

GET /v1/markets/{market_id}/resale
API Key

Browse available listings for a market

Request — POST /v1/resale
{
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "entry_id": "a29f4e71-8c3d-4b5a-9e6f-7d8c9b0a1e2f",
  "ask_price_usdc": "55.00",
  "resale_target": "marketplace"
}
Response 200
{
  "listing_id": "b38e5f82-9d4e-5c6b-af70-8e9d0c1b2f3a",
  "entry_id": "a29f4e71-8c3d-4b5a-9e6f-7d8c9b0a1e2f",
  "ask_price_usdc": "55.00",
  "resale_target": "marketplace",
  "status": "listed",
  "expires_at": "2026-02-13T12:10:00Z"
}

Two targets: marketplace (another user buys at asking price) or matching_engine (sell back at current odds, guaranteed fill).

Group 6

Withdrawals

Financial action with its own lifecycle. Destination can be any valid ERC20 address.

POST /v1/withdrawals
Financial

Request withdrawal to any ERC20 address

GET /v1/withdrawals/{withdrawal_id}
API Key

Check withdrawal status

Request — POST /v1/withdrawals
{
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "amount_usdc": "100.00",
  "destination_address": "0xdef..."
}
Response 200
{
  "withdrawal_id": "c47f6a93-ae5f-6d7c-b081-9fae1d2c3a4b",
  "account_id": "550e8400-e29b-41d4-a716-446655440000",
  "status": "processing",
  "amount_usdc": "100.00",
  "settlement_fee": "0.03",
  "net_amount": "99.97",
  "estimated_completion_seconds": 300
}

Group 7

Webhooks

Partner-level event delivery. Register endpoints, receive signed events with exponential backoff retry.

POST /v1/webhooks
API Key

Register webhook endpoint

GET /v1/webhooks
API Key

List registered webhooks

DELETE /v1/webhooks/{webhook_id}
API Key

Remove webhook

POST /v1/webhooks/{webhook_id}/test
API Key

Send test event

Event Catalog

EventTriggerKey Fields
market.joinedJoin submitted to contractentry_id, market_id, account_id, side, amount
market.joined.matchedFully matched peer-to-peerentry_id, account_id, tx_hash
market.joined.failedMatch failedentry_id, account_id, reason
market.resolvedOutcome determinedmarket_id, outcome, resolution_source
market.settledPayouts executedmarket_id, proof_bundle_url
balance.updatedAny balance changeaccount_id, new_balance, change_amount, reason
withdrawal.completedWithdrawal on-chainwithdrawal_id, account_id, tx_hash
resale.listedEntry listed for resalelisting_id, entry_id, account_id, ask_price
resale.soldResale executedlisting_id, buyer_account_id, seller_account_id, price
resale.cancelledListing cancelled/expiredlisting_id, reason
market.createdNew market on networkmarket_id, title

Delivery Envelope

Signed with X-AnyBid-Signature (HMAC-SHA256). Retry: 30s → 2min → 10min → 1hr → 6hr. Dead letter after 5 failures. Expected: 2xx within 5 seconds.

Webhook Delivery Example
{
  "event": "market.joined.matched",
  "event_id": "e69b8cb5-ca7b-8f9e-d2a3-b1ca3f4e5c6d",
  "timestamp": "2026-02-06T12:10:05Z",
  "data": {
    "entry_id": "a29f4e71-8c3d-4b5a-9e6f-7d8c9b0a1e2f",
    "market_id": "f8590e95-5037-4564-8acb-43abed05c149",
    "account_id": "550e8400-e29b-41d4-a716-446655440000",
    "side": "yes",
    "amount_usdc": "50.00",
    "odds_at_entry": 0.65,
    "tx_hash": "0xabc..."
  }
}

Complete Surface

25 Endpoints

Seven groups. Two auth levels. One API key.

GroupCountAuth LevelPriority
Accounts3API Key (create/read)P0
Discovery6API Key onlyP0
Market Creation3Financial on create, API Key on quotesP0
Join Market3Financial on join, API Key on readP0
Resale4Financial on all write opsP1
Withdrawals2FinancialP0
Webhooks4API Key (partner-level)P0
Total25

Funding

What we do and don't do

Blockchain is the deposit mechanism. We watch the chain and update balances. You handle collection.

We do

  • Generate deterministic wallet address per account at creation
  • Watch on-chain for incoming USDC to known wallets
  • Update balance when deposits confirm
  • Fire balance.updated webhook
  • Reject joins when balance insufficient (with exact shortfall)
  • Process withdrawals to any valid ERC20 address

We don't

  • Collect money from users (partner's responsibility)
  • Convert fiat to USDC (partner's responsibility)
  • Provide deposit notification endpoint (the chain is the notification)
  • Care when or how the partner funds wallets
  • Restrict withdrawal destinations (valid address = we send it)

Ready to integrate?

One API key. Six weeks to production. Your brand, your users, your revenue.