polymarket-api1

Data & APIs

Provides REST API endpoints to query markets, place/cancel orders, manage portfolio, create alerts, and automate Polymarket trading.

Install

openclaw skills install polymarket-api1

Polymarket Trading API - Usage Guide

What This API Does

Provides HTTP endpoints to trade Polymarket prediction markets:

  • Query markets with filters
  • Place buy/sell orders
  • Manage positions and portfolio
  • Create price alerts
  • Webhook integration for automated trading

Base URL

http://YOUR_SERVER:8000/api/v1

Key Rules

RuleValue
Minimum order$5.00 USD
Price range0.01 - 0.99
Token ID sourcemarket["tokens"][0]["token_id"]

Quick Examples

Get Active Markets

import httpx

BASE_URL = "http://localhost:8000/api/v1"

markets = httpx.get(f"{BASE_URL}/markets/active", params={
    "limit": 10,
    "volume_num_min": 5000
}).json()

# Get token_id
token_id = markets["markets"][0]["tokens"][0]["token_id"]
price = markets["markets"][0]["tokens"][0]["price"]

Place Order

order = httpx.post(f"{BASE_URL}/orders", json={
    "token_id": token_id,
    "side": "BUY",
    "amount": 5.0,  # Minimum $5!
    "price": price,
    "order_type": "GTC"
}).json()

Check Order

status = httpx.get(f"{BASE_URL}/orders/{order_id}").json()

Cancel Order

httpx.delete(f"{BASE_URL}/orders/{order_id}")

Endpoints

Markets

MethodEndpointDescription
GET/marketsList markets with filters
GET/markets/activeActive markets only
GET/markets/trendingHigh volume markets
GET/markets/ending-soonMarkets ending soon
GET/markets/sportsSports markets
GET/markets/{token_id}Market details
GET/markets/{token_id}/priceCurrent price
GET/markets/{token_id}/orderbookOrder book
GET/markets/{token_id}/price-historyPrice history
GET/markets/{token_id}/contextMarket context

Orders

MethodEndpointDescription
POST/ordersPlace order
GET/ordersList orders
GET/orders/{id}Order details
GET/orders/{id}/statusOrder status from Polymarket
DELETE/orders/{id}Cancel order
DELETE/orders/cancel-allCancel all

Wallet

MethodEndpointDescription
GET/wallet/addressYour address
GET/wallet/balanceUSDC balance
GET/wallet/allowancesToken allowances
POST/wallet/approveApprove tokens

Portfolio

MethodEndpointDescription
GET/positionsCurrent positions
GET/portfolioPortfolio summary
GET/portfolio/summaryDetailed summary
GET/trading/limitsTrading limits
GET/trading/daily-statsDaily trading stats
POST/trading/can-tradeCheck if can trade

Events

MethodEndpointDescription
GET/eventsList events
GET/events/activeActive events
GET/events/{id}Event details

Alerts

MethodEndpointDescription
POST/alertsCreate alert
GET/alertsList alerts
DELETE/alerts/{id}Delete alert

Market Import

MethodEndpointDescription
GET/markets/importableAvailable markets
POST/markets/importImport market
GET/markets/importedImported markets
GET/markets/imported/{id}Import details
POST/markets/imported/{id}/syncSync market

Webhooks

MethodEndpointDescription
POST/webhook/clawOpenClaw trade signal
POST/webhook/order-statusOrder status webhook
GET/webhook/healthWebhook health

Security

MethodEndpointDescription
GET/security/whitelistIP whitelist
POST/security/whitelist/ipAdd IP
DELETE/security/whitelist/ipRemove IP
GET/security/whitelist/check/{ip}Check IP
POST/security/api-keysAdd API key
DELETE/security/api-keysDelete API key
GET/security/my-ipYour IP

Health

MethodEndpointDescription
GET/healthHealth check
GET/statusAPI status

Market Filters

# Filter by volume, dates, status
markets = httpx.get(f"{BASE_URL}/markets", params={
    "active": True,
    "volume_num_min": 10000,
    "end_date_max": "2026-12-31T23:59:59Z",
    "order": "volumeNum",
    "ascending": False,
    "limit": 20
}).json()

Common Errors

ErrorSolution
"Size lower than minimum: 5"Increase amount to $5+
"market not found"Use token_id from market["tokens"]
"Access restricted"Use VPN (region blocked)
"Invalid api key"Restart server to regenerate credentials

Required Headers

None required by default. Enable IP whitelist or API key auth in .env if needed.


Notes

  1. Always use market["tokens"][i]["token_id"] for orders
  2. Minimum order amount is $5.00
  3. Prices are 0.01 to 0.99
  4. Restart server after changing .env