Ravioli
Ravioli
DebatesMarketsPortfolioIdeasShop
RavioliRavioli

Free-to-play, logic-weighted prediction markets and debates. Predict, argue, and climb the leaderboard. No money needed.

Explore

  • Markets
  • Debates
  • Live
  • Leaderboard

Community

  • Find people
  • Ideas
  • Shop

Learn

  • Blog
  • About

Company

  • Send feedback
  • Report a bug
  • Privacy Policy
  • Terms of Service

© 2026 Ravioli. All rights reserved.

Play money only. No real-money wagering.

Skip to content
Ravioli
Ravioli
DebatesMarketsPortfolioIdeasShop
API

Ravioli API

REST endpoints for prediction-market trading on Ravioli. Read live AMM prices and order books, execute AMM swaps, and place or cancel limit orders. Real-time updates are delivered over Supabase Realtime.

Authentication

The API is currently not open for third-party API-key registration. Endpoints accept either:

  • A logged-in Supabase session (used by the web app — handled automatically via cookies).
  • x-mobile-api-key: <MOBILE_API_KEY> together withAuthorization: Bearer <supabase_access_token> for the official mobile client.

All write endpoints require an authenticated user; read endpoints may still rate-limit unauthenticated traffic by IP.

API Reference

GET/api/v1/amm/quote
Quote an AMM swap

Returns the expected shares received for a given USD-denominated input on the CPMM AMM. Read-only. Rate-limited to 120 requests/minute.

curl -X GET "https://www.ravioli.live/api/v1/amm/quote?market_id=MARKET_ID&side=yes&amount=10&outcome_id=OUTCOME_ID"
GET/api/v1/amm/prices
Current AMM prices

Returns current implied prices per outcome from the AMM pool reserves for a market.

curl -X GET "https://www.ravioli.live/api/v1/amm/prices?market_id=MARKET_ID"
POST/api/v1/amm/swap
Execute an AMM buy

Buys outcome shares against the AMM pool. Atomic credit-debit + share-mint via Postgres function. Rate-limited to 30 requests/minute.

curl -X POST "https://www.ravioli.live/api/v1/amm/swap" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "MARKET_ID",
    "outcome_id": "OUTCOME_ID",
    "side": "yes",
    "amount": 10
  }'
POST/api/v1/amm/sell
Sell shares back to the AMM

Returns USD credits for shares sold against the AMM pool. Includes per-market and hourly rate caps in addition to the standard write limit.

curl -X POST "https://www.ravioli.live/api/v1/amm/sell" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "MARKET_ID",
    "outcome_id": "OUTCOME_ID",
    "side": "yes",
    "shares": 25
  }'
POST/api/v1/amm/smart-quote
Smart-routed quote (AMM vs CLOB)

Compares AMM and order-book pricing for a buy and returns the cheaper route plus the resulting fill plan.

curl -X POST "https://www.ravioli.live/api/v1/amm/smart-quote" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "MARKET_ID",
    "outcome_id": "OUTCOME_ID",
    "side": "yes",
    "amount": 10
  }'
GET/api/v1/orderbook/book
Read the order book

Returns the bid/ask book for a market and position side ('yes' or 'no'). Read-limited to 120 requests/minute.

curl -X GET "https://www.ravioli.live/api/v1/orderbook/book?market_id=MARKET_ID&position_side=yes"
POST/api/v1/orderbook/place
Place a limit order

Places a limit order on the CLOB. Matched via Postgres triggers; partial fills supported. Rate-limited to 30 requests/minute.

curl -X POST "https://www.ravioli.live/api/v1/orderbook/place" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "MARKET_ID",
    "outcome_id": "OUTCOME_ID",
    "side": "buy",
    "position_side": "yes",
    "price": 0.65,
    "quantity": 100
  }'
POST/api/v1/orderbook/cancel
Cancel a limit order

Cancels an open limit order owned by the authenticated user. Refunds the unfilled portion to credits or shares.

curl -X POST "https://www.ravioli.live/api/v1/orderbook/cancel" \
  -H "Content-Type: application/json" \
  -d '{ "order_id": "ORDER_ID" }'
GET/api/v1/outcomes/orderbook
Multi-outcome order book

Returns the order book for a specific outcome inside a multi-outcome market.

curl -X GET "https://www.ravioli.live/api/v1/outcomes/orderbook?market_id=MARKET_ID&outcome_id=OUTCOME_ID"
POST/api/v1/outcomes/place
Place a multi-outcome limit order

Places a limit order against a single outcome of a multi-outcome market.

curl -X POST "https://www.ravioli.live/api/v1/outcomes/place" \
  -H "Content-Type: application/json" \
  -d '{
    "market_id": "MARKET_ID",
    "outcome_id": "OUTCOME_ID",
    "side": "buy",
    "price": 0.32,
    "quantity": 50
  }'
GET/api/v1/trades
Recent trades for a market

Returns the most recent fills for the given market across the AMM and CLOB.

curl -X GET "https://www.ravioli.live/api/v1/trades?market_id=MARKET_ID"
RTSupabase Realtime
Live updates

Live market and debate updates are delivered via Supabase Realtime channels (Postgres logical replication), not a custom WebSocket. Subscribe with the Supabase JS client:

import { createClient } from '@supabase/supabase-js'

const supabase = createClient(SUPABASE_URL, SUPABASE_ANON_KEY)

supabase
  .channel('market-MARKET_ID')
  .on('postgres_changes', {
    event: '*',
    schema: 'public',
    table: 'trades',
    filter: 'market_id=eq.MARKET_ID',
  }, (payload) => {
    console.log('New trade:', payload.new)
  })
  .subscribe()

Rate Limits

  • Read endpoints (quotes, prices, books, trades): 120 req/min per user.
  • Write endpoints (swap, sell, place, cancel): 30 req/min per user.
  • amm/sell additionally caps total sells per hour and per market to prevent rapid pool drains.
  • Limits are Redis-backed (Upstash) with an in-memory fallback in dev.