PAPI
API Reference

API Overview

Complete REST API reference for PAPI

API Reference

The PAPI REST API provides authenticated access to prediction market data and trading across Polymarket and Kalshi. All exchange responses are normalized into unified types.

Base URL

https://papi.tylerthebuildor.com

Authentication

All endpoints (except /health and /auth/*) require a Bearer token in the Authorization header:

curl https://papi.tylerthebuildor.com/polymarket/markets \
  -H "Authorization: Bearer papi_sk_live_a1b2c3d4e5f6..."

Two token types are supported:

  • API keys (papi_sk_*) -- For SDK and programmatic access. Scoped to read, trade, or admin.
  • JWT tokens -- For dashboard sessions. Issued via /auth/login or OAuth callbacks.

See Authentication for details.

Endpoint Reference

Public

MethodEndpointDescription
GET/healthHealth check (no auth required)

Auth (public)

MethodEndpointDescription
POST/auth/signupCreate a new account
POST/auth/loginSign in with email/password
POST/auth/verify-emailVerify email address
POST/auth/forgot-passwordRequest password reset
POST/auth/reset-passwordReset password with token
POST/auth/google/callbackGoogle OAuth callback
POST/auth/github/callbackGitHub OAuth callback
POST/auth/refreshRefresh JWT (reads cookie)
POST/auth/logoutSign out (clears cookie, requires auth)

Identity

MethodEndpointScopeDescription
GET/meanyCurrent user info and scopes

Polymarket -- Market Data

MethodEndpointScopeDescription
GET/polymarket/marketsreadList markets
GET/polymarket/markets/{id}readGet a single market
GET/polymarket/eventsreadList events
GET/polymarket/orderbooksreadGet order book for a token
GET/polymarket/tradesreadGet trades for a token
GET/polymarket/candlesticksreadGet OHLCV candles
GET/polymarket/walletreadGet wallet info
GET/polymarket/wallet/pnl/{address}readGet wallet PnL

Polymarket -- Trading

MethodEndpointScopeDescription
POST/polymarket/orderstradeCreate an order
GET/polymarket/orderstradeList open orders
GET/polymarket/orders/{order_id}tradeGet a single order
DELETE/polymarket/orders/{order_id}tradeCancel an order
GET/polymarket/positionstradeGet positions
GET/polymarket/balancetradeGet balance

Kalshi -- Market Data

MethodEndpointScopeDescription
GET/kalshi/marketsreadList markets
GET/kalshi/markets/{ticker}readGet a single market
GET/kalshi/eventsreadList events
GET/kalshi/orderbooksreadGet order book for a ticker
GET/kalshi/tradesreadGet trades for a ticker
GET/kalshi/candlesticksreadGet OHLCV candles

Kalshi -- Trading

MethodEndpointScopeDescription
POST/kalshi/orderstradeCreate an order
GET/kalshi/orderstradeList open orders
GET/kalshi/orders/{order_id}tradeGet a single order
DELETE/kalshi/orders/{order_id}tradeCancel an order
GET/kalshi/positionstradeGet positions
GET/kalshi/balancetradeGet balance
GET/kalshi/trades/metradeGet your fills/trades

Cross-Exchange

MethodEndpointScopeDescription
GET/matching-marketsreadFind matching markets across exchanges

Account (JWT-protected)

MethodEndpointDescription
GET/account/profileGet account profile
PATCH/account/profileUpdate profile
GET/account/api-keysList API keys
POST/account/api-keysCreate an API key (limit: 1 per user)
DELETE/account/api-keys/{key_prefix}Revoke an API key
GET/account/credentialsCheck credential status
PUT/account/credentials/polymarketStore Polymarket credentials
PUT/account/credentials/kalshiStore Kalshi credentials
DELETE/account/credentials/{exchange}Remove exchange credentials

Admin (JWT + admin role)

MethodEndpointDescription
GET/admin/access/modeGet current access mode
PUT/admin/access/modeSet access mode
GET/admin/access/rulesList access rules
POST/admin/access/rulesCreate access rule
DELETE/admin/access/rules/{id}Delete access rule
GET/admin/usersList all users
PUT/admin/users/{id}/statusUpdate user status

Response Format

Successful responses return data directly. Market list endpoints return raw arrays, not wrapped objects.

Error responses use a consistent format:

{
  "error": {
    "code": "unauthorized",
    "message": "Invalid or expired API key"
  }
}

Financial Values

All financial values (prices, volumes, balances) are serialized as strings to preserve decimal precision. Kalshi prices are converted from cents to decimals (e.g., 62 cents becomes "0.62").

Rate Limiting

All authenticated endpoints are rate limited to 60 requests per minute per API key. Response headers include X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset. See Errors for details.

On this page