API Documentation

Overview

The Prediqt API provides programmatic access to prediction markets — place orders, query prices, manage positions, and stream real-time data. All market settlement happens on-chain on Polygon; the API handles off-chain order matching and data queries.

Base URL: https://api.prediqt.com

An interactive Swagger UI is available at https://api.prediqt.com/api-docs. It documents every endpoint, request body, and response schema.

Authentication

The API supports three authentication methods:

API Key

Create an API key from the Settings page in the app. Pass it via the x-api-key header:

curl -H "x-api-key: pm_live_your_key_here" \
  https://api.prediqt.com/markets

Bearer Token (Privy JWT)

If you authenticate through the web app, you receive a Privy JWT. Pass it via the Authorization header:

curl -H "Authorization: Bearer <token>" \
  https://api.prediqt.com/orders

EIP-191 Signature

For wallet-based authentication without Privy, sign a message containing a timestamp with your wallet (EIP-191 personal sign) and send three headers:

  • x-addressYour wallet address
  • x-signatureEIP-191 personal sign of a message containing the timestamp
  • x-timestampUnix timestamp (must be within 5 minutes for replay protection)
curl -H "x-address: 0xYourWalletAddress" \
  -H "x-signature: 0xSignatureHex" \
  -H "x-timestamp: 1700000000" \
  https://api.prediqt.com/orders

Public endpoints (markets list, prices, trades) do not require authentication. Authenticated endpoints (listing your orders, managing API keys) require one of the methods above.

REST Endpoints

Markets

  • GET /marketsList all markets with filtering and pagination
  • GET /markets/:idGet detailed market information
  • GET /markets/:id/candlesOHLCV candle data for price charts
  • GET /markets/:id/orderbookOrder book depth for a market
  • GET /markets/:id/tradesRecent trades for a market
  • GET /markets/:id/activityActivity feed for a market
  • GET /markets/:id/holdersTop holders of a market

Orders

  • POST /ordersSubmit a new signed order
  • GET /ordersList active orders for the authenticated user
  • GET /orders/:hashGet order details by hash
  • DELETE /orders/:hashCancel an order by its hash
  • POST /orders/batchSubmit multiple orders in a single request
  • DELETE /orders/batchCancel multiple orders by their hashes
  • DELETE /orders/cancel-allCancel all open orders for the authenticated user
  • DELETE /orders/market/:marketIdCancel all open orders for a specific market
  • GET /orders/nonce/:addressGet current signing nonce for an address
  • POST /orders/nonceIncrement nonce to bulk-cancel all prior orders

POST /orders is self-authenticating via the EIP-712 signature embedded in the order body — no API key or bearer token is needed for this endpoint. Other authenticated endpoints (listing your orders, cancelling, managing API keys) require one of the auth methods above.

Prices

  • GET /priceGet a single token price
  • GET /pricesGet batch token prices
  • GET /booksGet batch order book data
  • GET /spreadGet bid-ask spread for a token
  • GET /midpointGet midpoint price for a token
  • GET /tick-sizeGet the tick size (minimum price increment)

Trades

  • GET /tradesList trades globally with filters and pagination

Auth

  • POST /auth/api-keyCreate a new API key
  • GET /auth/api-keyList API keys for the authenticated user
  • DELETE /auth/api-key/:idRevoke an API key

This covers the core trading endpoints. For the complete API reference including user profiles, balances, events, leaderboard, comments, and notifications, visit the interactive Swagger documentation.

WebSocket

Real-time data is delivered over Socket.IO (not raw WebSocket). Connect to the same base URL as the REST API:

import { io } from "socket.io-client";

const socket = io("https://api.prediqt.com");

// Subscribe to channels
socket.emit("subscribe", ["orderbook:market-id", "trades:market-id"]);

// Listen for updates
socket.on("orderbook", (data) => console.log(data));
socket.on("trade", (data) => console.log(data));

Channels

  • orderbook:{marketId} Order book updates (snapshot on subscribe, then deltas)
  • trades:{marketId} Trade executions for a market
  • market:{marketId} Market price and status updates
  • price:{tokenId}Individual token price updates
  • user:{address}Private channel for user-specific updates (requires authentication)

Authentication (WebSocket)

To subscribe to private user: channels, authenticate after connecting:

// EIP-191 signature auth
socket.emit("authenticate", {
  address: "0x...",
  signature: "0x...",
  timestamp: Date.now(),
});

// Or Privy token auth
socket.emit("authenticate", { token: "privy-jwt-token" });

socket.on("authenticated", (data) => {
  // Now you can subscribe to user channels
  socket.emit("subscribe", ["user:0x..."]);
});

Rate Limits

Order submission endpoints (POST /orders and POST /orders/batch) have strict rate limits to prevent abuse. If you hit a rate limit you will receive a 429 Too Many Requests response.

For high-frequency operations, use the batch endpoints (POST /orders/batch, DELETE /orders/batch) to submit or cancel multiple orders in a single request.

Getting Started

  1. Create an account — Sign up and log in to the Prediqt app.
  2. Create an API key — Go to Settings and generate an API key. Copy it immediately; it will not be shown again.
  3. Fetch markets — List available markets:
curl -H "x-api-key: pm_live_your_key_here" \
  https://api.prediqt.com/markets
  1. Check prices — Get the current price for a token:
curl "https://api.prediqt.com/price?tokenId=TOKEN_ID"
  1. Place an order — Submit a signed order (orders must be signed with your wallet using EIP-712):
curl -X POST https://api.prediqt.com/orders \
  -H "Content-Type: application/json" \
  -d '{
    "order": { ... },
    "signature": "0x..."
  }'

Note: POST /orders does not require an API key or bearer token — the EIP-712 signature in the request body authenticates the order.

For the full request and response schemas, refer to the interactive Swagger documentation.