Skip to main content
The Connect API provides real-time streaming for market data, order updates, and position changes using the Connect protocol.
Why Connect?Connect is a modern RPC protocol that works over HTTP/1.1, HTTP/2, and HTTP/3. It provides the benefits of gRPC (streaming, strong typing) while remaining compatible with standard HTTP tooling.

When to Use Connect

Use CaseRecommended API
Real-time market dataConnect Streaming
Order execution updatesConnect Streaming
Position changesConnect Streaming
Trade capture reportsConnect Streaming
Request/response queriesREST API
Historical data queriesREST API

Available Streams

ServiceStreamDescription
Market DataCreateMarketDataSubscriptionReal-time L2 order book updates
OrdersCreateOrderSubscriptionOrder status and execution updates
PositionsCreatePositionSubscriptionPosition and balance changes
Drop CopyCreateDropCopySubscriptionExecution feed for all accounts
Drop CopyCreateTradeCaptureReportSubscriptionTrade capture reports
Drop CopyCreatePositionChangeSubscriptionPosition change events
Drop CopyCreateInstrumentStateChangeSubscriptionInstrument state changes

Connect vs REST vs gRPC

FeatureRESTConnectgRPC
ProtocolHTTP/1.1HTTP/1.1, HTTP/2HTTP/2
StreamingNoYesYes
Browser supportYesYesLimited
Code generationOptionalYesYes
DebuggingEasyEasyRequires tools
RecommendationUse REST for simple queries and one-off requests. Use Connect for real-time streaming when you need live updates. Use gRPC if you’re already integrated with gRPC tooling.

Quick Start

import requests
import json

# Connect streaming uses Server-Sent Events (SSE)
# The endpoint is the same as gRPC but over HTTP

BASE_URL = "https://api.preprod.polymarketexchange.com"

def stream_market_data(token: str, symbols: list[str]):
    """Stream market data updates for given symbols."""
    headers = {
        "Authorization": f"Bearer {token}",
        "Content-Type": "application/json",
        "Accept": "application/connect+json"
    }

    payload = {
        "symbols": symbols,
        "depth": 5
    }

    # Connect streaming endpoint
    url = f"{BASE_URL}/polymarket.v1.MarketDataSubscriptionAPI/CreateMarketDataSubscription"

    with requests.post(url, headers=headers, json=payload, stream=True) as response:
        for line in response.iter_lines():
            if line:
                data = json.loads(line)
                print(f"Update: {data}")

Next Steps