Skip to main content
Complete reference documentation for all Protocol Buffer messages, fields, and enumerations used in the gRPC streaming API.

Available Services

The Polymarket Exchange API exposes the following gRPC services:
ServiceDescription
polymarket.v1.MarketDataSubscriptionAPIReal-time market data streaming
polymarket.v1.OrderEntryAPIOrder submission and streaming
polymarket.v1.CombosAPICombo RFQs, quotes, and RFQ event streaming (upcoming beta)
polymarket.v1.OrderAPIOrder search and history
polymarket.v1.PositionAPIPosition and balance queries
polymarket.v1.AccountsAPIAccount information
polymarket.v1.MarketDataAPIInstrument and symbol data
polymarket.v1.DropCopyAPIExecution feed
polymarket.v1.KYCAPIKYC verification
polymarket.v1.AeropayAPIACH payments
polymarket.v1.CheckoutAPICard payments
polymarket.v1.FundingAPIFunding management
polymarket.v1.HealthAPIHealth check

Obtaining Proto Files

Download Proto Files

Get the complete Protocol Buffer definitions to generate client libraries in any language

Option 2: gRPC Server Reflection

Use gRPC reflection to discover services at runtime. Install grpcurl first.
# List all services
grpcurl -authority grpc-prod.polymarketexchange.com grpc-prod.polymarketexchange.com:443 list

# Example output:
# polymarket.v1.AccountsAPI
# polymarket.v1.AeropayAPI
# polymarket.v1.MarketDataSubscriptionAPI
# polymarket.v1.OrderEntryAPI
# ...

# Describe a specific service
grpcurl -authority grpc-prod.polymarketexchange.com grpc-prod.polymarketexchange.com:443 \
  describe polymarket.v1.MarketDataSubscriptionAPI

# Describe a message type
grpcurl -authority grpc-prod.polymarketexchange.com grpc-prod.polymarketexchange.com:443 \
  describe polymarket.v1.CreateMarketDataSubscriptionRequest
The -authority flag sets the :authority header for TLS certificate validation.

Generating Python Client Code

After downloading the proto files, generate Python code:
# Extract protos
unzip polymarket-v1-protos.zip -d protos/polymarket/v1/

# Generate Python code
python -m grpc_tools.protoc \
  --python_out=. \
  --grpc_python_out=. \
  --proto_path=protos \
  protos/polymarket/v1/*.proto
This generates:
  • *_pb2.py - Message and enum definitions
  • *_pb2_grpc.py - Service stubs

Market Data Streaming

MarketDataSubscriptionAPI Service

service MarketDataSubscriptionAPI {
    rpc CreateMarketDataSubscription(CreateMarketDataSubscriptionRequest)
        returns (stream CreateMarketDataSubscriptionResponse);
}

Python Usage

from polymarket.v1 import marketdatasubscription_pb2
from polymarket.v1 import marketdatasubscription_pb2_grpc

# Create request
request = marketdatasubscription_pb2.CreateMarketDataSubscriptionRequest(
    symbols=["SYMBOL-123"],
    depth=10
)

# Use stub
stub = marketdatasubscription_pb2_grpc.MarketDataSubscriptionAPIStub(channel)
response_stream = stub.CreateMarketDataSubscription(request, metadata=metadata)

Request Fields

FieldTypeDescription
symbolslist[str]Symbols to subscribe to. Empty = all symbols.
unaggregatedboolIf true, receive raw orders. If false, aggregated book.
depthintNumber of price levels. Default: 10
snapshot_onlyboolIf true, receive snapshot then close.

Response Fields

if response.HasField('heartbeat'):
    # Keep-alive message
    pass
elif response.HasField('update'):
    update = response.update
    print(f"Symbol: {update.symbol}")
    print(f"Bids: {len(update.bids)}")
    print(f"Offers: {len(update.offers)}")
FieldTypeDescription
symbolstrInstrument symbol
bidslist[BookEntry]Bid side of order book
offerslist[BookEntry]Offer/ask side of order book
stateInstrumentStateCurrent instrument state (optional)
statsInstrumentStatsMarket statistics
Instrument State Tracking: The state field is optional. Use ListInstruments to get and cache the initial state, then subscribe to the instrument state change subscription for real-time state updates.

Order Entry Streaming

OrderEntryAPI Service

service OrderEntryAPI {
    rpc CreateOrderSubscription(CreateOrderSubscriptionRequest)
        returns (stream CreateOrderSubscriptionResponse);

    rpc InsertOrder(InsertOrderRequest) returns (InsertOrderResponse);
    rpc CancelOrder(CancelOrderRequest) returns (CancelOrderResponse);
}

Python Usage

from polymarket.v1 import trading_pb2
from polymarket.v1 import trading_pb2_grpc

# Create order subscription request
request = trading_pb2.CreateOrderSubscriptionRequest(
    symbols=["SYMBOL-123"],
    accounts=[],
    snapshot_only=False
)

# Use stub
stub = trading_pb2_grpc.OrderEntryAPIStub(channel)
response_stream = stub.CreateOrderSubscription(request, metadata=metadata)

Subscription Request Fields

FieldTypeDescription
symbolslist[str]Filter by symbols. Empty = all.
accountslist[str]Filter by accounts. Empty = all user’s accounts.
snapshot_onlyboolIf true, snapshot only.

Response Processing

if response.HasField('heartbeat'):
    pass
elif response.HasField('snapshot'):
    for order in response.snapshot.orders:
        print(f"Order: {order.id} - {order.symbol}")
elif response.HasField('update'):
    for execution in response.update.executions:
        print(f"Execution: {execution.id}")

RFQ Events Streaming

Upcoming - beta access required. RFQ events are part of the upcoming Combos API beta. Reach out to institutional@polymarket.us to join the beta test.

CombosAPI Service

service CombosAPI {
    rpc StreamRFQEvents(StreamRFQEventsRequest)
        returns (stream StreamRFQEventsResponse);
}

Request Fields

StreamRFQEventsRequest is currently empty.

Response Events

Each StreamRFQEventsResponse has one event payload:
EventDescription
rfq_createdA new combo RFQ was created.
rfq_expiredA combo RFQ expired.
rfq_action_rejectedAn RFQ action was rejected.
quote_createdA quote was created.
quote_deletedA quote was deleted.
quote_acceptedA quote was accepted.
quote_expiredA quote expired.
quote_passedA quote was passed.
quote_done_awayA quote was done away.
quote_pending_riskA quote entered pending-risk state.
quote_pending_end_tradeA quote entered pending end-trade state.
quote_status_rejectedA quote status transition was rejected.
For request/response field detail and a Python example, see RFQ Events Streaming.

Funding Streaming

FundingAPI Service

service FundingAPI {
    rpc CreateFundingTransactionSubscription(CreateFundingTransactionSubscriptionRequest)
        returns (stream CreateFundingTransactionSubscriptionResponse);

    rpc CreateBalanceLedgerSubscription(CreateBalanceLedgerSubscriptionRequest)
        returns (stream CreateBalanceLedgerSubscriptionResponse);
}
RPCDescriptionRequired Scope
CreateFundingTransactionSubscriptionReal-time deposit / withdrawal state changesread:funding
CreateBalanceLedgerSubscriptionReal-time balance ledger entries with resume_time replayread:positions

CreateBalanceLedgerSubscriptionRequest

FieldTypeDescription
accountstrRequired. Fully qualified account name.
currencystrOptional. ISO currency code (e.g., USD).
entry_typeslist[LedgerEntryType]Optional. Filter by allowlisted entry types.
resume_timeTimestampOptional. Replay entries with update_time >= resume_time. Clamped to 2026-05-01T00:00:00Z.
For full request/response field detail and a Python example, see Balance Ledger Streaming.

Enumerations

Side

NameValue
SIDE_BUY1
SIDE_SELL2

OrderType

NameValue
ORDER_TYPE_MARKET_TO_LIMIT1
ORDER_TYPE_LIMIT2
ORDER_TYPE_STOP3
ORDER_TYPE_STOP_LIMIT4

TimeInForce

Name                                                ValueDescription
TIME_IN_FORCE_DAY1Expires end of day
TIME_IN_FORCE_GTC2Good-till-canceled
TIME_IN_FORCE_IOC3Immediate-or-cancel
TIME_IN_FORCE_FOK4Fill-or-kill
TIME_IN_FORCE_GTT5Good-till-time

OrderState

Name                                                ValueDescription
ORDER_STATE_NEW1Accepted and resting
ORDER_STATE_PARTIALLY_FILLED2Partially executed
ORDER_STATE_FILLED3Completely filled
ORDER_STATE_CANCELED4Canceled
ORDER_STATE_REJECTED7Rejected
ORDER_STATE_EXPIRED9Expired

ExecutionType

Name                                                ValueDescription
EXECUTION_TYPE_NEW1Order confirmation
EXECUTION_TYPE_PARTIAL_FILL2Partial fill
EXECUTION_TYPE_FILL3Complete fill
EXECUTION_TYPE_CANCELED4Cancellation
EXECUTION_TYPE_REJECTED7Rejection
EXECUTION_TYPE_TRADE9Trade execution
EXECUTION_TYPE_EXPIRED10Expiration

InstrumentState

Primary State Flow

Name                                                ValueDescription
INSTRUMENT_STATE_PENDING8Initial state for a newly created instrument which has not yet begun trading.
INSTRUMENT_STATE_OPEN1In this state, the instrument is open for continuous order entry and matching.
INSTRUMENT_STATE_CLOSED0In this state, orders can not be entered, modified, or canceled, and no matching occurs. Any existing Day orders will be expired.
INSTRUMENT_STATE_EXPIRED4An instrument moves to this state when its Expiration Date/Time is reached. In this state, any resting orders are expired and no new orders can be entered.
INSTRUMENT_STATE_TERMINATED5When an instrument’s Termination Date is reached, the order book is removed from the matching engine, orders are canceled, and positions are closed. Historical data will still remain in Polymarket US ledgers.

Exception States

Name                                                ValueDescription
INSTRUMENT_STATE_SUSPENDED3Orders can be canceled but no matching occurs, and no order entry or modification is allowed.
INSTRUMENT_STATE_HALTED6This state is similar to SUSPENDED, with the exception that orders cannot be canceled.

Other Possible States

Name                                                ValueDescription
INSTRUMENT_STATE_PREOPEN2Orders can be entered and modified, but no matching occurs. When the instrument transitions to an OPEN state, the orders entered during PREOPEN will match at a single opening price that is automatically determined by an algorithm that is designed to maximize the volume traded at the open.
INSTRUMENT_STATE_MATCH_AND_CLOSE_AUCTION7This state is similar to PREOPEN, with the exception that matching will occur upon the transition of this state to any other state. This state is useful if you want matching to occur at the end of the state, but you don’t want the instrument to be open after.

LedgerEntryType

Used by CreateBalanceLedgerSubscription and the Balance Ledger REST endpoints. Only the allowed values are returned to clients; suppressed values are filtered server-side.

Allowed

NameValueDescription
DEPOSIT1Funds deposited
WITHDRAWAL2Funds withdrawn
ORDER_EXECUTION3Cash impact of a trade execution
CORRECTION4Manual correction
RESOLUTION6Market resolution / settlement payout
MANUAL_ADJUSTMENT7Admin adjustment
ACCOUNT_PROPERTY_ADJUSTMENT10Account property change
COMMISSION11Trading fee
WITHDRAWAL_REJECTION16Failed withdrawal returned to balance
MANUAL_TRANSFER17Internal transfer
PENDING_WITHDRAWAL_CREATION22Withdrawal initiated (funds reserved)

Suppressed (internal — never returned to clients)

NameValue
NETTING5
SECURITY_BALANCE_ADJUSTMENT8
SECURITY_MARK_TO_MARKET9
CONTRACT_EXPIRATION12
PENDING_CREDIT_ADJUSTMENT13
BEGINNING_OF_DAY14
SECURITY_WITHDRAWAL15
AVERAGE_PRICE_TRANSFER18
GIVE_UP19
SYNCHRONIZATION20
INTEREST21
SETTLEMENT_FEE23
Requesting a suppressed value in entry_types returns Aborted (HTTP 409).

Price Representation

All prices are int64 values. Divide by the instrument’s price_scale to get the decimal value.
decimal_price = order.price / order.price_scale
print(f"Price: ${decimal_price:.4f}")

Next Steps

Market Data Stream

Learn about market data streaming

Order Stream

Learn about order streaming

Error Handling

Handle errors and reconnections